The branch, eden-pre has been updated
       via  47982b545d993ef9f298ca7a67085287b7251217 (commit)
      from  b95aa89ce773b2273d511be74c32c5a24dc20b49 (commit)

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

commit 47982b545d993ef9f298ca7a67085287b7251217
Author: amet <[email protected]>
Date:   Tue Jan 10 23:51:39 2012 +0400

    [service.libraryautoupdate] -v 0.3.9
    
    - running video and music scans side by side never really worked. Now 
checks if scan is running and waits until complete before running the next scan.

diff --git a/service.libraryautoupdate/addon.xml 
b/service.libraryautoupdate/addon.xml
index b65c1de..6dac956 100644
--- a/service.libraryautoupdate/addon.xml
+++ b/service.libraryautoupdate/addon.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>

 <addon id="service.libraryautoupdate"

-    name="XBMC Library Auto Update" version="0.3.7" provider-name="robweber">

+    name="XBMC Library Auto Update" version="0.3.9" provider-name="robweber">

   <requires>

     <import addon="xbmc.python" version="2.0"/>

   </requires>

@@ -8,7 +8,7 @@
   </extension>

   <extension point="xbmc.addon.metadata">

     <summary lang="en">Update your XBMC Video and Music Libraries on a timer. 
Recently rewritten to run as an XBMC Service.</summary>

-    <description lang="en">This is an XBMC Service that will update your music 
and video libraries on a timer. You can select an interval to scan and which 
databases (Music, Video, or Both) you want to have scanned. If you are playing 
an audio or video file when the timer starts it will skip the library update 
process so that you're media experience is not interrupted. </description>

+    <description lang="en">This is an XBMC Service that will update your music 
and video libraries on a timer. You can select an interval to scan and which 
databases (Music, Video, or Both) you want to have scanned. If you are playing 
an audio or video file when the timer starts it will skip the library update 
process until it is completed so that you're media experience is not 
interrupted. </description>

     <platform>all</platform>

   </extension>

 </addon>

diff --git a/service.libraryautoupdate/changelog.txt 
b/service.libraryautoupdate/changelog.txt
index 5423848..f47d6ff 100644
--- a/service.libraryautoupdate/changelog.txt
+++ b/service.libraryautoupdate/changelog.txt
@@ -12,3 +12,7 @@
 - now runs as a service instead of needing the autoexec.py file

 

 - removed sample autoexec.py

+

+[B]Version 0.3.9[/B]

+ 

+- running video and music scans side by side never really worked. Now checks 
if scan is running and waits until complete before running the next scan. 
\ No newline at end of file
diff --git a/service.libraryautoupdate/default.py 
b/service.libraryautoupdate/default.py
index c3dc1e8..349d098 100644
--- a/service.libraryautoupdate/default.py
+++ b/service.libraryautoupdate/default.py
@@ -11,6 +11,7 @@ class AutoUpdater:
         
         while(not xbmc.abortRequested):
             now = time.time()
+            sleep_time = 10
             
             timer_amounts = {}
             timer_amounts['0'] = 1
@@ -20,23 +21,44 @@ class AutoUpdater:
             timer_amounts['4'] = 15
             timer_amounts['5'] = 24
 
-            #only do this if we are not playing anything
-            if(xbmc.Player().isPlaying() == False and now > self.last_run + 
(timer_amounts[Addon.getSetting('timer_amount')] * 60 * 60)):
-                #run the update since we have just started the program
-                if(Addon.getSetting('update_video') == 'true'):
-                    xbmc.log('Updating Video')
-                    xbmc.executebuiltin('UpdateLibrary(video)')
-                if(Addon.getSetting('update_music') == 'true'):
-                    xbmc.log('Updating Music')
-                    xbmc.executebuiltin('UpdateLibrary(music)')
+            #check if we should run an update
+            if(now > self.last_run + 
(timer_amounts[Addon.getSetting('timer_amount')] * 60 * 60)):
+
+                #make sure player isn't running
+                if(xbmc.Player().isPlaying() == False):
+                    
+                    if(self.scanRunning() == False):
+                        
+                        #run the update
+                        if(Addon.getSetting('update_video') == 'true'):
+                            xbmc.log('Updating Video')
+                            xbmc.executebuiltin('UpdateLibrary(video)')
+                            time.sleep(1)
+                            
+                        if(Addon.getSetting('update_music') == 'true'):
+                            #check if scan is running again, wait until 
finished if it is
+                            while(self.scanRunning()):
+                                time.sleep(10)
+                            
+                            xbmc.log('Update Music')
+                            xbmc.executebuiltin('UpdateLibrary(music)')
+                        
+                        #reset the last run timer    
+                        self.last_run = now
+                        xbmc.log("Update Library will run again in " + 
str(timer_amounts[Addon.getSetting("timer_amount")]) + " hours")
+                else:
+                    xbmc.log("Player is running, waiting until finished")
                     
-                #reset the last run timer    
-                self.last_run = now
-                xbmc.log("Update Library will run again in " + 
str(timer_amounts[Addon.getSetting("timer_amount")]) + " hours")
-                
             #put the thread to sleep for x number of seconds
-            time.sleep(60)
-
+            time.sleep(sleep_time)
+            
+    def scanRunning(self):
+        #check if any type of scan is currently running
+        if(xbmc.getCondVisibility('Library.IsScanningVideo') or 
xbmc.getCondVisibility('Library.IsScanningMusic')):
+            return True
+        else:
+            return False
+           
 #run the program
 xbmc.log("Update Library Service starting...")
 AutoUpdater().runProgram()

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

Summary of changes:
 service.libraryautoupdate/addon.xml     |    4 +-
 service.libraryautoupdate/changelog.txt |    4 ++
 service.libraryautoupdate/default.py    |   52 ++++++++++++++++++++++---------
 3 files changed, 43 insertions(+), 17 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to