Merge pull request #1633 from croneter/py3-fix-logging
Fix logging if fanart.tv lookup fails: be less verbose
This commit is contained in:
commit
678e4b5ab1
3 changed files with 19 additions and 17 deletions
|
@ -223,7 +223,11 @@ class DownloadUtils(object):
|
|||
if r.status_code != 401:
|
||||
self.count_unauthorized = 0
|
||||
|
||||
if r.status_code == 204:
|
||||
if return_response is True:
|
||||
# return the entire response object
|
||||
return r
|
||||
|
||||
elif r.status_code == 204:
|
||||
# No body in the response
|
||||
# But read (empty) content to release connection back to pool
|
||||
# (see requests: keep-alive documentation)
|
||||
|
@ -257,9 +261,6 @@ class DownloadUtils(object):
|
|||
elif r.status_code in (200, 201):
|
||||
# 200: OK
|
||||
# 201: Created
|
||||
if return_response is True:
|
||||
# return the entire response object
|
||||
return r
|
||||
try:
|
||||
# xml response
|
||||
r = utils.etree.fromstring(r.content)
|
||||
|
|
|
@ -220,12 +220,14 @@ class Artwork(object):
|
|||
else:
|
||||
# Not supported artwork
|
||||
return artworks
|
||||
data = DU().downloadUrl(url, authenticate=False, timeout=15)
|
||||
try:
|
||||
data.get('test')
|
||||
except AttributeError:
|
||||
LOG.error('Could not download data from FanartTV')
|
||||
data = DU().downloadUrl(url,
|
||||
authenticate=False,
|
||||
timeout=15,
|
||||
return_response=True)
|
||||
if not data.ok:
|
||||
LOG.debug('Could not download data from FanartTV')
|
||||
return artworks
|
||||
data = data.json()
|
||||
|
||||
fanart_tv_types = list(v.FANART_TV_TO_KODI_TYPE)
|
||||
|
||||
|
|
|
@ -357,16 +357,15 @@ class Media(object):
|
|||
filename,
|
||||
extension)
|
||||
response = DU().downloadUrl(url, return_response=True)
|
||||
try:
|
||||
response.status_code
|
||||
except AttributeError:
|
||||
if not response.ok:
|
||||
LOG.error('Could not temporarily download subtitle %s', url)
|
||||
LOG.error('HTTP status: %s, message: %s',
|
||||
response.status_code, response.text)
|
||||
return
|
||||
else:
|
||||
LOG.debug('Writing temp subtitle to %s', path)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
return path
|
||||
LOG.debug('Writing temp subtitle to %s', path)
|
||||
with open(path, 'wb') as f:
|
||||
f.write(response.content)
|
||||
return path
|
||||
|
||||
def validate_playurl(self, path, typus, force_check=False, folder=False,
|
||||
omit_check=False):
|
||||
|
|
Loading…
Reference in a new issue