Author: dmeyer
Date: Sun Feb 4 20:30:25 2007
New Revision: 9160
Modified:
trunk/ui/src/video/configure.py
trunk/ui/src/video/player.py
trunk/ui/src/video/videoitem.py
Log:
make it possible to choose a player
Modified: trunk/ui/src/video/configure.py
==============================================================================
--- trunk/ui/src/video/configure.py (original)
+++ trunk/ui/src/video/configure.py Sun Feb 4 20:30:25 2007
@@ -38,16 +38,19 @@
__all__ = [ 'get_items', 'get_menu' ]
+# kaa imports
+import kaa.popcorn
+
# freevo imports
from freevo.ui.menu import *
-def play_movie(item, mplayer_options=None):
+def play_movie(item, **kwargs):
"""
play the movie (again)
"""
item.show_menu(False)
- item.play(mplayer_options=mplayer_options)
+ item.play(**kwargs)
def set_variable(item, variable, value):
@@ -58,12 +61,13 @@
item.get_menustack().back_one_menu()
-def start_chapter(item, mplayer_options):
+def start_chapter(item, chapter):
"""
Handle chapter selection.
"""
item.show_menu(False)
- play_movie(item, mplayer_options)
+ # FIXME: kaa.popcorn syntax
+ play_movie(item, chapter=chapter)
def start_subitem(item, pos):
@@ -134,6 +138,18 @@
item.pushmenu(Menu(_('Chapter Menu'), menu_items))
+def player_selection(item):
+ """
+ Submenu for player selection.
+ """
+ menu_items = []
+ for player in kaa.popcorn.player_names():
+ a = ActionItem(player, item, play_movie)
+ a.parameter(player=player)
+ menu_items.append(a)
+ item.pushmenu(Menu(_('Player Selection'), menu_items))
+
+
def subitem_selection(item):
"""
Submenu for subitem selection.
@@ -184,15 +200,17 @@
if item.info.has_key('subtitles') and len(item.info['subtitles']) > 1:
a = ActionItem(_('Subtitle selection'), item, subtitle_selection)
items.append(a)
- if item.info.has_key('chapters') and item.info['chapters'] > 1:
- a = ActionItem(_('Chapter selection'), item, chapter_selection)
- items.append(a)
+ # FIXME: kaa.popcorn does not understand chapter selection
+ # if item.info.has_key('chapters') and item.info['chapters'] > 1:
+ # a = ActionItem(_('Chapter selection'), item, chapter_selection)
+ # items.append(a)
if item.subitems:
# show subitems as chapter
a = ActionItem(_('Chapter selection'), item, subitem_selection)
items.append(a)
items.append(add_toggle(item, _('deinterlacing'), 'interlaced'))
+ items.append(ActionItem(_('Select player'), item, player_selection))
return items
Modified: trunk/ui/src/video/player.py
==============================================================================
--- trunk/ui/src/video/player.py (original)
+++ trunk/ui/src/video/player.py Sun Feb 4 20:30:25 2007
@@ -63,10 +63,11 @@
self.elapsed_timer = kaa.notifier.WeakTimer(self.elapsed)
- def play(self, item):
+ def play(self, item, player=None):
"""
play an item
"""
+ retry = kaa.notifier.Callback(self.play, item, player)
if not self.status in (STATUS_IDLE, STATUS_STOPPED):
# Already running, stop the current player by sending a STOP
# event. The event will also get to the playlist behind the
@@ -74,7 +75,7 @@
Event(STOP, handler=self.eventhandler).post()
# Now connect to our own 'stop' signal once to repeat this current
# function call without the player playing
- self.signals['stop'].connect_once(self.play, item)
+ self.signals['stop'].connect_once(retry)
return True
if not kaa.notifier.running:
@@ -94,7 +95,7 @@
Event(STOP, handler=blocked['VIDEO'].eventhandler).post()
# Now connect to the 'stop' signal once to repeat this current
# function call without the player playing
- blocked['VIDEO'].signals['stop'].connect_once(self.play, item)
+ blocked['VIDEO'].signals['stop'].connect_once(retry)
return True
if 'AUDIO' in blocked:
# AUDIO is blocked, VIDEO is not. This is most likely the audio
@@ -104,7 +105,7 @@
Event(STOP, handler=blocked['AUDIO'].eventhandler).post()
# Now connect to the 'stop' signal once to repeat this current
# function call without the player playing
- blocked['AUDIO'].signals['stop'].connect_once(self.play, item)
+ blocked['AUDIO'].signals['stop'].connect_once(retry)
return True
# Now pause the current player. On its pause signal this player can
# play again. And on the stop signal of this player (STATUS_IDLE)
@@ -112,7 +113,7 @@
in_progress = blocked['AUDIO'].pause()
if isinstance(in_progress, kaa.notifier.InProgress):
# takes some time, wait
- in_progress.connect(self.play, item).set_ignore_caller_args()
+ in_progress.connect(retry).set_ignore_caller_args()
if in_progress is not False:
# we paused the application, resume on our stop
self.signals['stop'].connect_once(blocked['AUDIO'].resume)
@@ -128,7 +129,7 @@
self.engine.set_item(self.item)
self.status = STATUS_RUNNING
- self.player.open(self.item.url)
+ self.player.open(self.item.url, player=player)
self.player.signals['end'].connect_once(PLAY_END.post, self.item)
self.player.signals['start'].connect_once(PLAY_START.post, self.item)
Modified: trunk/ui/src/video/videoitem.py
==============================================================================
--- trunk/ui/src/video/videoitem.py (original)
+++ trunk/ui/src/video/videoitem.py Sun Feb 4 20:30:25 2007
@@ -334,7 +334,7 @@
self.pushmenu(moviemenu)
- def play(self):
+ def play(self, **kwargs):
"""
Play the item.
"""
@@ -375,7 +375,7 @@
file = self.filename
# call the player to play the item
- videoplayer.play(self)
+ videoplayer.play(self, **kwargs)
def stop(self):
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog