mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 18:26:15 +00:00
spelling
This commit is contained in:
parent
398bd1644f
commit
30dfe99e37
1 changed files with 20 additions and 20 deletions
|
@ -23,15 +23,15 @@ import xbmcvfs
|
||||||
|
|
||||||
|
|
||||||
def logMsg(title, msg, level=1):
|
def logMsg(title, msg, level=1):
|
||||||
|
|
||||||
# Get the logLevel set in UserClient
|
# Get the logLevel set in UserClient
|
||||||
try:
|
try:
|
||||||
logLevel = int(window('emby_logLevel'))
|
logLevel = int(window('emby_logLevel'))
|
||||||
except ValueError:
|
except ValueError:
|
||||||
logLevel = 0
|
logLevel = 0
|
||||||
|
|
||||||
if logLevel >= level:
|
if logLevel >= level:
|
||||||
|
|
||||||
if logLevel == 2: # inspect.stack() is expensive
|
if logLevel == 2: # inspect.stack() is expensive
|
||||||
try:
|
try:
|
||||||
xbmc.log("%s -> %s : %s" % (title, inspect.stack()[1][3], msg))
|
xbmc.log("%s -> %s : %s" % (title, inspect.stack()[1][3], msg))
|
||||||
|
@ -46,13 +46,13 @@ def logMsg(title, msg, level=1):
|
||||||
def window(property, value=None, clear=False, windowid=10000):
|
def window(property, value=None, clear=False, windowid=10000):
|
||||||
# Get or set window property
|
# Get or set window property
|
||||||
WINDOW = xbmcgui.Window(windowid)
|
WINDOW = xbmcgui.Window(windowid)
|
||||||
|
|
||||||
#setproperty accepts both string and unicode but utf-8 strings are adviced by kodi devs because some unicode can give issues
|
#setproperty accepts both string and unicode but utf-8 strings are adviced by kodi devs because some unicode can give issues
|
||||||
'''if isinstance(property, unicode):
|
'''if isinstance(property, unicode):
|
||||||
property = property.encode("utf-8")
|
property = property.encode("utf-8")
|
||||||
if isinstance(value, unicode):
|
if isinstance(value, unicode):
|
||||||
value = value.encode("utf-8")'''
|
value = value.encode("utf-8")'''
|
||||||
|
|
||||||
if clear:
|
if clear:
|
||||||
WINDOW.clearProperty(property)
|
WINDOW.clearProperty(property)
|
||||||
elif value is not None:
|
elif value is not None:
|
||||||
|
@ -73,7 +73,7 @@ def language(stringid):
|
||||||
return string
|
return string
|
||||||
|
|
||||||
def kodiSQL(media_type="video"):
|
def kodiSQL(media_type="video"):
|
||||||
|
|
||||||
if media_type == "emby":
|
if media_type == "emby":
|
||||||
dbPath = xbmc.translatePath("special://database/emby.db").decode('utf-8')
|
dbPath = xbmc.translatePath("special://database/emby.db").decode('utf-8')
|
||||||
elif media_type == "music":
|
elif media_type == "music":
|
||||||
|
@ -82,7 +82,7 @@ def kodiSQL(media_type="video"):
|
||||||
dbPath = xbmc.translatePath("special://database/Textures13.db").decode('utf-8')
|
dbPath = xbmc.translatePath("special://database/Textures13.db").decode('utf-8')
|
||||||
else:
|
else:
|
||||||
dbPath = getKodiVideoDBPath()
|
dbPath = getKodiVideoDBPath()
|
||||||
|
|
||||||
connection = sqlite3.connect(dbPath)
|
connection = sqlite3.connect(dbPath)
|
||||||
return connection
|
return connection
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ def setScreensaver(value):
|
||||||
'value': value
|
'value': value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logMsg("EMBY", "Toggling screensaver: %s %s" % (value, xbmc.executeJSONRPC(json.dumps(query))), 1)
|
logMsg("EMBY", "Toggling screensaver: %s %s" % (value, xbmc.executeJSONRPC(json.dumps(query))), 1)
|
||||||
|
|
||||||
def reset():
|
def reset():
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ def reset():
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
# Offer to wipe cached thumbnails
|
# Offer to wipe cached thumbnails
|
||||||
resp = dialog.yesno("Warning", "Removed all cached artwork?")
|
resp = dialog.yesno("Warning", "Remove all cached artwork?")
|
||||||
if resp:
|
if resp:
|
||||||
logMsg("EMBY", "Resetting all cached artwork.", 0)
|
logMsg("EMBY", "Resetting all cached artwork.", 0)
|
||||||
# Remove all existing textures first
|
# Remove all existing textures first
|
||||||
|
@ -225,7 +225,7 @@ def reset():
|
||||||
xbmcvfs.delete(os.path.join(path+dir.decode('utf-8'),file.decode('utf-8')))
|
xbmcvfs.delete(os.path.join(path+dir.decode('utf-8'),file.decode('utf-8')))
|
||||||
else:
|
else:
|
||||||
xbmcvfs.delete(os.path.join(path.encode('utf-8')+dir,file))
|
xbmcvfs.delete(os.path.join(path.encode('utf-8')+dir,file))
|
||||||
|
|
||||||
# remove all existing data from texture DB
|
# remove all existing data from texture DB
|
||||||
connection = kodiSQL('texture')
|
connection = kodiSQL('texture')
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
|
@ -237,8 +237,8 @@ def reset():
|
||||||
cursor.execute("DELETE FROM " + tableName)
|
cursor.execute("DELETE FROM " + tableName)
|
||||||
connection.commit()
|
connection.commit()
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
# reset the install run flag
|
# reset the install run flag
|
||||||
settings('SyncInstallRunDone', value="false")
|
settings('SyncInstallRunDone', value="false")
|
||||||
|
|
||||||
# Remove emby info
|
# Remove emby info
|
||||||
|
@ -260,7 +260,7 @@ def profiling(sortby="cumulative"):
|
||||||
# Will print results to Kodi log
|
# Will print results to Kodi log
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
def wrapper(*args, **kwargs):
|
def wrapper(*args, **kwargs):
|
||||||
|
|
||||||
pr = cProfile.Profile()
|
pr = cProfile.Profile()
|
||||||
|
|
||||||
pr.enable()
|
pr.enable()
|
||||||
|
@ -304,7 +304,7 @@ def normalize_nodes(text):
|
||||||
# with dots at the end
|
# with dots at the end
|
||||||
text = text.rstrip('.')
|
text = text.rstrip('.')
|
||||||
text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore')
|
text = unicodedata.normalize('NFKD', unicode(text, 'utf-8')).encode('ascii', 'ignore')
|
||||||
|
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def normalize_string(text):
|
def normalize_string(text):
|
||||||
|
@ -353,7 +353,7 @@ def sourcesXML():
|
||||||
root = etree.Element('sources')
|
root = etree.Element('sources')
|
||||||
else:
|
else:
|
||||||
root = xmlparse.getroot()
|
root = xmlparse.getroot()
|
||||||
|
|
||||||
|
|
||||||
video = root.find('video')
|
video = root.find('video')
|
||||||
if video is None:
|
if video is None:
|
||||||
|
@ -365,7 +365,7 @@ def sourcesXML():
|
||||||
for source in root.findall('.//path'):
|
for source in root.findall('.//path'):
|
||||||
if source.text == "smb://":
|
if source.text == "smb://":
|
||||||
count -= 1
|
count -= 1
|
||||||
|
|
||||||
if count == 0:
|
if count == 0:
|
||||||
# sources already set
|
# sources already set
|
||||||
break
|
break
|
||||||
|
@ -417,7 +417,7 @@ def passwordsXML():
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
logMsg("EMBY", "Failed to find saved server: %s in passwords.xml" % credentials, 1)
|
logMsg("EMBY", "Failed to find saved server: %s in passwords.xml" % credentials, 1)
|
||||||
|
|
||||||
settings('networkCreds', value="")
|
settings('networkCreds', value="")
|
||||||
xbmcgui.Dialog().notification(
|
xbmcgui.Dialog().notification(
|
||||||
heading="Emby for Kodi",
|
heading="Emby for Kodi",
|
||||||
|
@ -469,7 +469,7 @@ def passwordsXML():
|
||||||
# Force Kodi to see the credentials without restarting
|
# Force Kodi to see the credentials without restarting
|
||||||
xbmcvfs.exists(topath)
|
xbmcvfs.exists(topath)
|
||||||
|
|
||||||
# Add credentials
|
# Add credentials
|
||||||
settings('networkCreds', value="%s" % server)
|
settings('networkCreds', value="%s" % server)
|
||||||
logMsg("EMBY", "Added server: %s to passwords.xml" % server, 1)
|
logMsg("EMBY", "Added server: %s to passwords.xml" % server, 1)
|
||||||
# Prettify and write to file
|
# Prettify and write to file
|
||||||
|
@ -477,7 +477,7 @@ def passwordsXML():
|
||||||
indent(root)
|
indent(root)
|
||||||
except: pass
|
except: pass
|
||||||
etree.ElementTree(root).write(xmlpath)
|
etree.ElementTree(root).write(xmlpath)
|
||||||
|
|
||||||
dialog.notification(
|
dialog.notification(
|
||||||
heading="Emby for Kodi",
|
heading="Emby for Kodi",
|
||||||
message="%s added to passwords.xml" % server,
|
message="%s added to passwords.xml" % server,
|
||||||
|
@ -508,7 +508,7 @@ def playlistXSP(mediatype, tagname, viewid, viewtype="", delete=False):
|
||||||
if delete:
|
if delete:
|
||||||
xbmcvfs.delete(xsppath)
|
xbmcvfs.delete(xsppath)
|
||||||
logMsg("EMBY", "Successfully removed playlist: %s." % tagname, 1)
|
logMsg("EMBY", "Successfully removed playlist: %s." % tagname, 1)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
# Using write process since there's no guarantee the xml declaration works with etree
|
# Using write process since there's no guarantee the xml declaration works with etree
|
||||||
|
|
Loading…
Reference in a new issue