diff --git a/addon.xml b/addon.xml index 3f246e1..66e786d 100644 --- a/addon.xml +++ b/addon.xml @@ -1,6 +1,6 @@ + name="XBMC Backup" version="0.0.7" provider-name="robweber"> diff --git a/changelog.txt b/changelog.txt index ac9251a..504d68f 100644 --- a/changelog.txt +++ b/changelog.txt @@ -15,7 +15,11 @@ Finished code for restore mode. Added option to manually type a path rather than browse for one (only one used) Show progress bar right away so you know this is doing something -[b]Version 0.0.6/b] +[b]Version 0.0.6[/b] Added the vfs module created by paddycarey -File Selection is now followed for both backup and restore options \ No newline at end of file +File Selection is now followed for both backup and restore options + +[b]Version 0.0.7[/b] + +removed "restore.txt" file and now write file listing to memory list instead diff --git a/default.py b/default.py index 33b6e28..0bd1041 100644 --- a/default.py +++ b/default.py @@ -7,8 +7,8 @@ import os class FileManager: walk_path = '' addonDir = '' - fHandle = None - + fileArray = None + def __init__(self,path,addon_dir): self.walk_path = path self.addonDir = addon_dir @@ -18,7 +18,7 @@ class FileManager: os.makedirs(unicode(xbmc.translatePath(self.addonDir),'utf-8')) def createFileList(self,Addon): - self.fHandle = open(unicode(xbmc.translatePath(self.addonDir + "restore.txt"),'utf-8'),"w") + self.fileArray = [] #figure out which syncing options to run if(Addon.getSetting('backup_addons') == 'true'): @@ -49,9 +49,6 @@ class FileManager: for aFile in configFiles: if(aFile.endswith(".xml")): self.addFile("userdata/" + aFile) - - if(self.fHandle != None): - self.fHandle.close() def walkTree(self,directory): for (path, dirs, files) in vfs.walk(directory): @@ -66,13 +63,10 @@ class FileManager: def addFile(self,filename): #write the full remote path name of this file - if(self.fHandle != None): - self.fHandle.write(str(filename) + "\n") + self.fileArray.append(filename) - def readFileList(self): - allFiles = open(unicode(xbmc.translatePath(self.addonDir + "restore.txt"),'utf-8'),"r").read().splitlines() - - return allFiles + def getFileList(self): + return self.fileArray class XbmcBackup: __addon_id__ = 'script.xbmcbackup' @@ -131,7 +125,7 @@ class XbmcBackup: self.fileManager.createFileList(self.Addon) - allFiles = self.fileManager.readFileList() + allFiles = self.fileManager.getFileList() #write list from local to remote self.writeFiles(allFiles,self.local_path,self.remote_path) @@ -139,7 +133,7 @@ class XbmcBackup: def restoreFiles(self): self.fileManager.createFileList(self.Addon) - allFiles = self.fileManager.readFileList() + allFiles = self.fileManager.getFileList() #write list from remote to local self.writeFiles(allFiles,self.remote_path,self.local_path)