From 33b2171dcf94bd7904f2080e6ec95de2c2b1b8d3 Mon Sep 17 00:00:00 2001 From: elParaguayo Date: Sun, 2 Oct 2016 13:31:33 +0100 Subject: [PATCH] Correcting use of xbmc modules --- resources/lib/image_cache.py | 2 +- resources/lib/notificationqueue.py | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/resources/lib/image_cache.py b/resources/lib/image_cache.py index 7e3532d..cc81b1c 100644 --- a/resources/lib/image_cache.py +++ b/resources/lib/image_cache.py @@ -14,7 +14,7 @@ IMG_PLAYER_THUMB = 2 IMG_TEAM_BADGE = 3 -_A_ = xbmcaddon.Addon() +_A_ = xbmcaddon.Addon("service.bbclivefootballscores") ADDON_PROFILE = xbmc.translatePath(_A_.getAddonInfo('profile')).decode('utf-8') diff --git a/resources/lib/notificationqueue.py b/resources/lib/notificationqueue.py index ed18cda..aea0144 100644 --- a/resources/lib/notificationqueue.py +++ b/resources/lib/notificationqueue.py @@ -84,6 +84,7 @@ def __init__(self, timeout=2000, num_workers=5, self.level = 0 self.detailed = detailed self.advanced = advanced + self.monitor = xbmc.Monitor() self.can_thread = CAN_THREAD # try: @@ -124,6 +125,7 @@ def set_advanced(self, advanced): def set_level(self, level): self.level = level + debug("Queue: Notification level: {0}".format(self.level)) def Notify(self, title, message, icon=None, timeout=2000): @@ -274,12 +276,12 @@ def showAdvanced(self, filename): xbmc.sleep(self.timeout + 250) xbmc.executebuiltin("Skin.Reset(showscoredialog)") xbmc.sleep(250) - os.remove(filename) + #os.remove(filename) def __process(self): - while not xbmc.abortRequested: - while not (self.queue.empty() or xbmc.abortRequested): + while not self.monitor.abortRequested(): + while not (self.queue.empty() or self.monitor.abortRequested()): self.busy = True mode, payload = self.queue.get() if mode == NOTIFY_STANDARD_DISPLAY: @@ -290,12 +292,13 @@ def __process(self): elif mode == NOTIFY_ADVANCED_DISPLAY: self.showAdvanced(payload) - xbmc.sleep(500) + if self.monitor.waitForAbort(0.5): + break def _advancedNotificationWorker(self): - while not xbmc.abortRequested: - while not (self.worker_queue.empty() or xbmc.abortRequested): + while not self.monitor.abortRequested(): + while not (self.worker_queue.empty() or self.monitor.abortRequested()): action, payload = self.worker_queue.get() if action == NOTIFY_ADVANCED_PREPARE: advanced_notification = createAdvancedNotification(*payload) @@ -303,4 +306,5 @@ def _advancedNotificationWorker(self): advanced_notification)) self.worker_queue.task_done() - xbmc.sleep(500) + if self.monitor.waitForAbort(0.5): + break