Author: duncan
Date: Fri Jun  1 18:26:09 2007
New Revision: 9629

Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/video/plugins/bookmarker.py
   branches/rel-1/freevo/src/video/plugins/xine.py

Log:
[ 1729024 ] bookmarks for xine
Patch from Christian Lyra applied


Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Fri Jun  1 18:26:09 2007
@@ -19,6 +19,7 @@
  * Added personal web pages to the webserver, using PERSONAL_WWW_PAGE 
(F#1729595)
  * Updated childapp to use subprocess instead of popen (F#1729597)
  * Updated local_conf.py.example with MPLAYER_HAS_FIELD_DOMINANCE (F#1729404)
+ * Updated xine video plug-in to allow bookmarks to work (F#1729024)
  * Updated xine video plug-in to process stdout and stderr message (F#1729603)
  * Fixed tv recordings manager not deleting files when out of space (B#1728182)
  * Fixed problem with FXD.setattr not working correctly in all cases 
(B#1728421)

Modified: branches/rel-1/freevo/src/video/plugins/bookmarker.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/bookmarker.py       (original)
+++ branches/rel-1/freevo/src/video/plugins/bookmarker.py       Fri Jun  1 
18:26:09 2007
@@ -41,6 +41,7 @@
 
 
 import os, time, copy
+import glob
 import kaa.metadata as mmpython
 
 import plugin
@@ -75,14 +76,31 @@
         """
         t    = max(0, self.item['autobookmark_resume'] - 10)
         info = mmpython.parse(self.item.filename)
-        if hasattr(info, 'seek') and t:
-            arg='-sb %s' % info.seek(t)
+        if (config.VIDEO_PREFERED_PLAYER == 'xine'):
+            self.write_playlist(t)
+            arg = ("--playlist %s/playlist_xine_%s.tox" % 
(config.FREEVO_CACHEDIR, t))
         else:
-            arg='-ss %s' % t
+            if hasattr(info, 'seek') and t:
+                arg='-sb %s' % info.seek(t)
+            else:
+                arg='-ss %s' % t
         if menuw:
             menuw.back_one_menu()
         self.item.play(menuw=menuw, arg=arg)
 
+    def write_playlist(self,time):
+        t = time
+        name = '%s/playlist_xine_%s.tox' % (config.FREEVO_CACHEDIR,t)
+        playlist = open(name,'w')
+        playlist.write ("# toxine playlist\n")
+        playlist.write ("entry {\n")
+        playlist.write ("       identifier = %s;\n" % self.item.filename)
+        playlist.write ("       mrl = %s;\n" % self.item.filename)
+        playlist.write ("       start = %s\n" % t)
+        playlist.write ("};\n")
+        playlist.write ("# END\n")
+        playlist.close()
+
 
     def bookmark_menu(self,arg=None, menuw=None):
         """
@@ -106,7 +124,12 @@
 
             if not self.item.mplayer_options:
                 self.item.mplayer_options = ''
-            file.mplayer_options = str(self.item.mplayer_options) +  ' -ss %s' 
% time
+            if (config.VIDEO_PREFERED_PLAYER == 'xine'):
+                self.write_playlist(int(line))
+                cmd = ' --playlist %s/playlist_xine_%s.tox' % 
(config.FREEVO_CACHEDIR,int(line))
+                file.mplayer_options = (cmd)
+            else:
+                file.mplayer_options = str(self.item.mplayer_options) +  ' -ss 
%s' % time
             items.append(file)
 
         if items:
@@ -117,8 +140,11 @@
 
     def eventhandler(self, item, event, menuw):
         if event in (STOP, USER_END):
+            playlist_remove = ("%s/playlist_xine*.tox" % 
config.FREEVO_CACHEDIR)
+            for filename in glob.glob(playlist_remove):
+                os.remove(filename)
             if item.mode == 'file' and not item.variants and \
-                   not item.subitems and item.elapsed:
+                not item.subitems and item.elapsed:
                 item.store_info('autobookmark_resume', item.elapsed)
             else:
                 _debug_('auto-bookmark not supported for this item')
@@ -129,6 +155,15 @@
 
         # Bookmark the current time into a file
         if event == STORE_BOOKMARK:
+            #Get time elapsed for xine video
+            videoplayer = config.VIDEO_PREFERED_PLAYER
+            if (videoplayer == 'xine'):
+                command = ("%s -S get_time" % config.CONF.xine)
+                handle = os.popen(command,'r')
+                position = handle.read();
+                handle.close()
+                item.elapsed = int(position)
+
             bookmarkfile = util.get_bookmarkfile(item.filename)
 
             handle = open(bookmarkfile,'a+')

Modified: branches/rel-1/freevo/src/video/plugins/xine.py
==============================================================================
--- branches/rel-1/freevo/src/video/plugins/xine.py     (original)
+++ branches/rel-1/freevo/src/video/plugins/xine.py     Fri Jun  1 18:26:09 2007
@@ -121,6 +121,8 @@
         play a dvd with xine
         '''
         self.item = item
+        self.options = options
+        self.item.elapsed = 0
         if config.EVENTS.has_key(item.mode):
             self.app_mode = item.mode
         else:
@@ -172,9 +174,13 @@
             self.app_mode = 'vcd'
 
         else:
-            command.append(item.url)
-
-        #_debug_('Xine.play(): Starting cmd=%s' % command)
+            if (len(options) > 1):
+                if (options[1] == '--playlist'):
+                    #command.append('%s %s' % (options[1],options[2]))
+                    command.append(options[1])
+                    command.append(options[2])
+            else:
+                command.append(item.url)
 
         self.stdout_plugins = []
 
@@ -192,6 +198,14 @@
             return
 
         self.app.stop('quit\n')
+        command = "%s -S get_time" % config.CONF.xine
+        handle = os.popen(command,'r')
+        position = handle.read();
+        handle.close()
+        _debug_("Elapsed = %s" % position)
+        self.item.elapsed = int(position)
+
+        self.app.stop('quit\n')
         rc.app(None)
         self.app = None
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to