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

View file

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

View file

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