The branch, frodo has been updated
       via  11e29b34da692eed6ddfa180f502a08658c548c9 (commit)
      from  25df1d7e08e2a0452d17a0934190a07979793d0f (commit)

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

commit 11e29b34da692eed6ddfa180f502a08658c548c9
Author: Martijn Kaijser <[email protected]>
Date:   Sat May 11 15:58:36 2013 +0200

    [script.xbmcbackup] 0.3.8

diff --git a/script.xbmcbackup/README.txt b/script.xbmcbackup/README.txt
index 8c413bf..4b345e3 100644
--- a/script.xbmcbackup/README.txt
+++ b/script.xbmcbackup/README.txt
@@ -1,6 +1,5 @@
 XBMC Backup
 
-WHEN UPDATING TO 0.3.6 OR ABOVE - To fix the very real problem of deleting non 
xbmc backup files during the backup rotation a simple check for an 
xbmcbackup.val file is done on each directory to ensure it was created by this 
addon. To make your old archives compatible with this feature simply create an 
empty xbmcbackup.val file and put it in each backup archive folder. The easiest 
way is to create a backup with the new addon and copy the xbmcbackup.val file 
to your other directories. 
 
 About: 
 I've had to recover my database, thumbnails, and source configuration enough 
times that I just wanted a quick easy way to back them up. That is what this 
addon is meant to do. 
@@ -43,9 +42,24 @@ If you wish to script this addon using an outside scheduler 
or script it can be
 RunScript(script.xbmcbackup,backup)
 
 
-What this Addon Will Not Do:
+FAQ: 
 
-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. 
+I can't see any restore points when choosing "Restore", what is the problem? 
 
-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. 
+If you've created restore points with an older version of the addon (pre 
0.3.6) you may see this issue. New versions of the addon look for a file called 
xbmcbackup.val to validate that a folder is a valid restore archive. Your older 
restore folders may not have this file. All you need to do is create a blank 
text file and rename it to xbmcbackup.val. Then put this file inside the 
archive directory. Your restore points should show up after selecting "Restore" 
in the addon again. 
+
+Several settings aren't being restored, this includes views, weather, etc. How 
do I get these back? 
+
+GUISETTINGS.xml is a configuration file used heavily by XBMC for remembering 
GUI specific settings. Due to the fact that XBMC reads this file on startup, 
and writes from memory to this file on shutdown; it is not possible to restore 
this file while XBMC is running. You must manually move this file from your 
backup archives if you wish to restore it. User SouthMark has posted the 
following steps for restoring in the OpenELEC system where this is more 
difficult: 
+
+1. Run the restore of your backup
+2. SSH using putty to the IP Address of your media centre username: root 
Password openelec
+3. Type touch /var/lock/xbmc.disabled and then press enter
+4. Type kill all -9 xbmc.bin and then press enter - Your media center machine 
should now go blank
+5. Connect to your machine using WinSCP and copy the guisettings.xml file to 
the userdata folder (this is the guisettings.xml file from your backup)
+6. go back to your putty window and type rm /var/lock/xbmc.disabled
+
+Why is the Addon prompting me to restart XBMC to continue? 
+
+If you have an advancedsettings file in your restore folder the addon will ask 
you if you want to restore this file and restart xbmc to continue. This is 
because the advancedsettings file may contain path substitution information 
that you want to be loaded when doing the rest of your restore. By restoring 
this file and restarting xbmc it will be loaded and the rest of your files will 
go where they are supposed to. If you know your file does not contain any path 
substitutions you can select "no" and continue as normal. 
 
diff --git a/script.xbmcbackup/addon.xml b/script.xbmcbackup/addon.xml
index 09f21c3..bd4ff2b 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.3.7" provider-name="robweber">
+    name="XBMC Backup" version="0.3.8" provider-name="robweber">
   <requires>
     <import addon="xbmc.python" version="2.1.0"/>
   </requires>
diff --git a/script.xbmcbackup/changelog.txt b/script.xbmcbackup/changelog.txt
index 1b15562..e2e7705 100644
--- a/script.xbmcbackup/changelog.txt
+++ b/script.xbmcbackup/changelog.txt
@@ -1,3 +1,7 @@
+Version 0.3.8
+
+added advancedsettings check on restore. prompts user to restore only this 
file and restart xbmc to continue. This fixes issues where path substitution 
was not working during restores - thanks ctrlbru
+
 Version 0.3.7
 
 added optional addon.xml tags
