mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-07-20 13:28:59 +00:00
acumulate change values with |= and dont set art if it is ""
This commit is contained in:
parent
5b65e1cfda
commit
c38ecfa462
4 changed files with 83 additions and 45 deletions
|
@ -8,7 +8,9 @@ import xbmcaddon
|
|||
import xbmcvfs
|
||||
import json
|
||||
import os
|
||||
|
||||
import cProfile
|
||||
import pstats
|
||||
import time
|
||||
import sqlite3
|
||||
import inspect
|
||||
from xml.etree.ElementTree import Element, SubElement, Comment, tostring
|
||||
|
@ -24,11 +26,9 @@ addonSettings = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
|||
language = addonSettings.getLocalizedString
|
||||
|
||||
def logMsg(title, msg, level = 1):
|
||||
|
||||
logLevel = int(addonSettings.getSetting("logLevel"))
|
||||
|
||||
if(logLevel >= level):
|
||||
if(logLevel == 1):
|
||||
if(logLevel == 2): # inspect.stack() is expensive
|
||||
try:
|
||||
xbmc.log(title + " -> " + inspect.stack()[1][3] + " : " + str(msg))
|
||||
except UnicodeEncodeError:
|
||||
|
@ -195,5 +195,35 @@ def get_params( paramstring ):
|
|||
param[splitparams[0]]=splitparams[1]+"="+splitparams[2]
|
||||
return param
|
||||
|
||||
def startProfiling():
|
||||
pr = cProfile.Profile()
|
||||
pr.enable()
|
||||
return pr
|
||||
|
||||
def stopProfiling(pr, profileName):
|
||||
pr.disable()
|
||||
ps = pstats.Stats(pr)
|
||||
|
||||
addondir = xbmc.translatePath(xbmcaddon.Addon(id='plugin.video.mb3sync').getAddonInfo('profile'))
|
||||
|
||||
fileTimeStamp = time.strftime("%Y-%m-%d %H-%M-%S")
|
||||
tabFileNamepath = os.path.join(addondir, "profiles")
|
||||
tabFileName = os.path.join(addondir, "profiles" , profileName + "_profile_(" + fileTimeStamp + ").tab")
|
||||
|
||||
if not xbmcvfs.exists(tabFileNamepath):
|
||||
xbmcvfs.mkdir(tabFileNamepath)
|
||||
|
||||
f = open(tabFileName, 'wb')
|
||||
f.write("NumbCalls\tTotalTime\tCumulativeTime\tFunctionName\tFileName\r\n")
|
||||
for (key, value) in ps.stats.items():
|
||||
(filename, count, func_name) = key
|
||||
(ccalls, ncalls, total_time, cumulative_time, callers) = value
|
||||
try:
|
||||
f.write(str(ncalls) + "\t" + "{:10.4f}".format(total_time) + "\t" + "{:10.4f}".format(cumulative_time) + "\t" + func_name + "\t" + filename + "\r\n")
|
||||
except ValueError:
|
||||
f.write(str(ncalls) + "\t" + "{0}".format(total_time) + "\t" + "{0}".format(cumulative_time) + "\t" + func_name + "\t" + filename + "\r\n")
|
||||
f.close()
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue