mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
closes #51
This commit is contained in:
parent
a439863c05
commit
23b70af3dc
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="script.xbmcbackup"
|
<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>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.14.0"/>
|
<import addon="xbmc.python" version="2.14.0"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
Version 0.5.4
|
||||||
|
|
||||||
|
check xbmc version when doing a restore
|
||||||
|
|
||||||
Version 0.5.3
|
Version 0.5.3
|
||||||
|
|
||||||
updated python version
|
updated python version
|
||||||
|
@ -76,4 +76,6 @@
|
|||||||
<string id="30082">Progress Bar</string>
|
<string id="30082">Progress Bar</string>
|
||||||
<string id="30083">Background Progress Bar</string>
|
<string id="30083">Background Progress Bar</string>
|
||||||
<string id="30084">None (Silent)</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>
|
</strings>
|
||||||
|
@ -4,6 +4,7 @@ import xbmcvfs
|
|||||||
import utils as utils
|
import utils as utils
|
||||||
import os.path
|
import os.path
|
||||||
import time
|
import time
|
||||||
|
import json
|
||||||
from vfs import XBMCFileSystem,DropboxFileSystem
|
from vfs import XBMCFileSystem,DropboxFileSystem
|
||||||
|
|
||||||
def folderSort(aKey):
|
def folderSort(aKey):
|
||||||
@ -218,6 +219,10 @@ class XbmcBackup:
|
|||||||
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path)
|
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045),self.remote_vfs.root_path)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if(not self._checkValidationFile(self.remote_vfs.root_path)):
|
||||||
|
#don't continue
|
||||||
|
return
|
||||||
|
|
||||||
utils.log(utils.getString(30051))
|
utils.log(utils.getString(30051))
|
||||||
allFiles = []
|
allFiles = []
|
||||||
fileManager = FileManager(self.remote_vfs)
|
fileManager = FileManager(self.remote_vfs)
|
||||||
@ -382,11 +387,36 @@ class XbmcBackup:
|
|||||||
|
|
||||||
def _createValidationFile(self):
|
def _createValidationFile(self):
|
||||||
vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),'w')
|
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()
|
vFile.close()
|
||||||
|
|
||||||
self.remote_vfs.put(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),self.remote_vfs.root_path + "xbmcbackup.val")
|
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):
|
def _createResumeBackupFile(self):
|
||||||
rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"),'w')
|
rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"),'w')
|
||||||
rFile.write(self.restore_point)
|
rFile.write(self.restore_point)
|
||||||
|
Loading…
Reference in New Issue
Block a user