mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
865416977d
* updated addon.xml for Krypton * default log level is always debug now * added screenshots per krypton format * started new way of defining backup directories * reconfigured simple backup process * added an advanced backup editor and combined settings.xml scripts into a launcher * added strings for advanced editor * there was a function to do this * match excluded with regex * updated def for the addons set * directory has to end in slash to use exists() * added a backup set chooser on restore * added string for restore browser * utilize details to show root folder and icons * save non translated paths, better cross platform support * revert dropbox python 2.6 changes * start of #132 * can't have duplicate ids * updated strings * closes #132 * added a disclaimer for breaking changes * split backup and restore into separate functions * updated scripting to pass in list of sets to restore * beta version * added 2 min delay in startup - part of #147 * forgot to remove debug message * change to wait for abort in case someone tries to close Kodi * add retroplayer game saves to default file list * display restore points with most recent on top * remove length check, breaking change with this version means old archives are no longer compatible * format restore list according to regional settings * this function isn't used anymore, legacy of old file manager * use images folder as default * added note about compatibility * added utils function for regional date, use for scheduler notifications as well * add/remove include and exclude directories to a set * paths should have / at the end * show path relative to root * if in advanced mode allow jumping to editor from launch screen * check that path is within root folder of set * cannot have duplicate set names or rules regarding folders within a set * put strings in correct lang file * beta version bump * accidentally deleted string id * change exclude criteria. Regex was not matching in complex cases * make sure the dest folder (backup set root) exists before writing to it * modify select display to show recursive value for included folders * use a context menu here * added ability to toggle recursion of sub folders * beta 3 * added support doc * wrong branch * don't need this import anymore * don't need these imports * part of #133
92 lines
3.1 KiB
Python
92 lines
3.1 KiB
Python
import sys, urlparse
|
|
import xbmc, xbmcgui
|
|
import resources.lib.utils as utils
|
|
from resources.lib.backup import XbmcBackup
|
|
|
|
def get_params():
|
|
param = {}
|
|
|
|
if(len(sys.argv) > 1):
|
|
for i in sys.argv:
|
|
args = i
|
|
if(args.startswith('?')):
|
|
args = args[1:]
|
|
param.update(dict(urlparse.parse_qsl(args)))
|
|
|
|
return param
|
|
|
|
#the program mode
|
|
mode = -1
|
|
params = get_params()
|
|
|
|
|
|
if("mode" in params):
|
|
if(params['mode'] == 'backup'):
|
|
mode = 0
|
|
elif(params['mode'] == 'restore'):
|
|
mode = 1
|
|
|
|
#if mode wasn't passed in as arg, get from user
|
|
if(mode == -1):
|
|
#by default, Backup,Restore,Open Settings
|
|
options = [utils.getString(30016),utils.getString(30017),utils.getString(30099)]
|
|
|
|
#find out if we're using the advanced editor
|
|
if(int(utils.getSetting('backup_selection_type')) == 1):
|
|
options.append(utils.getString(30125))
|
|
|
|
#figure out if this is a backup or a restore from the user
|
|
mode = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30023),options)
|
|
|
|
#check if program should be run
|
|
if(mode != -1):
|
|
#run the profile backup
|
|
backup = XbmcBackup()
|
|
|
|
if(mode == 2):
|
|
#open the settings dialog
|
|
utils.openSettings()
|
|
elif(mode == 3 and int(utils.getSetting('backup_selection_type')) == 1):
|
|
#open the advanced editor
|
|
xbmc.executebuiltin('RunScript(special://home/addons/script.xbmcbackup/launcher.py,action=advanced_editor)')
|
|
elif(backup.remoteConfigured()):
|
|
|
|
if(mode == backup.Restore):
|
|
#get list of valid restore points
|
|
restorePoints = backup.listBackups()
|
|
pointNames = []
|
|
folderNames = []
|
|
|
|
for aDir in restorePoints:
|
|
pointNames.append(aDir[1])
|
|
folderNames.append(aDir[0])
|
|
|
|
selectedRestore = -1
|
|
|
|
if("archive" in params):
|
|
#check that the user give archive exists
|
|
if(params['archive'] in folderNames):
|
|
#set the index
|
|
selectedRestore = folderNames.index(params['archive'])
|
|
utils.log(str(selectedRestore) + " : " + params['archive'])
|
|
else:
|
|
utils.showNotification(utils.getString(30045))
|
|
utils.log(params['archive'] + ' is not a valid restore point')
|
|
else:
|
|
#allow user to select the backup to restore from
|
|
selectedRestore = xbmcgui.Dialog().select(utils.getString(30010) + " - " + utils.getString(30021),pointNames)
|
|
|
|
if(selectedRestore != -1):
|
|
backup.selectRestore(restorePoints[selectedRestore][0])
|
|
|
|
if('sets' in params):
|
|
backup.restore(selectedSets=params['sets'].split('|'))
|
|
else:
|
|
backup.restore()
|
|
else:
|
|
backup.backup()
|
|
else:
|
|
#can't go any further
|
|
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30045))
|
|
utils.openSettings()
|