Update of /cvsroot/freevo/freevo/src/video In directory sc8-pr-cvs1:/tmp/cvs-serv11589
Modified Files: fxdhandler.py videoitem.py Log Message: patch for better support of fxd files with more discs from Matthieu Weber Index: fxdhandler.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/fxdhandler.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** fxdhandler.py 9 Dec 2003 19:43:01 -0000 1.6 --- fxdhandler.py 22 Dec 2003 13:27:34 -0000 1.7 *************** *** 10,13 **** --- 10,16 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.7 2003/12/22 13:27:34 dischi + # patch for better support of fxd files with more discs from Matthieu Weber + # # Revision 1.6 2003/12/09 19:43:01 dischi # patch from Matthieu Weber *************** *** 62,71 **** <variants> <variant> ! <part ref mplayer_options/> ! <subtitle media_id>file</subtitle> ! <audio media_id>file</audio> ! </variant> </variants> ! <info> </movie> """ --- 65,75 ---- <variants> <variant> ! <part ref mplayer_options> ! <subtitle media_id>file</subtitle> ! <audio media_id>file</audio> ! </part>+ ! </variant>+ </variants> ! <info/> </movie> """ *************** *** 77,82 **** filename = fxd.gettext(node) media_id = fxd.getattr(node, 'media-id') - if media_id == '': - filename = vfs.join(dirname, filename) mode = node.name id = fxd.getattr(node, 'id') --- 81,84 ---- *************** *** 91,95 **** if mode == 'file': ! filename = vfs.join(dirname, filename) # mark the files we include in the fxd in _fxd_covered_ --- 93,98 ---- if mode == 'file': ! if not media_id: ! filename = vfs.join(dirname, filename) # mark the files we include in the fxd in _fxd_covered_ *************** *** 153,157 **** audio = { 'media_id': fxd.getattr(audio[0], 'media-id'), 'file' : fxd.gettext(audio[0]) } ! if audio['media_id'] == '': audio['file'] = vfs.join(dirname, audio['file']) else: --- 156,160 ---- audio = { 'media_id': fxd.getattr(audio[0], 'media-id'), 'file' : fxd.gettext(audio[0]) } ! if not audio['media_id']: audio['file'] = vfs.join(dirname, audio['file']) else: *************** *** 163,167 **** subtitle = { 'media_id': fxd.getattr(subtitle[0], 'media-id'), 'file' : fxd.gettext(subtitle[0]) } ! if subtitle['media_id'] == '': subtitle['file'] = vfs.join(dirname, subtitle['file']) else: --- 166,170 ---- subtitle = { 'media_id': fxd.getattr(subtitle[0], 'media-id'), 'file' : fxd.gettext(subtitle[0]) } ! if not subtitle['media_id']: subtitle['file'] = vfs.join(dirname, subtitle['file']) else: *************** *** 183,187 **** audio = { 'media_id': fxd.getattr(audio[0], 'media-id'), 'file' : fxd.gettext(audio[0]) } ! if audio['media_id'] == '': audio['file'] = vfs.join(dirname, audio['file']) else: --- 186,190 ---- audio = { 'media_id': fxd.getattr(audio[0], 'media-id'), 'file' : fxd.gettext(audio[0]) } ! if not audio['media_id']: audio['file'] = vfs.join(dirname, audio['file']) else: *************** *** 191,195 **** subtitle = { 'media_id': fxd.getattr(subtitle[0], 'media-id'), 'file' : fxd.gettext(subtitle[0]) } ! if subtitle['media_id'] == '': subtitle['file'] = vfs.join(dirname, subtitle['file']) else: --- 194,198 ---- subtitle = { 'media_id': fxd.getattr(subtitle[0], 'media-id'), 'file' : fxd.gettext(subtitle[0]) } ! if not subtitle['media_id']: subtitle['file'] = vfs.join(dirname, subtitle['file']) else: Index: videoitem.py =================================================================== RCS file: /cvsroot/freevo/freevo/src/video/videoitem.py,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** videoitem.py 9 Dec 2003 19:43:01 -0000 1.101 --- videoitem.py 22 Dec 2003 13:27:34 -0000 1.102 *************** *** 11,14 **** --- 11,17 ---- # ----------------------------------------------------------------------- # $Log$ + # Revision 1.102 2003/12/22 13:27:34 dischi + # patch for better support of fxd files with more discs from Matthieu Weber + # # Revision 1.101 2003/12/09 19:43:01 dischi # patch from Matthieu Weber *************** *** 392,396 **** self.play(menuw=menuw, arg='-cache 65536') ! def play(self, arg=None, menuw=None): """ --- 395,445 ---- self.play(menuw=menuw, arg='-cache 65536') ! ! def set_next_available_subitem(self): ! """ ! select the next available subitem. Loops on each subitem and checks if ! the needed media is really there. ! If the media is there, sets self.current_subitem to the given subitem ! and returns 1. ! If no media has been found, we set self.current_subitem to None. ! If the search for the next available subitem did start from the ! beginning of the list, then we consider that no media at all was ! available for any subitem: we return 0. ! If the search for the next available subitem did not start from the ! beginning of the list, then we consider that at least one media ! had been found in the past: we return 1. ! """ ! cont = 1 ! from_start = 0 ! si = self.current_subitem ! while cont: ! if not si: ! # No subitem selected yet: take the first one ! si = self.subitems[0] ! from_start = 1 ! else: ! pos = self.subitems.index(si) ! # Else take the next one ! if pos < len(self.subitems)-1: ! # Let's get the next subitem ! si = self.subitems[pos+1] ! else: ! # No next subitem ! si = None ! cont = 0 ! if si: ! if (si.media_id or si.media): ! # If the file is on a removeable media ! if util.check_media(si.media_id): ! self.current_subitem = si ! return 1 ! else: ! # if not, it is always available ! self.current_subitem = si ! return 1 ! self.current_subitem = None ! return not from_start ! ! def play(self, arg=None, menuw=None): """ *************** *** 398,402 **** """ self.scan() ! self.player_rating, self.player = self.possible_player[0] self.parent.current_item = self --- 447,451 ---- """ self.scan() ! self.player_rating, self.player = self.possible_player[0] self.parent.current_item = self *************** *** 411,438 **** # if we have subitems (a movie with more than one file), ! # we start playing the first if self.subitems: ! self.current_subitem = self.subitems[0] ! # Pass along the options, without loosing the subitem's own ! # options ! if self.current_subitem.mplayer_options: ! if self.mplayer_options: ! self.current_subitem.mplayer_options += ' ' + self.mplayer_options ! else: ! self.current_subitem.mplayer_options = self.mplayer_options ! # When playing a subitem, the menu must be hidden. If it is not, ! # the playing will stop after the first subitem, since the ! # PLAY_END/USER_END event is not forwarded to the parent ! # videoitem. ! # And besides, we don't need the menu between two subitems. ! self.menuw.hide() ! self.current_subitem.play(arg, self.menuw) return - # normal plackback of one file if self.mode == "file": file = self.filename - if self.media_id: mountdir, file = util.resolve_media_mountdir(self.media_id,file) --- 460,500 ---- # if we have subitems (a movie with more than one file), ! # we start playing the first that is physically available if self.subitems: ! self.error_in_subitem = 0 ! self.last_error_msg = '' ! result = self.set_next_available_subitem() ! if self.current_subitem: # 'result' is always 1 in this case ! # The media is available now for playing ! # Pass along the options, without loosing the subitem's own ! # options ! if self.current_subitem.mplayer_options: ! if self.mplayer_options: ! self.current_subitem.mplayer_options += ' ' + self.mplayer_options ! else: ! self.current_subitem.mplayer_options = self.mplayer_options ! # When playing a subitem, the menu must be hidden. If it is not, ! # the playing will stop after the first subitem, since the ! # PLAY_END/USER_END event is not forwarded to the parent ! # videoitem. ! # And besides, we don't need the menu between two subitems. ! self.menuw.hide() ! self.last_error_msg = self.current_subitem.play(arg, self.menuw) ! if self.last_error_msg: ! self.error_in_subitem = 1 ! # Go to the next playable subitem, using the loop in ! # eventhandler() ! self.eventhandler(PLAY_END) ! ! elif not result: ! # No media at all was found: error ! ConfirmBox(text=(_('No media found for "%s".\n')+ ! _('Please insert the media.')) % ! self.name, handler=self.play ).show() return # normal plackback of one file if self.mode == "file": file = self.filename if self.media_id: mountdir, file = util.resolve_media_mountdir(self.media_id,file) *************** *** 440,443 **** --- 502,506 ---- util.mount(mountdir) else: + self.menuw.show() ConfirmBox(text=(_('Media not found for file "%s".\n')+ _('Please insert the media.')) % file, *************** *** 454,457 **** --- 517,521 ---- self.media = media else: + self.menuw.show() ConfirmBox(text=(_('Media not not found for "%s".\n')+ _('Please insert the media.')) % self.url, *************** *** 463,472 **** return ! mplayer_options = self.mplayer_options if not mplayer_options: ! mplayer_options = "" if arg: ! mplayer_options += ' %s' % arg if self.menuw.visible: --- 527,536 ---- return ! mplayer_options = self.mplayer_options.split(' ') if not mplayer_options: ! mplayer_options = [] if arg: ! mplayer_options += arg.split[' '] if self.menuw.visible: *************** *** 474,483 **** self.plugin_eventhandler(PLAY, menuw) ! error = self.player.play(mplayer_options, self) if error: ! AlertBox(text=error).show() ! rc.post_event(PLAY_END) --- 538,552 ---- self.plugin_eventhandler(PLAY, menuw) ! error = self.player.play(mplayer_options, self) if error: ! # If we are a subitem we don't show any error message before ! # having tried all the subitems ! if self.parent.subitems: ! return error ! else: ! AlertBox(text=error).show() ! rc.post_event(PLAY_END) *************** *** 541,556 **** return True ! # PLAY_END: do have have to play another file? if self.subitems: if event == PLAY_END: ! try: ! pos = self.subitems.index(self.current_subitem) ! if pos < len(self.subitems)-1: ! self.current_subitem = self.subitems[pos+1] ! _debug_('playing next item') ! self.current_subitem.play(menuw=menuw) return True ! except: ! pass elif event == USER_END: pass --- 610,632 ---- return True ! # PLAY_END: do we have to play another file? if self.subitems: if event == PLAY_END: ! self.set_next_available_subitem() ! # Loop untli we find a subitem which plays without error ! while self.current_subitem: ! _debug_('playing next item') ! error = self.current_subitem.play(menuw=menuw) ! if error: ! self.last_error_msg = error ! self.error_in_subitem = 1 ! self.set_next_available_subitem() ! else: return True ! if self.error_in_subitem: ! # No more subitems to play, and an error occured ! self.menuw.show() ! AlertBox(text=self.last_error_msg).show() ! elif event == USER_END: pass ------------------------------------------------------- This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click _______________________________________________ Freevo-cvslog mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/freevo-cvslog