Replaced sleep with waitForAbort()

Hopefully helps with the hang crash.
This commit is contained in:
angelblue05 2015-04-11 07:56:07 -05:00
parent 31656e4684
commit 0d616fef94

View file

@ -11,6 +11,8 @@ import threading
import urllib import urllib
import socket import socket
import websocket import websocket
import KodiMonitor
from ClientInformation import ClientInformation from ClientInformation import ClientInformation
from DownloadUtils import DownloadUtils from DownloadUtils import DownloadUtils
from PlaybackUtils import PlaybackUtils from PlaybackUtils import PlaybackUtils
@ -26,6 +28,8 @@ class WebSocketThread(threading.Thread):
keepRunning = True keepRunning = True
def __init__(self, *args): def __init__(self, *args):
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
addonSettings = xbmcaddon.Addon(id='plugin.video.emby') addonSettings = xbmcaddon.Addon(id='plugin.video.emby')
level = addonSettings.getSetting('logLevel') level = addonSettings.getSetting('logLevel')
self.logLevel = 0 self.logLevel = 0
@ -286,12 +290,13 @@ class WebSocketThread(threading.Thread):
self.client.on_open = self.on_open self.client.on_open = self.on_open
while(self.keepRunning): while not self.KodiMonitor.abortRequested():
self.logMsg("Client Starting") self.logMsg("Client Starting")
self.client.run_forever() self.client.run_forever()
if(self.keepRunning): if(self.keepRunning):
self.logMsg("Client Needs To Restart") self.logMsg("Client Needs To Restart")
xbmc.sleep(10000) if self.KodiMonitor.waitForAbort(10000):
break
self.logMsg("Thread Exited") self.logMsg("Thread Exited")