Update of /cvsroot/freevo/freevo/src/video
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4025/src/video

Modified Files:
        videoitem.py 
Log Message:
use new Action class for play with alternative player / max cache

Index: videoitem.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/video/videoitem.py,v
retrieving revision 1.154
retrieving revision 1.155
diff -C2 -d -r1.154 -r1.155
*** videoitem.py        18 Dec 2004 18:10:57 -0000      1.154
--- videoitem.py        28 Dec 2004 18:10:37 -0000      1.155
***************
*** 10,13 ****
--- 10,19 ----
  # VideoItems.
  #
+ # TODO: o maybe split this file into file/vcd/dvd or
+ #         move subitem and variant handling to extra file
+ #       o create better 'arg' handling in play
+ #       o maybe xine options?
+ #       o merge tv shows and episode/subtitle info in tv recordings
+ #
  # 
-----------------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
***************
*** 50,54 ****
  
  from gui   import PopupBox, AlertBox, ConfirmBox
! from item  import MediaItem, FileInformation
  from event import *
  
--- 56,60 ----
  
  from gui   import PopupBox, AlertBox, ConfirmBox
! from item  import MediaItem, FileInformation, Action
  from event import *
  
***************
*** 232,236 ****
  
  
!     def _set_next_available_subitem(self):
          """
          select the next available subitem. Loops on each subitem and checks if
--- 238,242 ----
  
  
!     def __set_next_available_subitem(self):
          """
          select the next available subitem. Loops on each subitem and checks if
***************
*** 326,332 ****
              if self.player_rating >= 20:
                  items = [ (self.play, _('Play DVD')),
!                           ( self.dvd_vcd_title_menu, _('DVD title list') ) ]
              else:
!                 items = [ ( self.dvd_vcd_title_menu, _('DVD title list') ),
                            (self.play, _('Play default track')) ]
  
--- 332,338 ----
              if self.player_rating >= 20:
                  items = [ (self.play, _('Play DVD')),
!                           (self.dvd_vcd_title_menu, _('DVD title list')) ]
              else:
!                 items = [ (self.dvd_vcd_title_menu, _('DVD title list')),
                            (self.play, _('Play default track')) ]
  
***************
*** 334,350 ****
              if self.player_rating >= 20:
                  items = [ (self.play, _('Play VCD')),
!                           ( self.dvd_vcd_title_menu, _('VCD title list') ) ]
              else:
!                 items = [ ( self.dvd_vcd_title_menu, _('VCD title list') ),
                            (self.play, _('Play default track')) ]
          else:
!             items = [ (self.play, _('Play')) ]
!             if len(self.possible_player) > 1:
!                 items.append((self.play_alternate,
!                               _('Play with alternate player')))
  
          # Network play can get a larger cache
          if self.network_play:
!             items.append((self.play_max_cache, _('Play with maximum cache')))
  
          # Add the configure stuff (e.g. set audio language)
--- 340,358 ----
              if self.player_rating >= 20:
                  items = [ (self.play, _('Play VCD')),
!                           (self.dvd_vcd_title_menu, _('VCD title list')) ]
              else:
!                 items = [ (self.dvd_vcd_title_menu, _('VCD title list')),
                            (self.play, _('Play default track')) ]
          else:
!             items = []
!             # Add all possible players to the action list
!             for r, player in self.possible_player:
!                 items.append(Action(_('Play with %s') % player.name,
!                                     self.play, player))
  
          # Network play can get a larger cache
          if self.network_play:
!             items.append(Action(_('Play with maximum cache'),
!                                 self.play, '-cache 65536'))
  
          # Add the configure stuff (e.g. set audio language)
***************
*** 416,436 ****
  
  
!     def play_max_cache(self, arg=None, menuw=None):
!         """
!         play and use maximum cache with mplayer
!         """
!         self.play(menuw=menuw, arg='-cache 65536')
! 
! 
!     def play_alternate(self, arg=None, menuw=None):
!         """
!         play and use maximum cache with mplayer
!         """
!         self.play(menuw=menuw, arg=arg, alternateplayer=True)
! 
! 
!     def play(self, arg=None, menuw=None, alternateplayer=False):
          """
!         play the item.
          """
          # set the current_item of the parent to this one
--- 424,431 ----
  
  
!     def play(self, arg=None, menuw=None):
          """
!         Play the item. The argument 'arg' can either be a player or
!         extra mplayer arguments.
          """
          # set the current_item of the parent to this one
***************
*** 459,463 ****
              self.current_subitem  = None
  
!             result = self._set_next_available_subitem()
              if self.current_subitem: # 'result' is always 1 in this case
                  # The media is available now for playing
--- 454,458 ----
              self.current_subitem  = None
  
!             result = self.__set_next_available_subitem()
              if self.current_subitem: # 'result' is always 1 in this case
                  # The media is available now for playing
***************
*** 533,546 ****
              self.possible_player = self._get_possible_player()
  
-         if alternateplayer:
-             self.possible_player.reverse()
- 
          if not self.possible_player:
              return
  
!         self.player_rating, self.player = self.possible_player[0]
!         if self.player_rating < 10:
!             AlertBox(text=_('No player for this item found')).show()
!             return
  
          # put together the mplayer options for this file
--- 528,540 ----
              self.possible_player = self._get_possible_player()
  
          if not self.possible_player:
              return
  
!         if not self.player:
!             # get the best possible player
!             self.player_rating, self.player = self.possible_player[0]
!             if self.player_rating < 10:
!                 AlertBox(text=_('No player for this item found')).show()
!                 return
  
          # put together the mplayer options for this file
***************
*** 548,552 ****
          if not mplayer_options:
              mplayer_options = []
!         if arg:
              mplayer_options += arg.split(' ')
  
--- 542,551 ----
          if not mplayer_options:
              mplayer_options = []
! 
!         if hasattr(arg, 'play'):
!             # arg is a player, use it
!             self.player = arg
!         elif arg:
!             # arg is mplayer options
              mplayer_options += arg.split(' ')
  
***************
*** 593,597 ****
          if self.subitems and not self.variants:
              if event == PLAY_END:
!                 self._set_next_available_subitem()
                  # Loop until we find a subitem which plays without error
                  while self.current_subitem:
--- 592,596 ----
          if self.subitems and not self.variants:
              if event == PLAY_END:
!                 self.__set_next_available_subitem()
                  # Loop until we find a subitem which plays without error
                  while self.current_subitem:
***************
*** 601,605 ****
                          self.last_error_msg = error
                          self.error_in_subitem = 1
!                         self._set_next_available_subitem()
                      else:
                          return True
--- 600,604 ----
                          self.last_error_msg = error
                          self.error_in_subitem = 1
!                         self.__set_next_available_subitem()
                      else:
                          return True



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to