remotemetadata cleanup

- dont overwrite metadata if lookup does not return anything
- make find fail without error
This commit is contained in:
j 2015-03-01 13:19:59 +05:30
parent 0ec527dd02
commit 67788f2a04
2 changed files with 4 additions and 3 deletions

View file

@ -321,8 +321,9 @@ class Item(db.Model):
logger.debug('scrape %s', primaryid)
if primaryid:
m = meta.lookup(*primaryid)
m['primaryid'] = primaryid
self.meta = m
if m:
m['primaryid'] = primaryid
self.meta = m
self.update()
def queue_download(self):

View file

@ -23,7 +23,7 @@ def request(action, data):
def find(query):
logger.debug('find %s', query)
return request('findMetadata', {'query': query})['items']
return request('findMetadata', {'query': query}).get('items', [])
def lookup(key, value):
logger.debug('lookup %s %s', key, value)