mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-26 10:46:11 +00:00
Added some logging
This commit is contained in:
parent
2014e93c33
commit
1cd7663410
2 changed files with 24 additions and 25 deletions
|
@ -12,6 +12,7 @@ import hashlib
|
||||||
import json as json
|
import json as json
|
||||||
|
|
||||||
import KodiMonitor
|
import KodiMonitor
|
||||||
|
import Utils as utils
|
||||||
from ClientInformation import ClientInformation
|
from ClientInformation import ClientInformation
|
||||||
from DownloadUtils import DownloadUtils
|
from DownloadUtils import DownloadUtils
|
||||||
|
|
||||||
|
@ -21,6 +22,8 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
clientInfo = ClientInformation()
|
clientInfo = ClientInformation()
|
||||||
doUtils = DownloadUtils()
|
doUtils = DownloadUtils()
|
||||||
|
addonName = clientInfo.getAddonName()
|
||||||
|
className = None
|
||||||
|
|
||||||
stopClient = False
|
stopClient = False
|
||||||
logLevel = 0
|
logLevel = 0
|
||||||
|
@ -37,33 +40,17 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
|
||||||
clientInfo = self.clientInfo
|
|
||||||
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
||||||
|
|
||||||
self.addonId = clientInfo.getAddonId()
|
self.addonId = self.clientInfo.getAddonId()
|
||||||
self.addonName = clientInfo.getAddonName()
|
|
||||||
self.addon = xbmcaddon.Addon(id=self.addonId)
|
self.addon = xbmcaddon.Addon(id=self.addonId)
|
||||||
|
self.className = self.__class__.__name__
|
||||||
|
|
||||||
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, lvl=1):
|
||||||
|
|
||||||
addonName = self.addonName
|
utils.logMsg("%s %s" % (self.addonName, self.className), str(msg), int(lvl))
|
||||||
className = self.__class__.__name__
|
|
||||||
|
|
||||||
if (self.logLevel != self.getLogLevel()):
|
|
||||||
xbmc.log("Adjusting logLevel to %i" % self.getLogLevel())
|
|
||||||
self.logLevel = self.getLogLevel()
|
|
||||||
|
|
||||||
if (self.logLevel >= level):
|
|
||||||
try:
|
|
||||||
xbmc.log("%s %s -> %s" % (addonName, className, str(msg)))
|
|
||||||
except UnicodeEncodeError:
|
|
||||||
try:
|
|
||||||
xbmc.log("%s %s -> %s" % (addonName, className, str(msg.encode('utf-8'))))
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
def getUsername(self):
|
def getUsername(self):
|
||||||
|
|
||||||
|
@ -291,6 +278,8 @@ 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
|
||||||
|
@ -310,7 +299,6 @@ class UserClient(threading.Thread):
|
||||||
self.auth = False
|
self.auth = False
|
||||||
self.authenticate()
|
self.authenticate()
|
||||||
|
|
||||||
|
|
||||||
if (self.auth == False) and (self.currUser == None):
|
if (self.auth == False) and (self.currUser == None):
|
||||||
# Only if there's information found to login
|
# Only if there's information found to login
|
||||||
server = self.getServer()
|
server = self.getServer()
|
||||||
|
|
15
service.py
15
service.py
|
@ -21,20 +21,31 @@ from WebSocketClient import WebSocketThread
|
||||||
from UserClient import UserClient
|
from UserClient import UserClient
|
||||||
librarySync = LibrarySync()
|
librarySync = LibrarySync()
|
||||||
|
|
||||||
|
|
||||||
class Service():
|
class Service():
|
||||||
|
|
||||||
|
|
||||||
newWebSocketThread = None
|
newWebSocketThread = None
|
||||||
newUserClient = None
|
newUserClient = None
|
||||||
|
|
||||||
clientInfo = ClientInformation()
|
clientInfo = ClientInformation()
|
||||||
|
addonName = clientInfo.getAddonName()
|
||||||
|
className = None
|
||||||
|
|
||||||
def __init__(self, *args ):
|
def __init__(self, *args ):
|
||||||
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
self.KodiMonitor = KodiMonitor.Kodi_Monitor()
|
||||||
|
addonName = self.addonName
|
||||||
|
self.className = self.__class__.__name__
|
||||||
|
|
||||||
utils.logMsg("MB3 Sync Service", "starting Monitor",0)
|
self.logMsg("Starting Monitor", 0)
|
||||||
xbmc.log("======== START %s ========" % self.clientInfo.getAddonName())
|
self.logMsg("======== START %s ========" % addonName, 0)
|
||||||
|
self.logMsg("KODI Version: %s" % xbmc.getInfoLabel("System.BuildVersion"), 0)
|
||||||
|
self.logMsg("%s Version: %s" % (addonName, self.clientInfo.getVersion()), 0)
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def logMsg(self, msg, lvl=1):
|
||||||
|
|
||||||
|
utils.logMsg("%s %s" % (self.addonName, self.className), str(msg), int(lvl))
|
||||||
|
|
||||||
def ServiceEntryPoint(self):
|
def ServiceEntryPoint(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue