2012-11-28 15:54:23 +01:00
|
|
|
import xbmcgui
|
|
|
|
import resources.lib.utils as utils
|
2012-09-05 21:28:43 +02:00
|
|
|
from resources.lib.backup import XbmcBackup
|
2012-08-17 21:18:08 +02:00
|
|
|
|
2013-01-04 17:29:00 +01:00
|
|
|
#the program mode
|
|
|
|
mode = -1
|
|
|
|
|
|
|
|
#check if mode was passed in as an argument
|
|
|
|
if(len(sys.argv) > 1):
|
|
|
|
if(sys.argv[1].lower() == 'backup'):
|
|
|
|
mode = 0
|
|
|
|
elif(sys.argv[1].lower() == 'restore'):
|
|
|
|
mode = 1
|
|
|
|
|
|
|
|
if(mode == -1):
|
|
|
|
#figure out if this is a backup or a restore from the user
|
|
|
|
mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),[utils.getString(30016),utils.getString(30017)])
|
2012-04-19 23:13:50 +02:00
|
|
|
|
2012-11-28 15:54:23 +01:00
|
|
|
if(mode != -1):
|
|
|
|
#run the profile backup
|
|
|
|
backup = XbmcBackup()
|
2012-11-28 17:19:03 +01:00
|
|
|
|
|
|
|
if(mode == backup.Restore):
|
|
|
|
#allow user to select the backup to restore from
|
|
|
|
restorePoints = backup.listBackups()
|
|
|
|
|
|
|
|
selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),restorePoints)
|
|
|
|
|
|
|
|
if(selectedRestore != -1):
|
|
|
|
backup.selectRestore(restorePoints[selectedRestore])
|
|
|
|
|
2012-11-28 16:57:34 +01:00
|
|
|
backup.run(mode)
|