mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-17 21:56:13 +00:00
Added server online check
This commit is contained in:
parent
6ec92da158
commit
9020c1c908
4 changed files with 193 additions and 129 deletions
|
@ -18,6 +18,7 @@ from DownloadUtils import DownloadUtils
|
|||
from PlaybackUtils import PlaybackUtils
|
||||
from LibrarySync import LibrarySync
|
||||
from WriteKodiDB import WriteKodiDB
|
||||
from UserClient import UserClient
|
||||
import Utils as utils
|
||||
|
||||
pendingUserDataList = []
|
||||
|
@ -30,6 +31,8 @@ class WebSocketThread(threading.Thread):
|
|||
logLevel = 0
|
||||
client = None
|
||||
keepRunning = True
|
||||
|
||||
uc = UserClient()
|
||||
|
||||
def __init__(self, *args):
|
||||
|
||||
|
@ -246,7 +249,7 @@ class WebSocketThread(threading.Thread):
|
|||
LibrarySync().updatePlayCount(itemId)
|
||||
|
||||
def on_error(self, ws, error):
|
||||
self.logMsg("Error : " + str(error))
|
||||
self.logMsg("Error : " + str(error), 2)
|
||||
#raise
|
||||
|
||||
def on_close(self, ws):
|
||||
|
@ -298,7 +301,7 @@ class WebSocketThread(threading.Thread):
|
|||
username = WINDOW.getProperty('currUser')
|
||||
server = WINDOW.getProperty('server%s' % username)
|
||||
host = WINDOW.getProperty('server_%s' % username)
|
||||
|
||||
|
||||
if(self.logLevel >= 1):
|
||||
websocket.enableTrace(True)
|
||||
'''
|
||||
|
@ -323,12 +326,19 @@ class WebSocketThread(threading.Thread):
|
|||
self.client.on_open = self.on_open
|
||||
|
||||
while not self.KodiMonitor.abortRequested():
|
||||
self.logMsg("Client Starting")
|
||||
|
||||
self.client.run_forever()
|
||||
if(self.keepRunning):
|
||||
self.logMsg("Client Needs To Restart")
|
||||
|
||||
if (self.keepRunning):
|
||||
# Server is not online, suppress future warning
|
||||
if WINDOW.getProperty("Server_online") == "true":
|
||||
self.logMsg("Server is unreachable.", 1)
|
||||
WINDOW.setProperty("Server_online", "false")
|
||||
xbmcgui.Dialog().notification("Error connecting", "Server is unreachable.")
|
||||
|
||||
if self.KodiMonitor.waitForAbort(5):
|
||||
break
|
||||
|
||||
self.logMsg("Thread Exited")
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue