The branch, eden has been updated
       via  ee4e444c80bf67679e82d75505ec460f55427292 (commit)
       via  b18b6aaa414ef4a3b43c9874882eafe42b7601d7 (commit)
      from  3e1100676e0e278d01f46f2d39a74bad2d139792 (commit)

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

commit ee4e444c80bf67679e82d75505ec460f55427292
Author: amet <[email protected]>
Date:   Fri Sep 21 03:07:01 2012 +0400

    [weather.ozweather] -v0.4.2
    
    - Fixes for capatilisation
    - Fixes for parsedom 1.2 unicode behaviour

diff --git a/weather.ozweather/addon.xml b/weather.ozweather/addon.xml
index 1006569..4bebe93 100644
--- a/weather.ozweather/addon.xml
+++ b/weather.ozweather/addon.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="weather.ozweather" name="Oz Weather" version="0.4.0" 
provider-name="Bossanova808">
+<addon id="weather.ozweather" name="Oz Weather" version="0.4.2" 
provider-name="Bossanova808">
        <requires>
                <import addon="xbmc.python" version="2.0"/>
-    <import addon="script.module.parsedom" version="1.0.0"/>
+    <import addon="script.module.parsedom" version="1.2.0"/>
        </requires>
        <extension point="xbmc.python.weather" library="default.py"/>
        <extension point="xbmc.addon.metadata">
diff --git a/weather.ozweather/changelog.txt b/weather.ozweather/changelog.txt
index 40e4cff..b1724ba 100644
--- a/weather.ozweather/changelog.txt
+++ b/weather.ozweather/changelog.txt
@@ -1,3 +1,7 @@
+V0.4.2
+- Fixes for capatilisation
+- Fixes for parsedom 1.2 unicode behaviour
+
 V0.3.8
 - Only import PIL if extended features are activated (means on paltforms like 
Crystalbuntu without PIL you can still get BOM weather data at least.
 - some radars (e.g. IDR072) - were not on the ftp server, they now get pulled 
in by http
diff --git a/weather.ozweather/default.py b/weather.ozweather/default.py
index 59249e8..1c845cc 100644
--- a/weather.ozweather/default.py
+++ b/weather.ozweather/default.py
@@ -388,16 +388,20 @@ def propertiesPDOM(page, extendedFeatures):
     ####CURRENT DATA
     try:
       #pull data from the current observations table
-      ret = common.parseDOM(page, "div", attrs = { "class": "details_lhs" })
-      observations = common.parseDOM(ret, "td", attrs = { "class": "hilite 
bg_yellow" })
-      #Observations now looks like - ['18.3&deg;C', '4.7&deg;C', '18.3&deg;C', 
'41%', 'SSW 38km/h', '48km/h', '1015.7hPa', '-', '0.0mm / -']
-      temperature = str.strip(observations[0], '&deg;C')
-      dewPoint = str.strip(observations[1], '&deg;C')
-      feelsLike = str.strip(observations[2], '&deg;C')
-      humidity = str.strip(observations[3], '%')
-      windTemp = observations[4].partition(' ');
-      windDirection = windTemp[0]
-      windSpeed = str.strip(windTemp[2], 'km/h')
+        ret = common.parseDOM(page, "div", attrs = { "class": "details_lhs" })
+        observations = common.parseDOM(ret, "td", attrs = { "class": "hilite 
bg_yellow" })
+        #Observations now looks like - ['18.3&deg;C', '4.7&deg;C', 
'18.3&deg;C', '41%', 'SSW 38km/h', '48km/h', '1015.7hPa', '-', '0.0mm / -']
+        #log(" *********************************************************** ")
+        #log(" OBESERVATIONS " + str(observations))
+        temperature = observations[0].strip( '&deg;C' )
+        #log(" *********************************************************** ")
+        #log(" TEMP " + str(temperature))
+        dewPoint = observations[1].strip( '&deg;C' )
+        feelsLike = observations[2].strip( '&deg;C')
+        humidity = observations[3].strip( '%')
+        windTemp = observations[4].partition(' ');
+        windDirection = windTemp[0]
+        windSpeed = windTemp[2].strip( 'km/h')
       #there's no UV so we get that from the forecast, see below
     except Exception as inst:
       log("********** OzWeather Couldn't Parse Data, sorry!!", inst)
@@ -428,7 +432,7 @@ def propertiesPDOM(page, extendedFeatures):
       shortDesc = shortDesc[0:7]
 
       for count, desc in enumerate(shortDesc):
-        shortDesc[count] = str.replace(shortDesc[count].title(), '-<br />','')
+        shortDesc[count] = shortDesc[count].title().replace( '-<br />','')
 
       #log the collected data, helpful for finding errors
       #log("Collected data: shortDesc [" + str(shortDesc) + "] maxList [" + 
str(maxList) +"] minList [" + str(minList) + "]")
@@ -450,9 +454,9 @@ def propertiesPDOM(page, extendedFeatures):
           #new method - just strip the crap (e.g. tabs) out of the string and 
use a colon separator for the 'return' as we don't have much space
           longDayCast = common.stripTags(longDayCast[0])
           #print longDayCast
-          longDayCast = str.replace(longDayCast, '\t','')
-          longDayCast = str.replace(longDayCast, '\r',' ')
-          longDayCast = str.replace(longDayCast, '&amp;','&')
+          longDayCast = longDayCast.replace( '\t','')
+          longDayCast = longDayCast.replace( '\r',' ')
+          longDayCast = longDayCast.replace( '&amp;','&')
           #print '@@@@@@@@@ Long 4', longDayCast
           longDayCast = longDayCast[:-1]
           #print '@@@@@@@@@@@@@@@@' , longDayCast[-5:]

http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=b18b6aaa414ef4a3b43c9874882eafe42b7601d7

commit b18b6aaa414ef4a3b43c9874882eafe42b7601d7
Author: amet <[email protected]>
Date:   Fri Sep 21 03:04:34 2012 +0400

    [script.xbmcbackup] -v 0.1.3
    
    [b]Version 0.1.6[/b]
    
    merged scheduler branch with master, can now schedule backups on an interval
    
    [b]Version 0.1.5[/b]
    
    pulled xbmcbackup class into separate library
    
    [b]Version 0.1.4[/b]
    
    added more verbose error message for incorrect paths

diff --git a/script.xbmcbackup/README.txt b/script.xbmcbackup/README.txt
index 750f69b..63faa3f 100644
--- a/script.xbmcbackup/README.txt
+++ b/script.xbmcbackup/README.txt
@@ -11,6 +11,10 @@ On the Backup Selection page you can select which items from 
your user profile f
 
 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. 
 
+Scheduling: 
+
+You can also schedule backups to be completed on a set interval via the 
scheduling area. When it is time for the backup to run it will be executed in 
the background. 
+
 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. 
diff --git a/script.xbmcbackup/addon.xml b/script.xbmcbackup/addon.xml
index 752b4d6..338d24a 100644
--- a/script.xbmcbackup/addon.xml
+++ b/script.xbmcbackup/addon.xml
@@ -1,19 +1,20 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.xbmcbackup"
-    name="XBMC Backup" version="0.1.3" provider-name="robweber">
+    name="XBMC Backup" version="0.1.6" provider-name="robweber">
   <requires>
     <import addon="xbmc.python" version="2.0"/>
   </requires>
   <extension point="xbmc.python.script" library="default.py"> 
      <provides>executable</provides> 
   </extension> 
+  <extension point="xbmc.service" library="scheduler.py" start="startup" />
   <extension point="xbmc.addon.metadata">
     <summary lang="fr">Sauvegarder et restaurer vos bases de données XBMC et 
vos fichiers de configuration en cas de crash ou de fichiers 
corrompus.</summary>
     <summary lang="de">Die XBMC Datenbank sichern und bei Dateiverlust oder 
Beschädigung wiederherstellen.</summary>
     <summary lang="en">Backup and restore your XBMC database and configuration 
files in the event of a crash or file corruption.</summary>
        <description lang="fr">Avez-vous déjà perdu votre configuration XBMC 
et espéré avoir fait une sauvegarde ? Maintenant, vous pouvez le faire en un 
simple click. Vous pouvez exporter vos bases de données, playlists, 
miniatures, addons et autres fichiers de configuration vers n'importe quel 
endroit accessible depuis XBMC.</description>
     <description lang="de">Jemals deine XBMC Konfiguration zerschossen und dir 
dann gewünscht, dass ein Backup existiert? Jetzt kannst du eine Sicherung mit 
nur einem Klick erzeugen. Du kannst deine Datenbanen, Playlisten, Thumbnails, 
Addons und andere Details zu einem Ort deiner Wahl sichern.</description>
-    <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>
+    <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. Backups can be run on demand or via a scheduler. 
</description>
     <platform>all</platform>
     <language></language>
   </extension>
diff --git a/script.xbmcbackup/changelog.txt b/script.xbmcbackup/changelog.txt
index 4c1fd67..3d9005b 100644
--- a/script.xbmcbackup/changelog.txt
+++ b/script.xbmcbackup/changelog.txt
@@ -1,3 +1,15 @@
+[b]Version 0.1.6[/b]
+
+merged scheduler branch with master, can now schedule backups on an interval
+
+[b]Version 0.1.5[/b]
+
+pulled xbmcbackup class into separate library
+
+[b]Version 0.1.4[/b]
+
+added more verbose error message for incorrect paths
+
 [b]Version 0.1.3[/b]
 
 backup folder format - thanks zeroram
diff --git a/script.xbmcbackup/default.py b/script.xbmcbackup/default.py
index 7c82791..8676e8b 100644
--- a/script.xbmcbackup/default.py
+++ b/script.xbmcbackup/default.py
@@ -1,223 +1,7 @@
-import xbmc
-import xbmcaddon
-import xbmcgui
-import resources.lib.vfs as vfs
-import os
-import time
-
-__addon_id__ = 'script.xbmcbackup'
-__Addon = xbmcaddon.Addon(__addon_id__)
-
-class FileManager:
-    walk_path = ''
-    addonDir = ''
-    fileArray = None
-    verbose_log = False
-    
-    def __init__(self,path,addon_dir):
-        self.walk_path = path
-        self.addonDir = addon_dir
-
-        #create the addon folder if it doesn't exist
-        if(not 
os.path.exists(unicode(xbmc.translatePath(self.addonDir),'utf-8'))):
-            os.makedirs(unicode(xbmc.translatePath(self.addonDir),'utf-8'))
-
-    def createFileList(self,Addon):
-        self.fileArray = []
-        self.verbose_log = Addon.getSetting("verbose_log") == 'true'
-       
-        #figure out which syncing options to run
-        if(Addon.getSetting('backup_addons') == 'true'):
-            self.addFile("-addons")
-            self.walkTree(self.walk_path + "addons/")
-
-        self.addFile("-userdata")
-        
-        if(Addon.getSetting('backup_addon_data') == 'true'):
-            self.addFile("-userdata/addon_data")
-            self.walkTree(self.walk_path + "userdata/addon_data/")
-           
-        if(Addon.getSetting('backup_database') == 'true'):
-           self.addFile("-userdata/Database")
-            self.walkTree(self.walk_path + "userdata/Database")
-        
-        if(Addon.getSetting("backup_playlists") == 'true'):
-           self.addFile("-userdata/playlists")
-           self.walkTree(self.walk_path + "userdata/playlists")
-                       
-        if(Addon.getSetting("backup_thumbnails") == "true"):
-           self.addFile("-userdata/Thumbnails")
-           self.walkTree(self.walk_path + "userdata/Thumbnails")
-               
-        if(Addon.getSetting("backup_config") == "true"):
-            self.addFile("-userdata/keymaps")
-            self.walkTree(self.walk_path + "userdata/keymaps")
-
-            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:
-               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):
-            
-            #create all the subdirs first
-            for aDir in dirs:
-                self.addFile("-" + aDir[len(self.walk_path):])
-            #copy all the files
-            for aFile in files:
-                filePath = aFile[len(self.walk_path):]
-                self.addFile(filePath)
-                    
-    def addFile(self,filename):
-        #write the full remote path name of this file
-        log("Add File: " + filename,xbmc.LOGDEBUG)
-        self.fileArray.append(filename)
-
-    def getFileList(self):
-       return self.fileArray
-
-class XbmcBackup:
-    addon = None
-    local_path = ''
-    remote_path = ''
-    restoreFile = None
-    
-    #for the progress bar
-    progressBar = None
-    filesLeft = 0
-    filesTotal = 1
-
-    fileManager = None
-    
-    def __init__(self,__Addon):
-        self.addon = __Addon
-        self.local_path = 
xbmc.makeLegalFilename(xbmc.translatePath("special://home"),False);
-      
-       if(self.addon.getSetting('remote_selection') == '1'):
-           self.remote_path = self.addon.getSetting('remote_path_2')
-           self.addon.setSetting("remote_path","")
-        elif(self.addon.getSetting('remote_selection') == '0'):
-            self.remote_path = self.addon.getSetting("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 
!= ''):
-            self.remote_path = self.remote_path + time.strftime("%Y%m%d") + "/"
-       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 = ""
-        
-        log(self.addon.getLocalizedString(30046))
-        log(self.addon.getLocalizedString(30047) + ": " + self.local_path)
-        log(self.addon.getLocalizedString(30048) + ": " + self.remote_path)
-
-    def run(self):
-       #check if we should use the progress bar
-        if(self.addon.getSetting('run_silent') == 'false'):
-            self.progressBar = xbmcgui.DialogProgress()
-            
self.progressBar.create(self.addon.getLocalizedString(30010),self.addon.getLocalizedString(30049)
 + "......")
-           
-        #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'))
-
-            #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):
-        
-        #make the remote directory
-        vfs.mkdir(self.remote_path)
-
-        log(self.addon.getLocalizedString(30051))
-        self.fileManager.createFileList(self.addon)
-
-        allFiles = self.fileManager.getFileList()
-
-        #write list from local to remote
-        self.writeFiles(allFiles,self.local_path,self.remote_path)
-        
-    def restoreFiles(self):
-        self.fileManager.createFileList(self.addon)
-
-        log(self.addon.getLocalizedString(30051))
-        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):
-        log("Writing files to: " + dest)
-        self.filesTotal = len(fileList)
-        self.filesLeft = self.filesTotal
-
-        #write each file from source to destination
-        for aFile in fileList:
-            if(not self.checkCancel()):
-                log('Writing file: ' + source + aFile,xbmc.LOGDEBUG)
-                self.updateProgress(aFile)
-                if (aFile.startswith("-")):
-                    vfs.mkdir(xbmc.makeLegalFilename(dest + aFile[1:],False))
-                else:
-                    vfs.copy(xbmc.makeLegalFilename(source + 
aFile),xbmc.makeLegalFilename(dest + aFile,False))
-
-        if(self.addon.getSetting('run_silent') == 'false'):
-            self.progressBar.close()
-
-    def updateProgress(self,message=''):
-        self.filesLeft = self.filesLeft - 1
-
-        #update the progress bar
-        if(self.progressBar != None):
-            self.progressBar.update(int((float(self.filesTotal - 
self.filesLeft)/float(self.filesTotal)) * 100),message)
-            
-    def checkCancel(self):
-        result = False
-
-        if(self.progressBar != None):
-            result = self.progressBar.iscanceled()
-
-        return result
-
-    def isReady(self):
-        return True if self.remote_path != '' else False
-
-#global functions for logging and encoding
-def log(message,loglevel=xbmc.LOGNOTICE):
-    xbmc.log(encode(__Addon.getLocalizedString(30010) + ": " + 
message),level=loglevel)
-
-def encode(string):
-    return string.encode('UTF-8','replace')
-
+from resources.lib.backup import XbmcBackup
 
 #run the profile backup
-backup = XbmcBackup(__Addon)
+backup = XbmcBackup()
 
 if(backup.isReady()):
     backup.run()
-else:
-    
xbmcgui.Dialog().ok(__Addon.getLocalizedString(30010),__Addon.getLocalizedString(30045))
diff --git a/script.xbmcbackup/resources/language/English/strings.xml 
b/script.xbmcbackup/resources/language/English/strings.xml
index b88f105..5f31fab 100644
--- a/script.xbmcbackup/resources/language/English/strings.xml
+++ b/script.xbmcbackup/resources/language/English/strings.xml
@@ -3,7 +3,8 @@
        <string id="30010">XBMC Backup</string>
        <string id="30011">General</string>
        <string id="30012">File Selection</string>
-       
+       <string id="30013">Scheduling</string>
+
        <string id="30016">Backup</string>
        <string id="30017">Restore</string>
        <string id="30018">Browse Path</string>
@@ -30,5 +31,22 @@
        <string id="30050">Remote Path exists - may have old files in 
it!</string>
        <string id="30051">Creating Files List</string>
        <string id="30052">Writing file</string>
-
+    <string id="30053">Starting scheduled backup</string>
+       
+       <string id="30060">Enable Scheduler</string>
+    <string id="30061">Schedule</string>
+       <string id="30062">Hour of Day</string>
+       <string id="30063">Day of Week</string>
+       <string id="30064">Cron Schedule</string>
+       <string id="30065">Sunday</string>
+       <string id="30066">Monday</string>
+       <string id="30067">Tuesday</string>
+       <string id="30068">Wednesday</string>
+       <string id="30069">Thursday</string>
+       <string id="30070">Friday</string>
+       <string id="30071">Saturday</string>
+       <string id="30072">Every Day</string>
+       <string id="30073">Every Week</string>
+       <string id="30074">First Day of Month</string>
+       <string id="30075">Custom Schedule</string>
 </strings>
diff --git a/script.xbmcbackup/resources/settings.xml 
b/script.xbmcbackup/resources/settings.xml
index d6cad5a..d32a629 100644
--- a/script.xbmcbackup/resources/settings.xml
+++ b/script.xbmcbackup/resources/settings.xml
@@ -16,4 +16,11 @@
                <setting id="backup_thumbnails" type="bool" label="30034" 
default="true" />
                <setting id="backup_config" type="bool" label="30035" 
default="true" />
        </category>
+       <category id="scheduling" label="30013">
+               <setting id="enable_scheduler" type="bool" label="30060" 
default="false" />
+               <setting id="schedule_interval" type="enum" label="30061" 
lvalues="30072|30073|30074|30075" default="0" enable="eq(-1,true)"/>
+               <setting id="schedule_time" type="labelenum" label="30062" 
values="00:00|01:00|02:00|03:00|04:00|05:00|06:00|07:00|08:00|09:00|10:00|11:00|12:00|13:00|14:00|15:00|16:00|17:00|18:00|19:00|20:00|21:00|22:00|23:00"
 default="00:00" visible="!eq(-1,3)"  enable="eq(-2,true)"/>
+               <setting id="day_of_week" type="enum" label="30063" 
lvalues="30065|30066|30067|30068|30069|30070|30071" default="0" 
visible="eq(-2,1)"  enable="eq(-3,true)"/>
+               <setting id="cron_schedule" type="text" label="30064" 
default="0 0 * * *" visible="eq(-3,3)"  enable="eq(-4,true)"/>
+       </category>
 </settings>

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

