mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
Merge branch 'master' into gotham-dev
Conflicts: addon.xml changelog.txt
This commit is contained in:
commit
2bec306892
@ -6,6 +6,10 @@ Version 0.5.0
|
||||
|
||||
New Version for Gotham
|
||||
|
||||
Version 0.4.6
|
||||
|
||||
modified backup folder names to include time, also modified display listing
|
||||
|
||||
Version 0.4.5
|
||||
|
||||
added version info to logs
|
||||
|
@ -25,11 +25,15 @@ if(mode != -1):
|
||||
if(mode == backup.Restore):
|
||||
#allow user to select the backup to restore from
|
||||
restorePoints = backup.listBackups()
|
||||
pointNames = []
|
||||
|
||||
selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints)
|
||||
for aDir in restorePoints:
|
||||
pointNames.append(aDir[1])
|
||||
|
||||
selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),pointNames)
|
||||
|
||||
if(selectedRestore != -1):
|
||||
backup.selectRestore(restorePoints[selectedRestore])
|
||||
backup.selectRestore(restorePoints[selectedRestore][0])
|
||||
|
||||
backup.run(mode)
|
||||
else:
|
||||
|
@ -6,6 +6,15 @@ import os.path
|
||||
import time
|
||||
from vfs import XBMCFileSystem,DropboxFileSystem
|
||||
|
||||
def folderSort(aKey):
|
||||
result = aKey[0]
|
||||
|
||||
if(len(result) < 8):
|
||||
result = result + "0000"
|
||||
|
||||
return result
|
||||
|
||||
|
||||
class XbmcBackup:
|
||||
#constants for initiating a back or restore
|
||||
Backup = 0
|
||||
@ -60,7 +69,17 @@ class XbmcBackup:
|
||||
|
||||
for aDir in dirs:
|
||||
if(self.remote_vfs.exists(self.remote_base_path + aDir + "/xbmcbackup.val")):
|
||||
result.append(aDir)
|
||||
|
||||
#folder may or may not contain time, older versions didn't include this
|
||||
folderName = ''
|
||||
if(len(aDir) > 8):
|
||||
folderName = aDir[6:8] + '-' + aDir[4:6] + '-' + aDir[0:4] + " " + aDir[8:10] + ":" + aDir[10:12]
|
||||
else:
|
||||
folderName = aDir[6:8] + '-' + aDir[4:6] + '-' + aDir[0:4]
|
||||
|
||||
result.append((aDir,folderName))
|
||||
|
||||
result.sort(key=folderSort)
|
||||
|
||||
return result
|
||||
|
||||
@ -74,7 +93,7 @@ class XbmcBackup:
|
||||
#append backup folder name
|
||||
progressBarTitle = utils.getString(30010) + " - "
|
||||
if(mode == self.Backup and self.remote_vfs.root_path != ''):
|
||||
self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d") + "/")
|
||||
self.remote_vfs.set_root(self.remote_vfs.root_path + time.strftime("%Y%m%d%H%M") + "/")
|
||||
progressBarTitle = progressBarTitle + utils.getString(30016)
|
||||
elif(mode == self.Restore and self.restore_point != None and self.remote_vfs.root_path != ''):
|
||||
self.remote_vfs.set_root(self.remote_vfs.root_path + self.restore_point + "/")
|
||||
@ -360,16 +379,15 @@ class XbmcBackup:
|
||||
|
||||
if(len(dirs) > total_backups):
|
||||
#remove backups to equal total wanted
|
||||
dirs.sort()
|
||||
remove_num = len(dirs) - total_backups - 1
|
||||
remove_num = 0
|
||||
self.filesTotal = self.filesTotal + remove_num + 1
|
||||
|
||||
#update the progress bar if it is available
|
||||
while(remove_num >= 0 and not self._checkCancel()):
|
||||
self._updateProgress(utils.getString(30054) + " " + dirs[remove_num])
|
||||
utils.log("Removing backup " + dirs[remove_num])
|
||||
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num] + "/")
|
||||
remove_num = remove_num - 1
|
||||
while(remove_num < total_backups and not self._checkCancel()):
|
||||
self._updateProgress(utils.getString(30054) + " " + dirs[remove_num][1])
|
||||
utils.log("Removing backup " + dirs[remove_num][0])
|
||||
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/")
|
||||
remove_num = remove_num + 1
|
||||
|
||||
def _createValidationFile(self):
|
||||
vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "xbmcbackup.val"),'w')
|
||||
|
Loading…
Reference in New Issue
Block a user