Merge pull request #38 from robweber/profiles

added support for userdata/profiles folder
This commit is contained in:
robweber 2013-10-21 07:00:09 -07:00
commit 4962a9c63b
5 changed files with 30 additions and 15 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.xbmcbackup"
name="XBMC Backup" version="0.4.1" provider-name="robweber">
name="XBMC Backup" version="0.4.2" provider-name="robweber">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
</requires>

View File

@ -1,3 +1,7 @@
Version 0.4.2
Added support for userdata/profiles folder - thanks TUSSFC
Version 0.4.1
added encode() around notifications

View File

@ -71,4 +71,5 @@
<string id="30077">Restart XBMC</string>
<string id="30078">You should restart XBMC to continue</string>
<string id="30079">Just Today</string>
<string id="30080">Profiles</string>
</strings>

View File

@ -120,6 +120,10 @@ class XbmcBackup:
self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/playlists")
fileManager.walkTree(xbmc.translatePath('special://home/userdata/playlists'))
if(utils.getSetting('backup_profiles') == 'true'):
self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/profiles")
fileManager.walkTree(xbmc.translatePath('special://home/userdata/profiles'))
if(utils.getSetting("backup_thumbnails") == "true"):
self.remote_vfs.mkdir(self.remote_vfs.root_path + "userdata/Thumbnails")
fileManager.walkTree(xbmc.translatePath('special://home/userdata/Thumbnails'))
@ -238,6 +242,10 @@ class XbmcBackup:
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/playlists'))
fileManager.walkTree(self.remote_vfs.root_path + "userdata/playlists")
if(utils.getSetting('backup_profiles') == 'true'):
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/profiles'))
fileManager.walkTree(self.remote_vfs.root_path + "userdata/profiles")
if(utils.getSetting("backup_thumbnails") == "true"):
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/Thumbnails'))
fileManager.walkTree(self.remote_vfs.root_path + "userdata/Thumbnails")
@ -371,21 +379,22 @@ class FileManager:
self.vfs = vfs
def walkTree(self,directory):
dirs,files = self.vfs.listdir(directory)
if(self.vfs.exists(directory)):
dirs,files = self.vfs.listdir(directory)
#create all the subdirs first
for aDir in dirs:
dirPath = xbmc.translatePath(directory + "/" + aDir)
file_ext = aDir.split('.')[-1]
self.addFile("-" + dirPath)
#catch for "non directory" type files
if (not any(file_ext in s for s in self.not_dir)):
self.walkTree(dirPath)
#create all the subdirs first
for aDir in dirs:
dirPath = xbmc.translatePath(directory + "/" + aDir)
file_ext = aDir.split('.')[-1]
self.addFile("-" + dirPath)
#catch for "non directory" type files
if (not any(file_ext in s for s in self.not_dir)):
self.walkTree(dirPath)
#copy all the files
for aFile in files:
filePath = xbmc.translatePath(directory + "/" + aFile)
self.addFile(filePath)
#copy all the files
for aFile in files:
filePath = xbmc.translatePath(directory + "/" + aFile)
self.addFile(filePath)
def addFile(self,filename):
try:

View File

@ -14,6 +14,7 @@
<setting id="backup_addon_data" type="bool" label="30031" default="false" />
<setting id="backup_database" type="bool" label="30032" default="true" />
<setting id="backup_playlists" type="bool" label="30033" default="true" />
<setting id="backup_profiles" type="bool" label="30080" default="false" />
<setting id="backup_thumbnails" type="bool" label="30034" default="true" />
<setting id="backup_config" type="bool" label="30035" default="true" />
<setting id="custom_dir_1_enable" type="bool" label="30036" default="false" />