The branch, eden-pre has been updated
       via  3cc4d4acd6ccd098f95e41e088011d71eff1b8c3 (commit)
      from  f3dd28502a9964bdb7248a448e474f0d6d68ef5b (commit)

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

commit 3cc4d4acd6ccd098f95e41e088011d71eff1b8c3
Author: ronie <[email protected]>
Date:   Sat Jan 7 17:46:26 2012 +0100

    [script.watchlist] -v0.1.8
    
    script will now update only if necessary

diff --git a/script.watchlist/addon.xml b/script.watchlist/addon.xml
index 3bb5e0c..7217d3d 100644
--- a/script.watchlist/addon.xml
+++ b/script.watchlist/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.watchlist" name="Watchlist" version="0.1.7" 
provider-name="ronie">
+<addon id="script.watchlist" name="Watchlist" version="0.1.8" 
provider-name="ronie, `Black">
        <requires>
                <import addon="xbmc.python" version="2.0"/>
                <import addon="script.module.simplejson" version="2.0.10"/>
diff --git a/script.watchlist/changelog.txt b/script.watchlist/changelog.txt
index 79d547f..828f0b2 100644
--- a/script.watchlist/changelog.txt
+++ b/script.watchlist/changelog.txt
@@ -1,3 +1,6 @@
+v0.1.8
+- script will now update only if necessary
+
 v0.1.7
 - ignore possible unicode errors
 - stop previous script instance if a new one is created
diff --git a/script.watchlist/default.py b/script.watchlist/default.py
index 18fa184..a49f7e1 100644
--- a/script.watchlist/default.py
+++ b/script.watchlist/default.py
@@ -43,7 +43,7 @@ class Main:
 
     def _init_vars( self ):
         self.WINDOW = xbmcgui.Window( 10000 )
-        self.Player = MyPlayer( action = self._update )
+        self.Player = MyPlayer( action = self._update, movies = ( self.MOVIES 
== 'true' ), episodes = ( self.EPISODES == 'true' ), albums = ( self.ALBUMS == 
'true' ) )
 
     def _fetch_info( self ):
         if self.MOVIES == 'true':
@@ -334,23 +334,79 @@ class Main:
                 # stop here if our list contains more items
                 break
 
-    def _update( self ):
+    def _update( self, type ):
         log('playback stopped')
-        xbmc.sleep(500)
-        self._fetch_info()
-
+        xbmc.sleep(1000)
+        if type == 'movie':
+            self._fetch_movies()
+            self._clear_movie_properties()
+            self._set_movie_properties()
+        elif type == 'episode':
+            self._fetch_tvshows()
+            self._fetch_episodes()
+            self._clear_episode_properties()
+            self._set_episode_properties()
+        elif type == 'album':
+            self._fetch_songs()
+            self._fetch_albums()
+            self._clear_album_properties()
+            self._set_album_properties()
 
 class MyPlayer(xbmc.Player):
     def __init__( self, *args, **kwargs ):
         xbmc.Player.__init__( self )
         self.action = kwargs[ "action" ]
+        self.movies = kwargs[ "movies" ]
+        self.episodes = kwargs[ "episodes" ]
+        self.albums = kwargs[ "albums" ]
+        self.substrings = [ '-trailer', 'http://' ]
+        self.initValues()
+        
+    def onPlayBackStarted( self ):
+        if ( self.isPlayingAudio() ):
+            self.audioPlaycount += 1
+        else:
+            if xbmc.getCondVisibility( 'VideoPlayer.Content(movies)' ):
+                filename = ''
+                isMovie = True
+                try:
+                    filename = self.getPlayingFile()
+                except:
+                    pass
+                if filename != '':
+                    for string in self.substrings:
+                        if string in filename:
+                            isMovie = False
+                            break
+                if isMovie: self.videoPlaylist.append( 'movie' )
+            elif xbmc.getCondVisibility( 'VideoPlayer.Content(episodes)' ):
+                self.videoPlaylist.append( 'episode' )
 
     def onPlayBackEnded( self ):
-        self.action()
+        # If an audio file, movie or episode was played, update watch list
+        if self.audioPlaycount > 1 and self.albums:
+            self.action( 'album' )
+        if 'movie' in self.videoPlaylist and self.movies:
+            self.action( 'movie' )
+        if 'episode' in self.videoPlaylist and self.episodes:
+            self.action( 'episode' )
+        self.initValues()
 
     def onPlayBackStopped( self ):
-        self.action()
-
+        # If at least one audio file was played completely (playcount update)
+        # or if a movie or episode is in the playlist, update watch list
+        if self.audioPlaycount > 1 and self.albums:
+            self.action( 'album' )
+        if 'movie' in self.videoPlaylist and self.movies:
+            self.action( 'movie' )
+        if 'episode' in self.videoPlaylist and self.episodes:
+            self.action( 'episode' )
+        self.initValues()
+            
+    def initValues( self ):
+        self.videoPlaylist = [];
+        self.audioPlaycount = 0;
+                
 if ( __name__ == "__main__" ):
         log('script version %s started' % __addonversion__)
         Main()

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

Summary of changes:
 script.watchlist/addon.xml     |    2 +-
 script.watchlist/changelog.txt |    3 ++
 script.watchlist/default.py    |   72 +++++++++++++++++++++++++++++++++++----
 3 files changed, 68 insertions(+), 9 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to