Merge branch 'master' into gotham-dev

Conflicts:
	addon.xml
	changelog.txt
This commit is contained in:
Rob Weber 2014-02-09 14:09:57 -06:00
commit 2bec306892
3 changed files with 37 additions and 11 deletions

View File

@ -6,6 +6,10 @@ Version 0.5.0
New Version for Gotham New Version for Gotham
Version 0.4.6
modified backup folder names to include time, also modified display listing
Version 0.4.5 Version 0.4.5
added version info to logs added version info to logs

View File

@ -25,11 +25,15 @@ if(mode != -1):
if(mode == backup.Restore): if(mode == backup.Restore):
#allow user to select the backup to restore from #allow user to select the backup to restore from
restorePoints = backup.listBackups() 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): if(selectedRestore != -1):
backup.selectRestore(restorePoints[selectedRestore]) backup.selectRestore(restorePoints[selectedRestore][0])
backup.run(mode) backup.run(mode)
else: else:

View File

@ -6,6 +6,15 @@ import os.path
import time import time
from vfs import XBMCFileSystem,DropboxFileSystem from vfs import XBMCFileSystem,DropboxFileSystem
def folderSort(aKey):
result = aKey[0]
if(len(result) < 8):
result = result + "0000"
return result
class XbmcBackup: class XbmcBackup:
#constants for initiating a back or restore #constants for initiating a back or restore
Backup = 0 Backup = 0
@ -60,7 +69,17 @@ class XbmcBackup:
for aDir in dirs: for aDir in dirs:
if(self.remote_vfs.exists(self.remote_base_path + aDir + "/xbmcbackup.val")): 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 return result
@ -74,7 +93,7 @@ class XbmcBackup:
#append backup folder name #append backup folder name
progressBarTitle = utils.getString(30010) + " - " progressBarTitle = utils.getString(30010) + " - "
if(mode == self.Backup and self.remote_vfs.root_path != ''): 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) progressBarTitle = progressBarTitle + utils.getString(30016)
elif(mode == self.Restore and self.restore_point != None and self.remote_vfs.root_path != ''): 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 + "/") self.remote_vfs.set_root(self.remote_vfs.root_path + self.restore_point + "/")
@ -360,16 +379,15 @@ class XbmcBackup:
if(len(dirs) > total_backups): if(len(dirs) > total_backups):
#remove backups to equal total wanted #remove backups to equal total wanted
dirs.sort() remove_num = 0
remove_num = len(dirs) - total_backups - 1
self.filesTotal = self.filesTotal + remove_num + 1 self.filesTotal = self.filesTotal + remove_num + 1
#update the progress bar if it is available #update the progress bar if it is available
while(remove_num >= 0 and not self._checkCancel()): while(remove_num < total_backups and not self._checkCancel()):
self._updateProgress(utils.getString(30054) + " " + dirs[remove_num]) self._updateProgress(utils.getString(30054) + " " + dirs[remove_num][1])
utils.log("Removing backup " + dirs[remove_num]) utils.log("Removing backup " + dirs[remove_num][0])
self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num] + "/") self.remote_vfs.rmdir(self.remote_base_path + dirs[remove_num][0] + "/")
remove_num = remove_num - 1 remove_num = remove_num + 1
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')