mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Small modification to start websocket
Step to eliminate the need to restart Kodi after setting the sources, etc.
This commit is contained in:
parent
a69918f13f
commit
56b60ca408
1 changed files with 15 additions and 9 deletions
24
service.py
24
service.py
|
@ -20,7 +20,8 @@ from WebSocketClient import WebSocketThread
|
|||
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)
|
||||
|
@ -79,6 +80,11 @@ class Service():
|
|||
else:
|
||||
# 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):
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue