check LocalTrailerCount as a number

dont log metrics for 400 errors as they are mostly server issues
This commit is contained in:
sfaulds 2016-11-21 11:51:00 +11:00
parent 62c284fdd7
commit 4aef5d7551
3 changed files with 6 additions and 6 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby"
name="Emby"
version="2.3.19"
version="2.3.20"
provider-name="Emby.media">
<requires>
<import addon="xbmc.python" version="2.19.0"/>

View file

@ -293,7 +293,7 @@ class DownloadUtils(object):
if response.status_code == 400:
log.error("Malformed request: %s", error)
raise Warning('400:' + str(error))
raise internal_exceptions.ExceptionWrapper(error)
if response.status_code == 401:
# Unauthorized

View file

@ -178,17 +178,17 @@ class Movies(Items):
except IndexError:
studio = None
if item.get('LocalTrailerCount'):
if int(item.get('LocalTrailerCount', 0)) > 0:
# There's a local trailer
url = (
"{server}/emby/Users/{UserId}/Items/%s/LocalTrailers?format=json"
% itemid
)
result = self.do_url(url)
try:
result = self.do_url(url)
trailer = "plugin://plugin.video.emby/trailer/?id=%s&mode=play" % result[0]['Id']
except IndexError:
log.info("Failed to process local trailer.")
except Exception as error:
log.info("Failed to process local trailer: " + str(error))
trailer = None
else:
# Try to get the youtube trailer