mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
changed backup behavior, all backups now create dated folder within backup location
restore operation now prompts for the date of the backup you wish to restore from
This commit is contained in:
parent
26c99723bf
commit
1e5a524ae3
@ -5,15 +5,15 @@ I've had to recover my database, thumbnails, and source configuration enough tim
|
||||
|
||||
Usage:
|
||||
|
||||
In the addon settings you can define a remote path for the destination of your xbmc files. You must also include a backup folder name, all of your files will be in this folder once the backup runs.
|
||||
In the addon settings you can define a remote path for the destination of your xbmc files. Each backup will create a folder named in a month, day, year format so you can create multiple backups.
|
||||
|
||||
On the Backup Selection page you can select which items from your user profile folder will be sent to the backup location. By default all are turned on except the Addon Data directory.
|
||||
|
||||
To restore your data simply switch the Mode from "backup" to "restore" and the files will be copied from your remote directory to the local path. The file selection criteria will be used for the restore as well.
|
||||
To restore your data simply switch the Mode from "backup" to "restore" and type the date of the backup you wish to restore from . The files will be copied from your remote directory to the local path. The file selection criteria will be used for the restore as well.
|
||||
|
||||
What this Addon Will Not Do:
|
||||
|
||||
This is not meant as an XBMC file sync solution. If you have multiple frontends you want to keep in sync this addon may work in a "poor man's" sort of way but it is not intended for that.
|
||||
|
||||
Your remote folder will not be "pruned" of files you have deleted. This behavior may change in the future but right now it is up to you to remove obsolete items from the remote path. The easiest way is to just delete the remote folder before doing a full backup.
|
||||
This backup will not check the backup destination and delete files that do not match. It is best to only do one backup per day so that each folder is correct.
|
||||
|
||||
|
@ -56,3 +56,5 @@ removed need for separate verbose logging setting
|
||||
|
||||
updated utf-8 encoding for all logging
|
||||
|
||||
backup now uses date as folder name, restore allows user to type date of last backup
|
||||
|
||||
|
31
default.py
31
default.py
@ -3,6 +3,7 @@ import xbmcaddon
|
||||
import xbmcgui
|
||||
import resources.lib.vfs as vfs
|
||||
import os
|
||||
import time
|
||||
|
||||
__addon_id__ = 'script.xbmcbackup'
|
||||
__Addon = xbmcaddon.Addon(__addon_id__)
|
||||
@ -102,8 +103,16 @@ class XbmcBackup:
|
||||
self.addon.setSetting("remote_path","")
|
||||
elif(self.addon.getSetting('remote_selection') == '0'):
|
||||
self.remote_path = self.addon.getSetting("remote_path")
|
||||
|
||||
if(self.addon.getSetting("backup_name") != '' and self.remote_path != ''):
|
||||
|
||||
#check if trailing slash is included
|
||||
if(self.remote_path[-1:] != "/"):
|
||||
self.remote_path = self.remote_path + "/"
|
||||
|
||||
#append backup folder name
|
||||
if(int(self.addon.getSetting('addon_mode')) == 0 and self.remote_path != ''):
|
||||
date_today = time.localtime(time.time())
|
||||
self.remote_path = self.remote_path + str(date_today[1]) + str(date_today[2]) + str(date_today[0]) + "/"
|
||||
elif(int(self.addon.getSetting('addon_mode')) == 1 and self.addon.getSetting("backup_name") != '' and self.remote_path != ''):
|
||||
self.remote_path = self.remote_path + self.addon.getSetting("backup_name") + "/"
|
||||
else:
|
||||
self.remote_path = ""
|
||||
@ -121,16 +130,24 @@ class XbmcBackup:
|
||||
#check what mode were are in
|
||||
if(int(self.addon.getSetting('addon_mode')) == 0):
|
||||
self.fileManager = FileManager(self.local_path,self.addon.getAddonInfo('profile'))
|
||||
|
||||
#for backups check if remote path exists
|
||||
if(vfs.exists(self.remote_path)):
|
||||
#this will fail - need a disclaimer here
|
||||
log(self.addon.getLocalizedString(30050))
|
||||
|
||||
self.syncFiles()
|
||||
else:
|
||||
self.fileManager = FileManager(self.remote_path,self.addon.getAddonInfo('profile'))
|
||||
self.restoreFiles()
|
||||
|
||||
#for restores remote path must exist
|
||||
if(vfs.exists(self.remote_path)):
|
||||
self.restoreFiles()
|
||||
else:
|
||||
xbmcgui.Dialog().ok(self.addon.getLocalizedString(30010),self.addon.getLocalizedString(30045))
|
||||
|
||||
def syncFiles(self):
|
||||
if(vfs.exists(self.remote_path)):
|
||||
#this will fail - need a disclaimer here
|
||||
log(self.addon.getLocalizedString(30050))
|
||||
|
||||
|
||||
#make the remote directory
|
||||
vfs.mkdir(self.remote_path)
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
<string id="30034">Thumbnails/Fanart</string>
|
||||
<string id="30035">Config Files</string>
|
||||
|
||||
<string id="30045">Error: Remote path cannot be empty</string>
|
||||
<string id="30045">Error: Remote path doesn't exist</string>
|
||||
<string id="30046">Starting</string>
|
||||
<string id="30047">Local Dir</string>
|
||||
<string id="30048">Remote Dir</string>
|
||||
|
@ -22,7 +22,7 @@
|
||||
<string id="30034">Miniatures / Fanart</string>
|
||||
<string id="30035">Fichiers de configuration</string>
|
||||
|
||||
<string id="30045">Erreur : Le chemin distant ne peut pas être vide.</string>
|
||||
<string id="30045">Erreur : chemin distant n'existe pas</string>
|
||||
<string id="30046">Démarrage</string>
|
||||
<string id="30047">Dossier Local</string>
|
||||
<string id="30048">Dossier Distant</string>
|
||||
|
@ -5,7 +5,7 @@
|
||||
<setting id="remote_selection" type="enum" lvalues="30018|30019" default="0" label="30025"/>
|
||||
<setting id="remote_path_2" type="text" label="30024" default="" visible="eq(-1,1)" />
|
||||
<setting id="remote_path" type="folder" label="30020" visible="eq(-2,0)" />
|
||||
<setting id="backup_name" type="text" label="30021" default="xbmc_backup"/>
|
||||
<setting id="backup_name" type="text" label="30021" default="backup_date" visible="eq(-4,1)"/>
|
||||
<setting id="run_silent" type="bool" label="30022" default="false" />
|
||||
</category>
|
||||
<category id="selection" label="30012">
|
||||
|
Loading…
Reference in New Issue
Block a user