mirror of
https://github.com/robweber/xbmcbackup.git
synced 2025-06-23 11:04:31 +02:00
created utils library to avoid duplicate functions
pulled XbmcBackup class into separate library
This commit is contained in:
21
resources/lib/utils.py
Normal file
21
resources/lib/utils.py
Normal file
@ -0,0 +1,21 @@
|
||||
import xbmc
|
||||
import xbmcaddon
|
||||
|
||||
__addon_id__= 'script.xbmcbackup'
|
||||
__Addon = xbmcaddon.Addon(__addon_id__)
|
||||
|
||||
#global functions for logging and encoding
|
||||
def log(message,loglevel=xbmc.LOGNOTICE):
|
||||
xbmc.log(encode(__addon_id__ + ": " + message),level=loglevel)
|
||||
|
||||
def getSetting(name):
|
||||
return __Addon.getSetting(name)
|
||||
|
||||
def setSetting(name,value):
|
||||
__Addon.setSetting(name,value)
|
||||
|
||||
def getString(string_id):
|
||||
return __Addon.getLocalizedString(string_id)
|
||||
|
||||
def encode(string):
|
||||
return string.encode('UTF-8','replace')
|
Reference in New Issue
Block a user