Update of /cvsroot/freevo/freevo/src/audio/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv5422/plugins

Modified Files:
        mplayer.py xine.py 
Log Message:
support more than one player

Index: mplayer.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/mplayer.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** mplayer.py  11 Nov 2003 18:01:44 -0000      1.25
--- mplayer.py  22 Nov 2003 15:30:55 -0000      1.26
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.26  2003/11/22 15:30:55  dischi
+ # support more than one player
+ #
  # Revision 1.25  2003/11/11 18:01:44  dischi
  # fix playback problems with fxd files (and transform to list app style)
***************
*** 22,55 ****
  # Remove the double-quit
  #
- # Revision 1.21  2003/10/08 03:24:47  outlyer
- # Try the 'double-quit' here as well. Seems to result in a faster shutdown of
- # mplayer.
- #
- # Revision 1.20  2003/09/20 08:56:24  dischi
- # fix the refresh bug the way it is handled for xine
- #
- # Revision 1.19  2003/09/20 01:55:04  mikeruelle
- # fix refresh issue
- #
- # Revision 1.18  2003/09/19 22:09:16  dischi
- # use new childapp thread function
- #
- # Revision 1.17  2003/09/15 20:06:42  dischi
- # cdda url handling repaired and only stop on playing player
- #
- # Revision 1.16  2003/09/13 10:08:22  dischi
- # i18n support
- #
- # Revision 1.15  2003/09/03 17:54:38  dischi
- # Put logfiles into LOGDIR not $FREEVO_STARTDIR because this variable
- # doesn't exist anymore.
- #
- # Revision 1.14  2003/09/01 19:46:01  dischi
- # add menuw to eventhandler, it may be needed
- #
- # Revision 1.13  2003/08/23 12:51:42  dischi
- # removed some old CVS log messages
- #
- #
  # -----------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
--- 25,28 ----
***************
*** 99,104 ****
  
          # register it as the object to play audio
!         plugin.register(mplayer, plugin.AUDIO_PLAYER)
!         plugin.register(mplayer, plugin.AUDIOCD_PLAYER)
  
  
--- 72,76 ----
  
          # register it as the object to play audio
!         plugin.register(mplayer, plugin.AUDIO_PLAYER, True)
  
  
***************
*** 109,116 ****
--- 81,101 ----
      
      def __init__(self):
+         self.name = 'mplayer'
          self.thread = childapp.ChildThread()
          self.mode = None
          self.app_mode = 'audio'
  
+ 
+     def rate(self, item):
+         """
+         How good can this player play the file:
+         2 = good
+         1 = possible, but not good
+         0 = unplayable
+         """
+         if item.filename.startswith('cdda://'):
+             return 1
+         return 2
+ 
          
      def get_demuxer(self, filename):
***************
*** 210,213 ****
--- 195,202 ----
  
          if event == AUDIO_PLAY_END:
+             if event.arg:
+                 self.stop()
+                 if self.playerGUI.try_next_player():
+                     return True
              event = PLAY_END
              
***************
*** 241,261 ****
  
      def __init__(self, (app, item, refresh)):
-         if config.MPLAYER_DEBUG:
-             fname_out = os.path.join(config.LOGDIR, 'mplayer_stdout.log')
-             fname_err = os.path.join(config.LOGDIR, 'mplayer_stderr.log')
-             try:
-                 self.log_stdout = open(fname_out, 'a')
-                 self.log_stderr = open(fname_err, 'a')
-             except IOError:
-                 print
-                 print ( _('ERROR') + ': ' + _( 'Cannot open "%s" and "%s" for ' \
-                                                'MPlayer logging!')
-                         ) % (fname_out, fname_err)
-                 print _( 'Please set MPLAYER_DEBUG=0 in local_conf.py, or ' \
-                          'start Freevo from a directory that is writeable!' )
-                 print
-             else:
-                 print _( 'MPlayer logging to "%s" and "%s"' ) % (fname_out, 
fname_err)
- 
          self.item = item
          self.elapsed = 0
--- 230,233 ----
***************
*** 264,292 ****
        self.RE_TIME_NEW = re.compile("^A: *([0-9]+):([0-9]+)").match
          self.refresh = refresh
! 
!     def kill(self):
!         # Use SIGINT instead of SIGKILL to make sure MPlayer shuts
!         # down properly and releases all resources before it gets
!         # reaped by childapp.kill().wait()
!         childapp.ChildApp.kill(self, signal.SIGINT)
!         if config.MPLAYER_DEBUG:
!             self.log_stdout.close()
!             self.log_stderr.close()
  
  
      def stopped(self):
!         rc.post_event(AUDIO_PLAY_END)
  
          
      def stdout_cb(self, line):