Summary of changes:
 script.xbmcbackup/README.txt                       |    4 +
 script.xbmcbackup/addon.xml                        |    5 +-
 script.xbmcbackup/changelog.txt                    |   12 +
 script.xbmcbackup/default.py                       |  220 +-------------------
 .../resources/language/English/strings.xml         |   22 ++-
 .../{default.py => resources/lib/backup.py}        |  137 ++++++-------
 .../resources/lib/croniter.py                      |    0
 .../resources/lib/relativedelta.py                 |    0
 script.xbmcbackup/resources/lib/utils.py           |   26 +++
 script.xbmcbackup/resources/settings.xml           |    7 +
 script.xbmcbackup/scheduler.py                     |   96 +++++++++
 weather.ozweather/addon.xml                        |    4 +-
 weather.ozweather/changelog.txt                    |    4 +
 weather.ozweather/default.py                       |   32 ++--
 14 files changed, 256 insertions(+), 313 deletions(-)
 copy script.xbmcbackup/{default.py => resources/lib/backup.py} (58%)
 copy {service.libraryautoupdate => 
script.xbmcbackup}/resources/lib/croniter.py (100%)
 copy {service.libraryautoupdate => 
script.xbmcbackup}/resources/lib/relativedelta.py (100%)
 create mode 100644 script.xbmcbackup/resources/lib/utils.py
 create mode 100644 script.xbmcbackup/scheduler.py


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://ad.doubleclick.net/clk;258768047;13503038;j?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to