diff --git a/script.xbmcbackup/resources/language/English/strings.xml 
b/script.xbmcbackup/resources/language/English/strings.xml
index 934452f..26c9023 100644
--- a/script.xbmcbackup/resources/language/English/strings.xml
+++ b/script.xbmcbackup/resources/language/English/strings.xml
@@ -30,6 +30,13 @@
     <string id="30035">Config Files</string>
     <string id="30036">Custom Directory 1</string>
     <string id="30037">Custom Directory 2</string>
+       <string id="30038">Advanced Settings Detected</string>
+       <string id="30039">The advancedsettings file should be restored 
first</string>
+       <string id="30040">Select Yes to restore this file and restart 
XBMC</string>
+       <string id="30041">Select No to continue</string>
+       <string id="30042">Resume Restore</string>
+       <string id="30043">XBMC Backup has detected an unfinished 
restore</string>
+       <string id="30044">Would you like to continue?</string>
     <string id="30045">Error: Remote path doesn't exist</string>
     <string id="30046">Starting</string>
     <string id="30047">Local Dir</string>
@@ -61,4 +68,6 @@
     <string id="30074">First Day of Month</string>
     <string id="30075">Custom Schedule</string>
     <string id="30076">Shutdown After Backup</string>
+       <string id="30077">Restart XBMC</string>
+       <string id="30078">You should restart XBMC to continue</string>
 </strings>
diff --git a/script.xbmcbackup/resources/lib/backup.py 
b/script.xbmcbackup/resources/lib/backup.py
index 2c918bc..11b6e8e 100644
--- a/script.xbmcbackup/resources/lib/backup.py
+++ b/script.xbmcbackup/resources/lib/backup.py
@@ -24,7 +24,8 @@ class XbmcBackup:
 
     fileManager = None
     restore_point = None
-
+    skip_advanced = False   #if we should check for the existance of 
advancedsettings in the restore
+    
     def __init__(self):
         self.xbmc_vfs = XBMCFileSystem(xbmc.translatePath('special://home'))
 
@@ -58,6 +59,9 @@ class XbmcBackup:
     def selectRestore(self,restore_point):
         self.restore_point = restore_point
 
+    def skipAdvanced(self):
+        self.skip_advanced = True
+
     def run(self,mode=-1,runSilent=False):
         #append backup folder name
         progressBarTitle = utils.getString(30010) + " - "
@@ -184,6 +188,38 @@ class XbmcBackup:
             fileManager = FileManager(self.remote_vfs)
          
             #go through each of the user selected items and write them to the 
backup store
+
+            if(utils.getSetting("backup_config") == "true"):
+                #check for the existance of an advancedsettings file
+                if(self.remote_vfs.exists(self.remote_vfs.root_path + 
"userdata/advancedsettings.xml") and not self.skip_advanced):
+                    #let the user know there is an advanced settings file 
present
+                    restartXbmc = 
xbmcgui.Dialog().yesno(utils.getString(30038),utils.getString(30039),utils.getString(30040),
 utils.getString(30041))
+
+                    if(restartXbmc):
+                        #add only this file to the file list
+                        fileManager.addFile(self.remote_vfs.root_path + 
"userdata/advancedsettings.xml")
+                        
self.backupFiles(fileManager.getFiles(),self.remote_vfs,self.xbmc_vfs)
+
+                        #let the service know to resume this backup on startup
+                        self._createResumeBackupFile()
+
+                        #do not continue running
+                        
xbmcgui.Dialog().ok(utils.getString(30077),utils.getString(30078))
+                        
+                        return
+                
+                
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/keymaps'))
+                fileManager.walkTree(self.remote_vfs.root_path + 
"userdata/keymaps")
+                
+                
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/peripheral_data'))
+                fileManager.walkTree(self.remote_vfs.root_path + 
"userdata/peripheral_data")
+            
+                #this part is an oddity
+                dirs,configFiles = 
self.remote_vfs.listdir(self.remote_vfs.root_path + "userdata/")
+                for aFile in configFiles:
+                    if(aFile.endswith(".xml")):
+                        fileManager.addFile(self.remote_vfs.root_path + 
"userdata/" + aFile)
+
             if(utils.getSetting('backup_addons') == 'true'):
                 
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/addons'))
                 fileManager.walkTree(self.remote_vfs.root_path + "addons")
@@ -206,19 +242,6 @@ class XbmcBackup:
                 
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/Thumbnails'))
                 fileManager.walkTree(self.remote_vfs.root_path + 
"userdata/Thumbnails")
          
-            if(utils.getSetting("backup_config") == "true"):
-                
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/keymaps'))
-                fileManager.walkTree(self.remote_vfs.root_path + 
"userdata/keymaps")
-                
-                
self.xbmc_vfs.mkdir(xbmc.translatePath('special://home/userdata/peripheral_data'))
-                fileManager.walkTree(self.remote_vfs.root_path + 
"userdata/peripheral_data")
-            
-                #this part is an oddity
-                dirs,configFiles = 
self.remote_vfs.listdir(self.remote_vfs.root_path + "userdata/")
-                for aFile in configFiles:
-                    if(aFile.endswith(".xml")):
-                        fileManager.addFile(self.remote_vfs.root_path + 
"userdata/" + aFile)
-
             #add to array
             self.filesTotal = fileManager.size()
             
allFiles.append({"source":self.remote_vfs.root_path,"dest":self.xbmc_vfs.root_path,"files":fileManager.getFiles()})
    
@@ -329,11 +352,16 @@ class XbmcBackup:
 
     def _createValidationFile(self):
         vFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + 
"xbmcbackup.val"),'w')
-        vFile.write("XBMC Backup Validation File");
+        vFile.write("XBMC Backup Validation File")
         vFile.close()
 
         self.remote_vfs.put(xbmc.translatePath(utils.data_dir() + 
"xbmcbackup.val"),self.remote_vfs.root_path + "xbmcbackup.val")
 
+    def _createResumeBackupFile(self):
+        rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + 
"resume.txt"),'w')
+        rFile.write(self.restore_point)
+        rFile.close()
+
 class FileManager:
     fileArray = []
     not_dir = ['.zip','.xsp','.rar']
diff --git a/script.xbmcbackup/scheduler.py b/script.xbmcbackup/scheduler.py
index 882bc81..23ccb4e 100644
--- a/script.xbmcbackup/scheduler.py
+++ b/script.xbmcbackup/scheduler.py
@@ -1,4 +1,6 @@
 import xbmc
+import xbmcvfs
+import xbmcgui
 import datetime
 import time
 import os
@@ -10,6 +12,7 @@ class BackupScheduler:
     monitor = None
     enabled = "false"
     next_run = 0
+    restore_point = None
     
     def __init__(self):
         self.monitor = UpdateMonitor(update_method = self.settingsChanged)
@@ -25,6 +28,17 @@ class BackupScheduler:
         utils.log("scheduler will run again on " + 
datetime.datetime.fromtimestamp(self.next_run).strftime('%m-%d-%Y %H:%M'))
         
     def start(self):
+
+        #check if a backup should be resumed
+        resumeRestore = self._resumeCheck()
+
+        if(resumeRestore):
+            restore = XbmcBackup()
+            restore.selectRestore(self.restore_point)
+            #skip the advanced settings check
+            restore.skipAdvanced()
+            restore.run(XbmcBackup.Restore)
+        
         while(not xbmc.abortRequested):
             
             if(self.enabled == "true"):
@@ -92,7 +106,19 @@ class BackupScheduler:
             #first day of month
             cron_exp = "0 " + str(hour_of_day) + " 1 * *"
 
-        return cron_exp    
+        return cron_exp
+
+    def _resumeCheck(self):
+        shouldContinue = False
+        if(xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + 
"resume.txt"))):
+            rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + 
"resume.txt"),'r')
+            self.restore_point = rFile.read()
+            rFile.close()
+            xbmcvfs.delete(xbmc.translatePath(utils.data_dir() + "resume.txt"))
+            shouldContinue = 
xbmcgui.Dialog().yesno(utils.getString(30042),utils.getString(30043),utils.getString(30044))
+
+        return shouldContinue
+        
 
 class UpdateMonitor(xbmc.Monitor):
     update_method = None

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

Summary of changes:
 script.xbmcbackup/README.txt                       |   22 ++++++--
 script.xbmcbackup/addon.xml                        |    2 +-
 script.xbmcbackup/changelog.txt                    |    4 ++
 .../resources/language/English/strings.xml         |    9 +++
 script.xbmcbackup/resources/lib/backup.py          |   58 +++++++++++++++-----
 script.xbmcbackup/scheduler.py                     |   28 +++++++++-
 6 files changed, 102 insertions(+), 21 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and 
their applications. This 200-page book is written by three acclaimed 
leaders in the field. The early access version is available now. 
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to