-         if config.MPLAYER_DEBUG:
-             try:
-                 self.log_stdout.write(line + '\n')
-             except ValueError:
-                 pass # File closed
-                      
          if line.startswith("A:"):         # get current time
              m = self.RE_TIME_NEW(line)
              if m:
                timestrs = string.split(m.group(),":")
                if len(timestrs) == 5:
--- 236,251 ----
        self.RE_TIME_NEW = re.compile("^A: *([0-9]+):([0-9]+)").match
          self.refresh = refresh
!         self.stop_reason = 0 # 0 = ok, 1 = error
  
  
      def stopped(self):
!         rc.post_event(Event(AUDIO_PLAY_END, self.stop_reason))
  
          
      def stdout_cb(self, line):
          if line.startswith("A:"):         # get current time
              m = self.RE_TIME_NEW(line)
              if m:
+                 self.stop_reason = 0
                timestrs = string.split(m.group(),":")
                if len(timestrs) == 5:
***************
*** 319,325 ****
  
      def stderr_cb(self, line):
!         if config.MPLAYER_DEBUG:
!             try:
!                 self.log_stderr.write(line + '\n')
!             except ValueError:
!                 pass # File closed
--- 278,281 ----
  
      def stderr_cb(self, line):
!         if line.startswith('Failed to open'):
!             self.stop_reason = 1

Index: xine.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/audio/plugins/xine.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** xine.py     8 Nov 2003 13:20:26 -0000       1.8
--- xine.py     22 Nov 2003 15:30:55 -0000      1.9
***************
*** 13,16 ****
--- 13,19 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.9  2003/11/22 15:30:55  dischi
+ # support more than one player
+ #
  # Revision 1.8  2003/11/08 13:20:26  dischi
  # support for AUDIOCD plugin type
***************
*** 74,79 ****
      """
      Xine plugin for the video player.
- 
-     Set AUDIO_XINE_AUDIOCD_ONLY to activate this plugin only for audio cds
      """
      def __init__(self):
--- 77,80 ----
***************
*** 83,87 ****
              config.CONF.fbxine
          except:
!             print  _( 'ERROR' ) + ': ' + _( "'fbxine' not found, plugin 'xine' 
deactivated" )
              return
  
--- 84,89 ----
              config.CONF.fbxine
          except:
!             print _( 'ERROR' ) + ': ' + \
!                   _( "'fbxine' not found, plugin 'xine' deactivated" )
              return
  
***************
*** 107,111 ****
              
          if xine_version < 923:
!             print _( 'ERROR' ) + ': ' + _( "'fbxine' version too old, plugin 'xine' 
deactivated" )
              print _( 'You need software %s' ) % 'xine-ui > 0.9.22'
              return
--- 109,114 ----
              
          if xine_version < 923:
!             print _( 'ERROR' ) + ': ' + \
!                   _( "'fbxine' version too old, plugin 'xine' deactivated" )
              print _( 'You need software %s' ) % 'xine-ui > 0.9.22'
              return
***************
*** 115,122 ****
  
          # register it as the object to play
!         if not (hasattr(config, 'AUDIO_XINE_AUDIOCD_ONLY') and \
!                 config.AUDIO_XINE_AUDIOCD_ONLY):
!             plugin.register(xine, plugin.AUDIO_PLAYER)
!         plugin.register(xine, plugin.AUDIOCD_PLAYER)
  
  
--- 118,122 ----
  
          # register it as the object to play
!         plugin.register(xine, plugin.AUDIO_PLAYER, True)
  
  
***************
*** 129,132 ****
--- 129,133 ----
      
      def __init__(self, version):
+         self.name = 'xine'
          self.thread = childapp.ChildThread()
          self.mode = None
***************
*** 139,142 ****
--- 140,153 ----
  
          
+     def rate(self, item):
+         """
+         How good can this player play the file:
+         2 = good
+         1 = possible, but not good
+         0 = unplayable
+         """
+         return 2
+ 
+ 
      def play(self, item, playerGUI):
          """
***************
*** 187,190 ****
--- 198,205 ----
          """
          if event == AUDIO_PLAY_END:
+             if event.arg:
+                 self.stop()
+                 if self.playerGUI.try_next_player():
+                     return True
              event = PLAY_END
  
***************
*** 234,240 ****
          self.elapsed = 0
          self.refresh = refresh
  
      def stopped(self):
!         rc.post_event(AUDIO_PLAY_END)
  
  
--- 249,256 ----
          self.elapsed = 0
          self.refresh = refresh
+         self.stop_reason = 0 # 0 = ok, 1 = error
  
      def stopped(self):
!         rc.post_event(Event(AUDIO_PLAY_END, self.stop_reason))
  
  
***************
*** 246,247 ****
--- 262,269 ----
                  self.refresh()
              self.elapsed = self.item.elapsed
+ 
+ 
+     def stderr_cb(self, line):
+         if line.startswith('Unable to open MRL'):
+             self.stop_reason = 1
+             




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to