Author: duncan
Date: Thu Jun  7 16:21:45 2007
New Revision: 9664

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

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


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       Thu Jun  7 
16:21:45 2007
@@ -76,7 +76,7 @@
         """
         t    = max(0, self.item['autobookmark_resume'] - 10)
         info = mmpython.parse(self.item.filename)
-        if (config.VIDEO_PREFERED_PLAYER == 'xine'):
+        if (self.item.player.name == 'xine'):
             self.write_playlist(t)
             arg = ("--playlist %s/playlist_xine_%s.tox" % 
(config.FREEVO_CACHEDIR, t))
         else:
@@ -91,12 +91,24 @@
     def write_playlist(self,time):
         t = time
         name = '%s/playlist_xine_%s.tox' % (config.FREEVO_CACHEDIR,t)
+
+        # this file has a companion subtitle file?
+        subtitle = None
+        try:
+            for file in glob.glob('%s.*' % 
os.path.splitext(self.item.filename)[0]):
+                if os.path.splitext(file)[1].lower() in ['.srt', '.sub', 
'.ssa']:
+                    subtitle = file
+                    break
+        except:
+            pass
         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)
+        if subtitle:
+            playlist.write("       subtitle = %s;\n" % subtitle)
+        playlist.write ("       start = %s;\n" % t)
         playlist.write ("};\n")
         playlist.write ("# END\n")
         playlist.close()
@@ -124,7 +136,7 @@
 
             if not self.item.mplayer_options:
                 self.item.mplayer_options = ''
-            if (config.VIDEO_PREFERED_PLAYER == 'xine'):
+            if (self.item.player.name == 'xine'):
                 self.write_playlist(int(line))
                 cmd = ' --playlist %s/playlist_xine_%s.tox' % 
(config.FREEVO_CACHEDIR,int(line))
                 file.mplayer_options = (cmd)
@@ -152,11 +164,10 @@
         if event == PLAY_END:
             item.delete_info('autobookmark_resume')
 
-
         # Bookmark the current time into a file
         if event == STORE_BOOKMARK:
             #Get time elapsed for xine video
-            videoplayer = config.VIDEO_PREFERED_PLAYER
+            videoplayer = self.item.player.name
             if (videoplayer == 'xine'):
                 command = ("%s -S get_time" % config.CONF.xine)
                 handle = os.popen(command,'r')

-------------------------------------------------------------------------
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