From ccaddf6908786818aea97e622825a4e4c1cd3e86 Mon Sep 17 00:00:00 2001 From: sfaulds Date: Sun, 13 Aug 2017 13:14:51 +1000 Subject: [PATCH] remove service check as it is no longer needed --- addon.xml | 2 +- resources/lib/functions.py | 23 ----------------------- service.py | 27 ++++++++++++--------------- 3 files changed, 13 insertions(+), 39 deletions(-) diff --git a/addon.xml b/addon.xml index fc03295..92ef602 100644 --- a/addon.xml +++ b/addon.xml @@ -1,7 +1,7 @@ diff --git a/resources/lib/functions.py b/resources/lib/functions.py index 34f0322..66e2cc3 100644 --- a/resources/lib/functions.py +++ b/resources/lib/functions.py @@ -63,7 +63,6 @@ def mainEntryPoint(): except: params = {} - checkService() home_window = HomeWindow() if (len(params) == 0): @@ -1067,28 +1066,6 @@ def showParentContent(pluginName, handle, params): log.debug("showParentContent Content Url : " + str(contentUrl)) getContent(contentUrl, params) -def checkService(): - home_window = HomeWindow() - time_stamp = home_window.getProperty("Service_Timestamp") - loops = 0 - while not time_stamp and not xbmc.Monitor().abortRequested(): - loops = loops + 1 - if loops == 100: - log.error("EmbyCon Service Not Running, no time stamp, exiting") - xbmcgui.Dialog().ok(i18n('error'), i18n('service_not_running'), i18n('restart_kodi')) - sys.exit() - xbmc.sleep(200) - time_stamp = home_window.getProperty("Service_Timestamp") - - log.debug("EmbyCon Service Timestamp: " + time_stamp) - log.debug("EmbyCon Current Timestamp: " + str(int(time.time()))) - - if ((int(time_stamp) + 240) < int(time.time())): - log.error("EmbyCon Service Not Running, time stamp to old, exiting") - xbmcgui.Dialog().ok(i18n('error'), i18n('service_not_running'), i18n('restart_kodi')) - sys.exit() - - def search(handle, params): log.debug('search Called: ' + str(params)) item_type = params.get('item_type') diff --git a/service.py b/service.py index 2a71d93..510204d 100644 --- a/service.py +++ b/service.py @@ -6,6 +6,7 @@ import xbmcaddon import xbmcgui import time import json +import traceback from resources.lib.downloadutils import DownloadUtils from resources.lib.simple_logging import SimpleLogging @@ -297,28 +298,24 @@ home_window = HomeWindow() while not xbmc.abortRequested: - if xbmc.Player().isPlaying(): - - try: + try: + if xbmc.Player().isPlaying(): if (time.time() - last_progress_update) > 10: last_progress_update = time.time() sendProgress() + else: + play_data = home_window.getProperty("play_item_message") + if play_data: + home_window.clearProperty("play_item_message") + play_info = json.loads(play_data) + playFile(play_info) + except Exception as error: + log.error("Exception in Playback Monitor : " + str(error)) + log.error(traceback.format_exc()) - except Exception as error: - log.error("Exception in Playback Monitor : " + str(error)) - - else: - play_data = home_window.getProperty("play_item_message") - if play_data: - home_window.clearProperty("play_item_message") - play_info = json.loads(play_data) - playFile(play_info) - - home_window.setProperty("Service_Timestamp", str(int(time.time()))) xbmc.sleep(1000) # clear user and token when loggin off -home_window.clearProperty("Service_Timestamp") home_window.clearProperty("userid") home_window.clearProperty("AccessToken") home_window.clearProperty("Params")