From 5b86aa1ca9d8cdfc3b171c1f95a9170b4f2fcdef Mon Sep 17 00:00:00 2001 From: sfaulds Date: Thu, 17 Nov 2016 07:07:49 +1100 Subject: [PATCH] add exception and notification when not logged in --- addon.xml | 2 +- resources/lib/database.py | 2 +- resources/lib/downloadutils.py | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/addon.xml b/addon.xml index 69bdafbb..ec17d9b5 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/database.py b/resources/lib/database.py index ec4906a9..da417e2f 100644 --- a/resources/lib/database.py +++ b/resources/lib/database.py @@ -233,5 +233,5 @@ def db_reset(): dialog.ok(heading=language(29999), line1=language(33088)) xbmc.executebuiltin('RestartApp') - return xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem()) + #return xbmcplugin.setResolvedUrl(int(sys.argv[1]), False, xbmcgui.ListItem()) \ No newline at end of file diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index b9d55961..6a2acaf1 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -225,6 +225,14 @@ class DownloadUtils(object): 'headers': self.get_header(server_id, authenticate) }) + if not server['Server'] or not server['UserId']: + log.error("Server or UserId not set, not logged in, returning None") + xbmcgui.Dialog().notification(heading=lang(29999), + message="Not Logged In", + icon=xbmcgui.NOTIFICATION_ERROR, + time=5000) + raise internal_exceptions.ExceptionWrapper("Not Logged In") + # Replace for the real values url = url.replace("{server}", server['Server']) url = url.replace("{UserId}", server['UserId'])