Catch error 502 bad status

Just in case server restarts in the middle of everything, let's retry.
This commit is contained in:
angelblue05 2018-06-11 01:12:42 -05:00
parent 90f3ae7b07
commit 1da4d0cf2e
3 changed files with 7 additions and 4 deletions

View file

@ -374,7 +374,7 @@ class Artwork(object):
if not image_url: if not image_url:
log.warn("empty url for: %s/%s", kodi_id, media_type) log.debug("empty url for: %s/%s/%s", kodi_id, media_type, image_type)
return return
cache_image = False cache_image = False

View file

@ -19,7 +19,7 @@ import xbmc
import downloadutils import downloadutils
import database import database
from utils import window, settings from utils import window, settings, should_stop
from contextlib import closing from contextlib import closing
################################################################################################# #################################################################################################
@ -56,12 +56,15 @@ def _http(action, url, request={}):
return do.downloadUrl(url, action_type=action, parameters=request['params']) return do.downloadUrl(url, action_type=action, parameters=request['params'])
except downloadutils.HTTPException as error: except downloadutils.HTTPException as error:
if error.status is None: if error.status is None or error.status == 502:
while True: while True:
if xbmc.Monitor().waitForAbort(15): if xbmc.Monitor().waitForAbort(15):
raise raise
if should_stop():
raise
if window('emby_online') == "true": if window('emby_online') == "true":
log.info("Retrying http query...") log.info("Retrying http query...")
break break

View file

@ -577,7 +577,7 @@ class Read_EmbyServer():
try: try:
users = self.doUtils.downloadUrl(url, authenticate=False) users = self.doUtils.downloadUrl(url, authenticate=False)
except Exception as error: except Exception as error:
log.info("Error getting users from server: " + str(error)) log.info("Error getting users from server: %s", str(error))
users = [] users = []
return users return users