Skip to content

Commit

Permalink
Correcting use of xbmc modules
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo committed Oct 2, 2016
1 parent 00369d7 commit 33b2171
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion resources/lib/image_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
18 changes: 11 additions & 7 deletions resources/lib/notificationqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):

Expand Down Expand Up @@ -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:
Expand All @@ -290,17 +292,19 @@ 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)
self.queue.put((NOTIFY_ADVANCED_DISPLAY,
advanced_notification))
self.worker_queue.task_done()

xbmc.sleep(500)
if self.monitor.waitForAbort(0.5):
break

0 comments on commit 33b2171

Please sign in to comment.