Small modification to start websocket

Step to eliminate the need to restart Kodi after setting the sources, etc.
This commit is contained in:
angelblue05 2015-03-27 04:45:28 -05:00
parent a69918f13f
commit 56b60ca408
1 changed files with 15 additions and 9 deletions

View File

@ -21,6 +21,7 @@ librarySync = LibrarySync()
class Service():
newWebSocketThread = None
def __init__(self, *args ):
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
@ -34,15 +35,12 @@ class Service():
ConnectionManager().checkServer()
player = Player()
lastProgressUpdate = datetime.today()
newWebSocketThread = WebSocketThread()
newWebSocketThread.start()
# check kodi library sources
mayRun = utils.checkKodiSources()
player = Player()
lastProgressUpdate = datetime.today()
interval_FullSync = 120
interval_IncrementalSync = 30
@ -50,6 +48,9 @@ class Service():
cur_seconds_incrsync = interval_IncrementalSync
if mayRun:
ws = WebSocketThread()
while not xbmc.abortRequested:
xbmc.sleep(1000)
@ -80,6 +81,11 @@ class Service():
# background worker for database sync
if DownloadUtils().authenticate(retreive=False) != "":
# Correctly launch the websocket, if user manually launches the add-on
if (self.newWebSocketThread == None):
self.newWebSocketThread = "Started"
ws.start()
#full sync
if(cur_seconds_fullsync >= interval_FullSync):
xbmc.log("Doing_Db_Sync: syncDatabase (Started)")
@ -119,8 +125,8 @@ class Service():
utils.logMsg("MB3 Sync Service", "stopping Service",0)
if(newWebSocketThread != None):
newWebSocketThread.stopClient()
if (self.newWebSocketThread != None):
ws.stopClient()
#start the service