This commit is contained in:
robweberjr@gmail.com 2014-05-06 13:44:00 -05:00
parent a439863c05
commit 23b70af3dc
4 changed files with 38 additions and 2 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmcbackup"
name="XBMC Backup" version="0.5.3" provider-name="robweber">
name="XBMC Backup" version="0.5.4" provider-name="robweber">
<requires>
<import addon="xbmc.python" version="2.14.0"/>
</requires>

View File

@ -1,3 +1,7 @@
Version 0.5.4
check xbmc version when doing a restore
Version 0.5.3
updated python version

View File

@ -76,4 +76,6 @@
<string id="30082">Progress Bar</string>
<string id="30083">Background Progress Bar</string>
<string id="30084">None (Silent)</string>
<string id="30085">Version Warning</string>
<string id="30086">This version of XBMC is different than the one used to create the archive</string>
</strings>

View File

@ -4,6 +4,7 @@ import xbmcvfs
import utils as utils
import os.path
import time
import json
from vfs import XBMCFileSystem,DropboxFileSystem
def folderSort(aKey):
@ -218,6 +219,10 @@ class XbmcBackup:
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path)
return
if(not self._checkValidationFile(self.remote_vfs.root_path)):
#don't continue
return
utils.log(utils.getString(30051))
allFiles = []
fileManager = FileManager(self.remote_vfs)
@ -382,11 +387,36 @@ class XbmcBackup:
def _createValidationFile(self):
vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),'w')
vFile.write("XBMC Backup Validation File")
vFile.write(json.dumps({"name":"XBMC Backup Validation File","xbmc_version":xbmc.getInfoLabel('System.BuildVersion')}))
vFile.write("")
vFile.close()
self.remote_vfs.put(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),self.remote_vfs.root_path + "xbmcbackup.val")
def _checkValidationFile(self,path):
result = False
#copy the file and open it
self.xbmc_vfs.put(path + "xbmcbackup.val",xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"))
vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),'r')
jsonString = vFile.read()
vFile.close()
try:
json_dict = json.loads(jsonString)
if(xbmc.getInfoLabel('System.BuildVersion') == json_dict['xbmc_version']):
result = True
else:
result = xbmcgui.Dialog().yesno(utils.getString(30085),utils.getString(30086),utils.getString(30044))
except ValueError:
#may fail on older archives
result = True
return result
def _createResumeBackupFile(self):
rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"),'w')
rFile.write(self.restore_point)