Reworked the userclient with possibilities

Revoked token was actually broken, handle access schedule better,
restart/start properly. This is to stabilize things.
This commit is contained in:
angelblue05 2015-05-13 23:48:35 -05:00
parent 696586e952
commit 11e4a70e25
4 changed files with 51 additions and 21 deletions

View file

@ -124,7 +124,6 @@ class DownloadUtils():
self.s.mount("https://", requests.adapters.HTTPAdapter(max_retries=1))
self.logMsg("Requests session started on: %s" % self.server)
self.postCapabilities(self.deviceId)
def imageUrl(self, id, type, index, width, height):
# To move to API.py
@ -279,13 +278,14 @@ class DownloadUtils():
# Unauthorized
status = WINDOW.getProperty("Server_status")
if r.headers['X-Application-Error-Code'] == "ParentalControl":
# Parental control - access restricted
WINDOW.setProperty("Server_status", "restricted")
xbmcgui.Dialog().notification("Emby server", "Access restricted.", xbmcgui.NOTIFICATION_ERROR, time=5000)
return False
if 'x-application-error-code' in r.headers:
if r.headers['X-Application-Error-Code'] == "ParentalControl":
# Parental control - access restricted
WINDOW.setProperty("Server_status", "restricted")
xbmcgui.Dialog().notification("Emby server", "Access restricted.", xbmcgui.NOTIFICATION_ERROR, time=5000)
return False
elif (status == "401") or (status == "Auth"):
if (status == "401") or (status == "Auth"):
pass
else:
@ -293,6 +293,7 @@ class DownloadUtils():
WINDOW.setProperty("Server_status", "401")
self.logMsg("HTTP Error: %s" % e, 0)
xbmcgui.Dialog().notification("Error connecting", "Unauthorized.", xbmcgui.NOTIFICATION_ERROR)
return 401
elif (r.status_code == 301) or (r.status_code == 302):
# Redirects