From c578fe15d836a09b1734eab5d718544a5d5cf750 Mon Sep 17 00:00:00 2001 From: Rob Weber Date: Mon, 10 Nov 2014 12:33:55 -0600 Subject: [PATCH] create a .restored version of guisettings --- resources/lib/guisettings.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/resources/lib/guisettings.py b/resources/lib/guisettings.py index de50b0e..e68a63a 100644 --- a/resources/lib/guisettings.py +++ b/resources/lib/guisettings.py @@ -6,6 +6,7 @@ import xbmc,xbmcvfs class GuiSettingsManager: + settingsFile = None doc = None settings_allowed = list() found_settings = list() @@ -44,6 +45,9 @@ class GuiSettingsManager: xbmc.executeJSONRPC('{"jsonrpc":"2.0", "id":1, "method":"Settings.SetSettingValue","params":{"setting":"' + aSetting.json_name() + '","value":' + aSetting.value + '}}') else: xbmc.executeJSONRPC('{"jsonrpc":"2.0", "id":1, "method":"Settings.SetSettingValue","params":{"setting":"' + aSetting.json_name() + '","value":"' + aSetting.value + '"}}') + + #make a copy of the guisettings file to make user based restores easier + xbmcvfs.copy(self.settingsFile, xbmc.translatePath("special://home/userdata/guisettings.xml.restored")) def __parseNodes(self,nodeList): result = [] @@ -73,10 +77,9 @@ class GuiSettingsManager: def _readFile(self,fileLoc): if(xbmcvfs.exists(fileLoc)): - try: - self.doc = minidom.parse(fileLoc) + self.settingsFile = fileLoc except ExpatError: utils.log("Can't read " + fileLoc)