FIX: dude.

This commit is contained in:
evilhero 2019-03-13 12:01:59 -04:00
parent 848504be21
commit 56eee36363
1 changed files with 28 additions and 21 deletions

View File

@ -3679,11 +3679,14 @@ def getImage(comicid, url, issueid=None):
r = requests.get(url, params=None, stream=True, verify=mylar.CONFIG.CV_VERIFY, headers=mylar.CV_HEADERS) r = requests.get(url, params=None, stream=True, verify=mylar.CONFIG.CV_VERIFY, headers=mylar.CV_HEADERS)
except Exception as e: except Exception as e:
logger.warn('[ERROR: %s] Unable to download image from CV URL link: %s' % (e, url)) logger.warn('[ERROR: %s] Unable to download image from CV URL link: %s' % (e, url))
coversize = 0
statuscode = '400'
else:
statuscode = str(r.status_code)
logger.fdebug('comic image retrieval status code: %s' % statuscode)
logger.fdebug('comic image retrieval status code: %s' % r.status_code) if statuscode != '200':
logger.warn('Unable to download image from CV URL link: %s [Status Code returned: %s]' % (url, statuscode))
if str(r.status_code) != '200':
logger.warn('Unable to download image from CV URL link: %s [Status Code returned: %s]' % (url, r.status_code))
coversize = 0 coversize = 0
else: else:
if r.headers.get('Content-Encoding') == 'gzip': if r.headers.get('Content-Encoding') == 'gzip':
@ -3700,11 +3703,15 @@ def getImage(comicid, url, issueid=None):
statinfo = os.stat(coverfile) statinfo = os.stat(coverfile)
coversize = statinfo.st_size coversize = statinfo.st_size
if int(coversize) < 10000 or str(r.status_code) != '200': if any([int(coversize) < 10000, statuscode != '200']):
if str(r.status_code) != '200': try:
if statuscode != '200':
logger.info('Trying to grab an alternate cover due to problems trying to retrieve the main cover image.') logger.info('Trying to grab an alternate cover due to problems trying to retrieve the main cover image.')
else: else:
logger.info('Image size invalid [%s bytes] - trying to get alternate cover image.' % coversize) logger.info('Image size invalid [%s bytes] - trying to get alternate cover image.' % coversize)
except Exception as e:
logger.info('Image size invalid [%s bytes] - trying to get alternate cover image.' % coversize)
logger.fdebug('invalid image link is here: %s' % url) logger.fdebug('invalid image link is here: %s' % url)
if os.path.exists(coverfile): if os.path.exists(coverfile):