mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-27 03:06:10 +00:00
parent
d5c9ae5c91
commit
2014e93c33
2 changed files with 14 additions and 26 deletions
|
@ -44,6 +44,7 @@ class UserClient(threading.Thread):
|
||||||
self.addonName = clientInfo.getAddonName()
|
self.addonName = clientInfo.getAddonName()
|
||||||
self.addon = xbmcaddon.Addon(id=self.addonId)
|
self.addon = xbmcaddon.Addon(id=self.addonId)
|
||||||
|
|
||||||
|
self.logMsg("|---- Starting UserClient ----|", 0)
|
||||||
threading.Thread.__init__(self, *args)
|
threading.Thread.__init__(self, *args)
|
||||||
|
|
||||||
def logMsg(self, msg, level=1):
|
def logMsg(self, msg, level=1):
|
||||||
|
@ -290,8 +291,6 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
self.logMsg("|---- Starting UserClient ----|", 0)
|
|
||||||
|
|
||||||
while not self.KodiMonitor.abortRequested():
|
while not self.KodiMonitor.abortRequested():
|
||||||
|
|
||||||
# Get the latest addon settings
|
# Get the latest addon settings
|
||||||
|
|
31
service.py
31
service.py
|
@ -27,25 +27,14 @@ class Service():
|
||||||
newUserClient = None
|
newUserClient = None
|
||||||
|
|
||||||
clientInfo = ClientInformation()
|
clientInfo = ClientInformation()
|
||||||
addonName = None
|
|
||||||
className = None
|
|
||||||
|
|
||||||
def __init__(self, *args ):
|
def __init__(self, *args ):
|
||||||
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
||||||
self.addonName = self.clientInfo.getAddonName()
|
|
||||||
self.className = self.__class__.__name__
|
|
||||||
|
|
||||||
self.logMsg("Starting Monitor", 0)
|
utils.logMsg("MB3 Sync Service", "starting Monitor",0)
|
||||||
self.logMsg("======== START %s ========" % self.addonName, 0)
|
xbmc.log("======== START %s ========" % self.clientInfo.getAddonName())
|
||||||
self.logMsg("KODI Version: %s" % xbmc.getInfoLabel("System.BuildVersion"), 0)
|
|
||||||
self.logMsg("%s Version: %s" % (self.addonName, self.clientInfo.getVersion()), 0)
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def logMsg(self, msg, lvl=1):
|
|
||||||
addonName = self.addonName
|
|
||||||
className = self.className
|
|
||||||
|
|
||||||
utils.logMsg("%s %s" % (addonName, className), str(msg), int(lvl))
|
|
||||||
|
|
||||||
def ServiceEntryPoint(self):
|
def ServiceEntryPoint(self):
|
||||||
|
|
||||||
|
@ -82,12 +71,12 @@ class Service():
|
||||||
try:
|
try:
|
||||||
player.reportPlayback()
|
player.reportPlayback()
|
||||||
except Exception, msg:
|
except Exception, msg:
|
||||||
self.logMsg("Exception reporting progress: %s" % msg)
|
xbmc.log("MB3 Sync Service -> Exception reporting progress : " + msg)
|
||||||
pass
|
pass
|
||||||
lastProgressUpdate = datetime.today()
|
lastProgressUpdate = datetime.today()
|
||||||
|
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.logMsg("Exception in Playback Monitor Service: %s" % e)
|
xbmc.log("MB3 Sync Service -> Exception in Playback Monitor Service : " + str(e))
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if (self.newUserClient == None):
|
if (self.newUserClient == None):
|
||||||
|
@ -103,9 +92,9 @@ class Service():
|
||||||
|
|
||||||
#full sync
|
#full sync
|
||||||
if(cur_seconds_fullsync >= interval_FullSync):
|
if(cur_seconds_fullsync >= interval_FullSync):
|
||||||
self.logMsg("Doing_Db_Sync: syncDatabase (Started)")
|
xbmc.log("Doing_Db_Sync: syncDatabase (Started)")
|
||||||
worked = librarySync.syncDatabase()
|
worked = librarySync.syncDatabase()
|
||||||
self.logMsg("Doing_Db_Sync: syncDatabase (Finished) %s" % worked)
|
xbmc.log("Doing_Db_Sync: syncDatabase (Finished) " + str(worked))
|
||||||
if(worked):
|
if(worked):
|
||||||
cur_seconds_fullsync = 0
|
cur_seconds_fullsync = 0
|
||||||
else:
|
else:
|
||||||
|
@ -115,9 +104,9 @@ class Service():
|
||||||
|
|
||||||
#incremental sync
|
#incremental sync
|
||||||
if(cur_seconds_incrsync >= interval_IncrementalSync):
|
if(cur_seconds_incrsync >= interval_IncrementalSync):
|
||||||
self.logMsg("Doing_Db_Sync: updatePlayCounts (Started)")
|
xbmc.log("Doing_Db_Sync: updatePlayCounts (Started)")
|
||||||
worked = librarySync.updatePlayCounts()
|
worked = librarySync.updatePlayCounts()
|
||||||
self.logMsg("Doing_Db_Sync: updatePlayCounts (Finished) %s" % worked)
|
xbmc.log("Doing_Db_Sync: updatePlayCounts (Finished) " + str(worked))
|
||||||
if(worked):
|
if(worked):
|
||||||
cur_seconds_incrsync = 0
|
cur_seconds_incrsync = 0
|
||||||
else:
|
else:
|
||||||
|
@ -127,9 +116,9 @@ class Service():
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.logMsg("Not authenticated yet")
|
xbmc.log("Not authenticated yet")
|
||||||
|
|
||||||
self.logMsg("Stopping Service", 0)
|
utils.logMsg("MB3 Sync Service", "stopping Service",0)
|
||||||
|
|
||||||
if (self.newWebSocketThread != None):
|
if (self.newWebSocketThread != None):
|
||||||
ws.stopClient()
|
ws.stopClient()
|
||||||
|
|
Loading…
Reference in a new issue