Set up for central addon settings

Please start using it for new methods. I will take care of changing
older ones.
This commit is contained in:
angelblue05 2015-08-12 04:59:05 -05:00
parent 05be6eaa07
commit 40b381de94

View file

@ -21,8 +21,8 @@ from API import API
from PlayUtils import PlayUtils from PlayUtils import PlayUtils
from DownloadUtils import DownloadUtils from DownloadUtils import DownloadUtils
downloadUtils = DownloadUtils() downloadUtils = DownloadUtils()
addonSettings = xbmcaddon.Addon() addon = xbmcaddon.Addon()
language = addonSettings.getLocalizedString language = addon.getLocalizedString
def logMsg(title, msg, level = 1): def logMsg(title, msg, level = 1):
@ -184,10 +184,13 @@ def createSources():
'</sources>' '</sources>'
) )
def CleanName(filename): def settings(setting, value=""):
validFilenameChars = "-_.() %s%s" % (string.ascii_letters, string.digits) # Get or add addon setting
cleanedFilename = unicodedata.normalize('NFKD', filename).encode('ASCII', 'ignore') addon = xbmcaddon.Addon()
return ''.join(c for c in cleanedFilename if c in validFilenameChars) if value:
addon.setSetting(setting, value)
else:
return addon.getSetting(setting)
def normalize_string(text): def normalize_string(text):
# For theme media, do not modify unless # For theme media, do not modify unless
@ -280,7 +283,7 @@ def reset():
connection.commit() connection.commit()
cursor.close() cursor.close()
if addonSettings.getSetting("enableMusicSync") == "true": if addon.getSetting("enableMusicSync") == "true":
# delete video db table data # delete video db table data
print "Doing Music DB Reset" print "Doing Music DB Reset"
connection = KodiSQL("music") connection = KodiSQL("music")