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