mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-27 03:06:10 +00:00
Log Level instant change
I grew tired of restarting Kodi everytime....so I made it so the log level changes on the stop without restarting Kodi. Also removed NextUp import and added the downloadUtils 200 response to help debug in the future.
This commit is contained in:
parent
5f7f08079c
commit
20ac3c9465
6 changed files with 23 additions and 9 deletions
|
@ -258,6 +258,7 @@ class DownloadUtils():
|
||||||
# UTF-8 - JSON object
|
# UTF-8 - JSON object
|
||||||
r = r.json()
|
r = r.json()
|
||||||
self.logMsg("====== 200 Success ======", 2)
|
self.logMsg("====== 200 Success ======", 2)
|
||||||
|
self.logMsg("Response: %s" % r, 2)
|
||||||
return r
|
return r
|
||||||
except:
|
except:
|
||||||
if r.headers['content-type'] == "text/html":
|
if r.headers['content-type'] == "text/html":
|
||||||
|
|
|
@ -18,7 +18,7 @@ from LibrarySync import LibrarySync
|
||||||
from PlaybackUtils import PlaybackUtils
|
from PlaybackUtils import PlaybackUtils
|
||||||
from ReadEmbyDB import ReadEmbyDB
|
from ReadEmbyDB import ReadEmbyDB
|
||||||
from API import API
|
from API import API
|
||||||
from NextUpInfo import NextUpInfo
|
|
||||||
librarySync = LibrarySync()
|
librarySync = LibrarySync()
|
||||||
|
|
||||||
# service class for playback monitoring
|
# service class for playback monitoring
|
||||||
|
|
|
@ -32,7 +32,7 @@ class UserClient(threading.Thread):
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
|
||||||
stopClient = False
|
stopClient = False
|
||||||
logLevel = 0
|
logLevel = int(addon.getSetting('logLevel'))
|
||||||
auth = True
|
auth = True
|
||||||
retry = 0
|
retry = 0
|
||||||
|
|
||||||
|
@ -359,6 +359,13 @@ class UserClient(threading.Thread):
|
||||||
|
|
||||||
# Get the latest addon settings
|
# Get the latest addon settings
|
||||||
self.addon = xbmcaddon.Addon(id=self.addonId)
|
self.addon = xbmcaddon.Addon(id=self.addonId)
|
||||||
|
# Verify the log level
|
||||||
|
currLogLevel = self.getLogLevel()
|
||||||
|
if self.logLevel != currLogLevel:
|
||||||
|
# Set new log level
|
||||||
|
self.logLevel = currLogLevel
|
||||||
|
self.logMsg("New Log Level: %s" % currLogLevel, 0)
|
||||||
|
self.WINDOW.setProperty('getLogLevel', str(currLogLevel))
|
||||||
|
|
||||||
if (self.WINDOW.getProperty("Server_status") != ""):
|
if (self.WINDOW.getProperty("Server_status") != ""):
|
||||||
status = self.WINDOW.getProperty("Server_status")
|
status = self.WINDOW.getProperty("Server_status")
|
||||||
|
|
|
@ -26,9 +26,11 @@ language = addonSettings.getLocalizedString
|
||||||
|
|
||||||
|
|
||||||
def logMsg(title, msg, level = 1):
|
def logMsg(title, msg, level = 1):
|
||||||
logLevel = int(addonSettings.getSetting("logLevel"))
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
WINDOW.setProperty('logLevel', str(logLevel))
|
# Get the logLevel set in UserClient
|
||||||
|
logLevel = int(WINDOW.getProperty('getLogLevel'))
|
||||||
|
|
||||||
if(logLevel >= level):
|
if(logLevel >= level):
|
||||||
if(logLevel == 2): # inspect.stack() is expensive
|
if(logLevel == 2): # inspect.stack() is expensive
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -322,14 +322,14 @@ class WebSocketThread(threading.Thread):
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
logLevel = int(WINDOW.getProperty('logLevel'))
|
logLevel = int(WINDOW.getProperty('getLogLevel'))
|
||||||
username = WINDOW.getProperty('currUser')
|
username = WINDOW.getProperty('currUser')
|
||||||
server = WINDOW.getProperty('server%s' % username)
|
server = WINDOW.getProperty('server%s' % username)
|
||||||
token = WINDOW.getProperty('accessToken%s' % username)
|
token = WINDOW.getProperty('accessToken%s' % username)
|
||||||
deviceId = ClientInformation().getMachineId()
|
deviceId = ClientInformation().getMachineId()
|
||||||
|
|
||||||
if (logLevel == 2):
|
'''if (logLevel == 2):
|
||||||
websocket.enableTrace(True)
|
websocket.enableTrace(True) '''
|
||||||
|
|
||||||
# Get the appropriate prefix for websocket
|
# Get the appropriate prefix for websocket
|
||||||
if "https" in server:
|
if "https" in server:
|
||||||
|
|
|
@ -34,6 +34,7 @@ class Service():
|
||||||
KodiMonitor = KodiMonitor.Kodi_Monitor()
|
KodiMonitor = KodiMonitor.Kodi_Monitor()
|
||||||
addonName = clientInfo.getAddonName()
|
addonName = clientInfo.getAddonName()
|
||||||
WINDOW = xbmcgui.Window(10000)
|
WINDOW = xbmcgui.Window(10000)
|
||||||
|
logLevel = UserClient().getLogLevel()
|
||||||
|
|
||||||
warn_auth = True
|
warn_auth = True
|
||||||
welcome_msg = True
|
welcome_msg = True
|
||||||
|
@ -41,22 +42,25 @@ class Service():
|
||||||
|
|
||||||
def __init__(self, *args ):
|
def __init__(self, *args ):
|
||||||
addonName = self.addonName
|
addonName = self.addonName
|
||||||
|
WINDOW = self.WINDOW
|
||||||
|
WINDOW.setProperty('getLogLevel', str(self.logLevel))
|
||||||
|
|
||||||
self.logMsg("Starting Monitor", 0)
|
self.logMsg("Starting Monitor", 0)
|
||||||
self.logMsg("======== START %s ========" % addonName, 0)
|
self.logMsg("======== START %s ========" % addonName, 0)
|
||||||
self.logMsg("KODI Version: %s" % xbmc.getInfoLabel("System.BuildVersion"), 0)
|
self.logMsg("KODI Version: %s" % xbmc.getInfoLabel("System.BuildVersion"), 0)
|
||||||
self.logMsg("%s Version: %s" % (addonName, self.clientInfo.getVersion()), 0)
|
self.logMsg("%s Version: %s" % (addonName, self.clientInfo.getVersion()), 0)
|
||||||
self.logMsg("Platform: %s" % (self.clientInfo.getPlatform()), 0)
|
self.logMsg("Platform: %s" % (self.clientInfo.getPlatform()), 0)
|
||||||
|
self.logMsg("Log Level: %s" % self.logLevel, 0)
|
||||||
|
|
||||||
#reset all window props on startup for user profile switches
|
#reset all window props on startup for user profile switches
|
||||||
self.WINDOW.clearProperty("startup")
|
self.WINDOW.clearProperty("startup")
|
||||||
embyProperty = self.WINDOW.getProperty("Emby.nodes.total")
|
embyProperty = WINDOW.getProperty("Emby.nodes.total")
|
||||||
propNames = ["index","path","title","content","inprogress.content","inprogress.title","inprogress.content","inprogress.path","nextepisodes.title","nextepisodes.content","nextepisodes.path","unwatched.title","unwatched.content","unwatched.path","recent.title","recent.content","recent.path","recentepisodes.title","recentepisodes.content","recentepisodes.path","inprogressepisodes.title","inprogressepisodes.content","inprogressepisodes.path"]
|
propNames = ["index","path","title","content","inprogress.content","inprogress.title","inprogress.content","inprogress.path","nextepisodes.title","nextepisodes.content","nextepisodes.path","unwatched.title","unwatched.content","unwatched.path","recent.title","recent.content","recent.path","recentepisodes.title","recentepisodes.content","recentepisodes.path","inprogressepisodes.title","inprogressepisodes.content","inprogressepisodes.path"]
|
||||||
if embyProperty:
|
if embyProperty:
|
||||||
totalNodes = int(embyProperty)
|
totalNodes = int(embyProperty)
|
||||||
for i in range(totalNodes):
|
for i in range(totalNodes):
|
||||||
for prop in propNames:
|
for prop in propNames:
|
||||||
self.WINDOW.clearProperty("Emby.nodes.%s.%s" %(str(i),prop))
|
WINDOW.clearProperty("Emby.nodes.%s.%s" %(str(i),prop))
|
||||||
|
|
||||||
|
|
||||||
def logMsg(self, msg, lvl=1):
|
def logMsg(self, msg, lvl=1):
|
||||||
|
|
Loading…
Reference in a new issue