only try to download if we have a url
This commit is contained in:
parent
e623307d19
commit
debe3823e2
1 changed files with 8 additions and 6 deletions
|
@ -843,15 +843,17 @@ def download_cover(id):
|
||||||
url = i.meta.get('cover')
|
url = i.meta.get('cover')
|
||||||
else:
|
else:
|
||||||
url = None
|
url = None
|
||||||
|
cover = None
|
||||||
|
|
||||||
logger.debug('download cover %s %s', id, url)
|
logger.debug('download cover %s %s', id, url)
|
||||||
ratio = None
|
ratio = None
|
||||||
try:
|
if url:
|
||||||
cover = ox.net.read_url(url)
|
try:
|
||||||
ratio = get_ratio(cover)
|
cover = ox.net.read_url(url)
|
||||||
except:
|
ratio = get_ratio(cover)
|
||||||
logger.debug('unable to read cover url %s', url)
|
except:
|
||||||
cover = None
|
logger.debug('unable to read cover url %s', url)
|
||||||
|
cover = None
|
||||||
with db.session():
|
with db.session():
|
||||||
i = Item.get(id, for_update=True)
|
i = Item.get(id, for_update=True)
|
||||||
if i:
|
if i:
|
||||||
|
|
Loading…
Reference in a new issue