The branch, eden has been updated
       via  35a41188f2db780b619f9ac87d05ccce6ae58ee4 (commit)
      from  a7a116f2344ea6c08b3cfef30b03ae0c80f9c7cc (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=35a41188f2db780b619f9ac87d05ccce6ae58ee4

commit 35a41188f2db780b619f9ac87d05ccce6ae58ee4
Author: Martijn Kaijser <[email protected]>
Date:   Sat May 26 02:48:46 2012 +0200

    [script.xbmcbackup] updated to 0.0.8

diff --git a/script.xbmcbackup/addon.xml b/script.xbmcbackup/addon.xml
index 3f246e1..418dcde 100644
--- a/script.xbmcbackup/addon.xml
+++ b/script.xbmcbackup/addon.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.xbmcbackup"
-    name="XBMC Backup" version="0.0.6" provider-name="robweber">
+    name="XBMC Backup" version="0.0.8" provider-name="robweber">
   <requires>
     <import addon="xbmc.python" version="2.0"/>
   </requires>
@@ -11,5 +11,6 @@
     <summary lang="en">Backup and restore your XBMC database and configuration 
files in the event of a crash or file corruption.</summary>
     <description lang="en">Ever hosed your XBMC configuration and wished you'd 
had a backup? Now you can with one easy click. You can export your database, 
playlist, thumbnails, addons and other configuration details to any source 
writeable by XBMC.</description>
     <platform>all</platform>
+    <language>en</language>
   </extension>
 </addon>
diff --git a/script.xbmcbackup/changelog.txt b/script.xbmcbackup/changelog.txt
index ac9251a..175e091 100644
--- a/script.xbmcbackup/changelog.txt
+++ b/script.xbmcbackup/changelog.txt
@@ -15,7 +15,15 @@ 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
+
+[b]Version 0.0.8[/b]
+
+modified vfs.py script to exclude handling zip files as directories, added 
keymap and peripheral data folders in the "config" section
diff --git a/script.xbmcbackup/default.py b/script.xbmcbackup/default.py
index 08bd81b..2fdc3ce 100644
--- a/script.xbmcbackup/default.py
+++ b/script.xbmcbackup/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'):
@@ -44,14 +44,18 @@ class FileManager:
            self.walkTree(self.walk_path + "userdata/Thumbnails")
                
         if(Addon.getSetting("backup_config") == "true"):
-           #this one is an oddity
-            configFiles = os.listdir(self.walk_path + "userdata/")
-           for aFile in configFiles:
-               if(aFile.endswith(".xml")):
-                   self.addFile("userdata/" + aFile)
+            self.addFile("-userdata/keymaps")
+            self.walkTree(self.walk_path + "userdata/keymaps")
 
-       if(self.fHandle != None):
-            self.fHandle.close()
+            self.addFile("-userdata/peripheral_data")
+            self.walkTree(self.walk_path + "userdata/peripheral_data")
+            
+           #this part is an oddity
+            configFiles = vfs.listdir(self.walk_path + 
"userdata/",extra_metadata=True)
+           for aFile in configFiles:
+                xbmc.log(aFile['file'][len(self.walk_path):])
+               if(aFile['file'].endswith(".xml")):
+                   self.addFile(aFile['file'][len(self.walk_path):])
         
     def walkTree(self,directory):
         for (path, dirs, files) in vfs.walk(directory):
@@ -66,13 +70,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")
-
-    def readFileList(self):
-        allFiles = open(unicode(xbmc.translatePath(self.addonDir + 
"restore.txt"),'utf-8'),"r").read().splitlines()
+        self.fileArray.append(filename)
 
-        return allFiles
+    def getFileList(self):
+       return self.fileArray
 
 class XbmcBackup:
     __addon_id__ = 'script.xbmcbackup'
@@ -131,7 +132,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,10 +140,13 @@ 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)
+
+        #call update addons to refresh everything
+        xbmc.executebuiltin('UpdateLocalAddons')
         
     def writeFiles(self,fileList,source,dest):
         self.filesTotal = len(fileList)
diff --git a/script.xbmcbackup/resources/lib/vfs.py 
b/script.xbmcbackup/resources/lib/vfs.py
index f4f529e..3aa291d 100644
--- a/script.xbmcbackup/resources/lib/vfs.py
+++ b/script.xbmcbackup/resources/lib/vfs.py
@@ -23,7 +23,7 @@ import json
 import os
 import xbmc
 import xbmcvfs
-
+import urllib
 
 def walk(path):
 
@@ -48,14 +48,14 @@ def walk(path):
                 current_dirs, current_files = [], []
 
                 for x in listdir(current_path, extra_metadata=True):
+                    
+                    if x['filetype'] == 'directory' and not 
x['file'].startswith("zip://"):
 
-                    if x['filetype'] == 'directory':
-
-                        current_dirs.append(x['file'])
-
-                    else:
+                        current_dirs.append(urllib.unquote(x['file']))
 
-                        current_files.append(x['file'])
+                   else:
+   
+                       current_files.append(urllib.unquote(x['file']))
 
             except IndexError:
 

-----------------------------------------------------------------------

Summary of changes:
 script.xbmcbackup/addon.xml            |    3 +-
 script.xbmcbackup/changelog.txt        |   12 ++++++++-
 script.xbmcbackup/default.py           |   40 +++++++++++++++++--------------
 script.xbmcbackup/resources/lib/vfs.py |   14 +++++-----
 4 files changed, 41 insertions(+), 28 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to