From d0c7246de02f45fbb5edb83a7bdb6be6bf4f2707 Mon Sep 17 00:00:00 2001 From: shaun Date: Sun, 12 Apr 2015 13:01:44 +1000 Subject: [PATCH] Use waitForAbort instead of sleep also waitForAbort is in seconds not ms --- resources/lib/WebSocketClient.py | 2 +- service.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/resources/lib/WebSocketClient.py b/resources/lib/WebSocketClient.py index 4274a43a..49890135 100644 --- a/resources/lib/WebSocketClient.py +++ b/resources/lib/WebSocketClient.py @@ -302,7 +302,7 @@ class WebSocketThread(threading.Thread): self.client.run_forever() if(self.keepRunning): self.logMsg("Client Needs To Restart") - if self.KodiMonitor.waitForAbort(10000): + if self.KodiMonitor.waitForAbort(5): break self.logMsg("Thread Exited") diff --git a/service.py b/service.py index a51f6d01..8b41ab4a 100644 --- a/service.py +++ b/service.py @@ -68,7 +68,9 @@ class Service(): while not self.KodiMonitor.abortRequested(): - xbmc.sleep(1000) + if self.KodiMonitor.waitForAbort(1): + # Abort was requested while waiting. We should exit + break if xbmc.Player().isPlaying(): try: @@ -120,7 +122,9 @@ class Service(): if(libSync and countSync): startupComplete = True else: - xbmc.sleep(10000) + if self.KodiMonitor.waitForAbort(10): + # Abort was requested while waiting. We should exit + break else: xbmc.log("Not authenticated yet")