本文整理汇总了Python中pp_medialist.MediaList.index_of_track方法的典型用法代码示例。如果您正苦于以下问题:Python MediaList.index_of_track方法的具体用法?Python MediaList.index_of_track怎么用?Python MediaList.index_of_track使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pp_medialist.MediaList
的用法示例。
在下文中一共展示了MediaList.index_of_track方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
self.medialist.finish()
else:
self.medialist.start()
self._play_selected_track(self.medialist.selected_track())
def _what_next(self):
self._direction='forward'
# user wants to end, wait for any shows or tracks to have ended then end show
if self._end_mediashow_signal==True:
if self.player==None and self.shower==None:
self._end_mediashow_signal=False
self._end('normal',"show ended by user")
else:
pass
#returning from a subshow needing to move onward
elif self._req_next=='do-next':
self._req_next='nil'
self.medialist.next()
self._play_selected_track(self.medialist.selected_track())
#returning from a subshow needing to move backward
elif self._req_next=='do-previous':
self._req_next='nil'
self._direction='backward'
self.medialist.previous()
self._play_selected_track(self.medialist.selected_track())
# user wants to play child
elif self._play_child_signal == True:
self._play_child_signal=False
index = self.medialist.index_of_track('pp-child-show')
if index >=0:
#don't select the track as need to preserve mediashow sequence.
child_track=self.medialist.track(index)
self._display_eggtimer(self.resource('mediashow','m07'))
self._play_selected_track(child_track)
else:
self.mon.err(self,"Child show not found in medialist: "+ self.show['pp-child-show'])
self._end('error',"child show not found in medialist")
# skip to next track on user input
elif self._next_track_signal==True:
self._next_track_signal=False
if self.medialist.at_end()==True:
if self.show['sequence']=="ordered" and self.show['repeat']=='oneshot' and self.top==False:
self._end('do-next',"Return from Sub Show")
else:
self.medialist.next()
self._play_selected_track(self.medialist.selected_track())
else:
self.medialist.next()
self._play_selected_track(self.medialist.selected_track())
# skip to previous track on user input
elif self._previous_track_signal==True:
self._previous_track_signal=False
self._direction='backward'
if self.medialist.at_start()==True:
if self.show['sequence']=="ordered" and self.show['repeat']=='oneshot' and self.top==False:
self._end('do-previous',"Return from Sub Show")
else:
self.medialist.previous()
self._play_selected_track(self.medialist.selected_track())
示例2: MenuShow
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
self.menu_index += 1
# and highlight the new entry
self.current_player.highlight_menu_entry(self.menu_index, True)
def previous(self):
# remove highlight
if self.current_player.__class__.__name__ == "MenuPlayer":
self.current_player.highlight_menu_entry(self.menu_index, False)
if self.menu_index == 0:
self.menu_index = self.menu_length - 1
else:
self.menu_index -= 1
self.medialist.previous("ordered")
# and highlight the new entry
self.current_player.highlight_menu_entry(self.menu_index, True)
# *********************
# Sequencing
# *********************
def track_timeout_callback(self):
self.do_operation("stop")
def do_menu_track(self):
self.menu_showing = True
self.mon.trace(self, "")
# start show timeout alarm if required
if self.show_timeout != 0:
self.show_timeout_timer = self.canvas.after(self.show_timeout * 1000, self.show_timeout_stop)
# init the index used to hiighlight the selected menu entry by menuplayer
self.menu_index = 0
index = self.medialist.index_of_track(self.show_params["menu-track-ref"])
if index == -1:
self.mon.err(self, "'menu-track' not in medialist: " + self.show_params["menu-track-ref"])
self.end("error", "menu-track not in medialist: ")
return
# make the medialist available to the menuplayer for cursor scrolling
self.show_params["medialist_obj"] = self.medialist
# load the menu track
self.start_load_show_loop(self.medialist.track(index))
# *********************
# Playing show or track loop
# *********************
def start_load_show_loop(self, selected_track):
# shuffle players
Show.base_shuffle(self)
self.mon.trace(self, "")
self.display_eggtimer()
# get control bindings for this show
# needs to be done for each track as track can override the show controls
if self.show_params["disable-controls"] == "yes":
self.controls_list = []
else:
reason, message, self.controls_list = self.controlsmanager.get_controls(self.show_params["controls"])
if reason == "error":
self.mon.err(self, message)
self.end("error", "error in controls")
return
示例3: HyperlinkShow
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
def decode_jump(self,to):
self.mon.log(self,'jump to: '+to)
self.next_track_signal=True
self.next_track_op='jump'
self.next_track_arg=to
def decode_repeat(self):
self.mon.log(self,'repeat: ')
self.next_track_signal=True
self.next_track_op='repeat'
def decode_return(self,to):
self.next_track_signal=True
if to.isdigit() or to == '':
self.mon.log(self,'hyperlink command - return by: '+to)
self.next_track_op='return-by'
if to == '':
self.next_track_arg='1'
else:
self.next_track_arg=to
else:
self.mon.log(self,'hyperlink command - return to: '+to)
self.next_track_op='return-to'
self.next_track_arg=to
def decode_home(self):
self.mon.log(self,'hyperlink command - home')
self.next_track_signal=True
self.next_track_op='home'
def do_first_track(self):
index = self.medialist.index_of_track(self.first_track_ref)
if index >=0:
self.continue_timeout=False
# don't use select the track as not using selected_track in hyperlinkshow
first_track=self.medialist.track(index)
self.current_track_ref=first_track['track-ref']
self.path.append(first_track['track-ref'])
if self.debug: print 'First Track: ' + first_track['track-ref']+self.path.pretty_path()
self.start_load_show_loop(first_track)
else:
self.mon.err(self,"first-track not found in medialist: "+ self.show_params['first-track-ref'])
self.end('error',"first track not found in medialist: "+ self.show_params['first-track-ref'])
def start_load_show_loop(self,selected_track):
# shuffle players
Show.base_shuffle(self)
self.mon.trace(self, '')
self.display_eggtimer()
# start the show timer when displaying the first track
if self.current_track_ref == self.first_track_ref:
if self.show_timeout_timer is not None:
self.canvas.after_cancel(self.show_timeout_timer)
self.show_timeout_timer=None
if self.show_timeout != 0:
self.show_timeout_timer=self.canvas.after(self.show_timeout*1000 ,self.show_timeout_stop)
# start timeout for the track if required ???? differnet to radiobuttonshow
示例4: RadioButtonShow
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
def track_timeout_callback(self):
self.do_play(self.first_track_ref)
def do_play(self,track_ref):
# if track_ref != self.current_track_ref:
# cancel the show timeout when playing another track
if self.show_timeout_timer is not None:
self.canvas.after_cancel(self.show_timeout_timer)
self.show_timeout_timer=None
# print '\n NEED NEXT TRACK'
self.next_track_signal=True
self.next_track_op='play'
self.next_track_arg=track_ref
if self.shower is not None:
# print 'current_shower not none so stopping',self.mon.id(self.current_shower)
self.shower.do_operation('stop')
elif self.current_player is not None:
# print 'current_player not none so stopping',self.mon.id(self.current_player), ' for' ,track_ref
self.current_player.input_pressed('stop')
else:
return
def do_first_track(self):
# get first-track from profile
self.first_track_ref=self.show_params['first-track-ref']
if self.first_track_ref=='':
self.mon.err(self,"first-track is blank: ")
self.end('error',"first track is blank: " )
# find the track-ref in the medialisst
index = self.medialist.index_of_track(self.first_track_ref)
if index >=0:
# don't use select the track as not using selected_track in radiobuttonshow
self.current_track_ref=self.first_track_ref
# start the show timer when displaying the first track
if self.show_timeout_timer is not None:
self.canvas.after_cancel(self.show_timeout_timer)
self.show_timeout_timer=None
if self.show_timeout != 0:
self.show_timeout_timer=self.canvas.after(self.show_timeout*1000 ,self.show_timeout_stop)
# print 'do first track',self.current_track_ref
# and load it
self.start_load_show_loop(self.medialist.track(index))
else:
self.mon.err(self,"first-track not found in medialist: "+ self.show_params['first-track-ref'])
self.end('error',"first track not found in medialist: " + self.show_params['first-track-ref'])
# *********************
# Playing show or track
# *********************
def start_load_show_loop(self,selected_track):
# shuffle players
Show.base_shuffle(self)
# print '\nSHUFFLED previous is', self.mon.id(self.previous_player)
self.mon.trace(self,'')
self.display_eggtimer()
if self.track_timeout_timer is not None:
self.canvas.after_cancel(self.track_timeout_timer)
self.track_timeout_timer=None
示例5: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
if self._livelist_index== len(self._livelist)-1:
self._livelist_index=0
else:
self._livelist_index +=1
# ***************************
# Play Loop
# ***************************
def _play_first_track(self):
self._new_livelist_create()
self._livelist = copy.deepcopy(self._new_livelist)
self._livelist_index = 0
self._play_track()
def _play_track(self):
self._livelist_replace_if_changed()
if len(self._livelist)>0:
self._play_selected_track(self._livelist[self._livelist_index])
else:
self.display_message(self.canvas,None,self.resource('liveshow','m01'),5,self._what_next)
def _what_next(self):
# user wants to end
if self._end_liveshow_signal==True:
self._end_liveshow_signal=False
self._end('normal',"show ended by user")
# play child?
elif self._play_child_signal == True:
self._play_child_signal=False
index = self.medialist.index_of_track('pp-child-show')
if index >=0:
#don't select the track as need to preserve mediashow sequence.
child_track=self.medialist.track(index)
self._display_eggtimer(self.resource('liveshow','m02'))
self._play_selected_track(child_track)
else:
self.mon.err(self,"Child show not found in medialist: "+ self.show['pp-child-show'])
self._end('error',"child show not found in medialist")
# otherwise loop to next track
else:
self._livelist_next()
self._play_track()
# ***************************
# Dispatching to Players/Shows
# ***************************
# used to display internal messages in situations where a medialist entry could not be used.
def display_message(self,canvas,source,content,duration,_display_message_callback):
self._display_message_callback=_display_message_callback
tp={'duration':duration,'message-colour':'white','message-font':'Helvetica 20 bold'}
self.player=MessagePlayer(canvas,tp,tp)
self.player.play(content,self._display_message_end,None)
def _display_message_end(self,reason,message):
self.player=None
if reason in ("killed",'error'):
self._end(reason,message)
else:
示例6: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
class MenuShow:
""" Displays a menu with optional hint below it. User can traverse the menu and
select a track using key or button presses.
Interface:
* play - displays the menu and selects the first entry
* input_pressed, - receives user events passes them to a Player if a track is playing,
otherwise actions them with _next, _previous, _play_selected_track, _end
Optional display of eggtimer by means of Players ready_callback
Supports imageplayer, videoplayer,messagplayer,audioplayer,menushow,mediashow
Destroys itself on exit
"""
# *********************
# external interface
# ********************
def __init__(self,
show_params,
root,
canvas,
showlist,
pp_dir,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the name of the configuration dictionary section for the menu
showlist - the showlist
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory"""
self.mon=Monitor()
self.mon.on()
self.display_guidelines_command=show_params['menu-guidelines']
self.display_guidelines=self.display_guidelines_command
#instantiate arguments
self.show_params=show_params
self.root=root
self.canvas=canvas
self.showlist=showlist
self.pp_dir=pp_dir
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# init variables
self.drawn = None
self.player=None
self.shower=None
self.menu_timeout_running=None
self.error=False
def play(self,show_id,end_callback,ready_callback,top=False,command='nil'):
""" displays the menu
end_callback - function to be called when the menu exits
ready_callback - callback when menu is ready to display (not used)
top is True when the show is top level (run from [start])
"""
#instantiate arguments
self.show_id=show_id
self.end_callback=end_callback
self.ready_callback=ready_callback
self.top=top
self.command=command
# check data files are available.
self.menu_file = self.pp_profile + "/" + self.show_params['medialist']
if not os.path.exists(self.menu_file):
self.mon.err(self,"Medialist file not found: "+ self.menu_file)
self.end('error',"Medialist file not found")
#create a medialist for the menu and read it.
self.medialist=MediaList()
if self.medialist.open_list(self.menu_file,self.showlist.sissue()) == False:
self.mon.err(self,"Version of medialist different to Pi Presents")
self.end('error',"Version of medialist different to Pi Presents")
#get control bindings for this show if top level
controlsmanager=ControlsManager()
if self.top==True:
self.controls_list=controlsmanager.default_controls()
# and merge in controls from profile
self.controls_list=controlsmanager.merge_show_controls(self.controls_list,self.show_params['controls'])
if self.show_params['has-background']=="yes":
background_index=self.medialist.index_of_track ('pp-menu-background')
if background_index>=0:
self.menu_img_file = self.complete_path(self.medialist.track(background_index)['location'])
if not os.path.exists(self.menu_img_file):
self.mon.err(self,"Menu background file not found: "+ self.menu_img_file)
self.end('error',"Menu background file not found")
#.........这里部分代码省略.........
示例7: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
def play_track(self):
self.livelist_replace_if_changed()
if len(self.livelist)>0:
self.play_selected_track(self.livelist[self.livelist_index])
else:
self.display_message(self.canvas,None,self.resource('liveshow','m01'),5,self.what_next)
def what_next(self):
# end of show time trigger
if self.end_trigger_signal==True:
self.end_trigger_signal=False
if self.top==True:
self.state='waiting'
self.wait_for_trigger()
else:
# not at top so stop the show
self.end('normal','sub-show end time trigger')
# user wants to end
elif self.end_liveshow_signal==True:
self.end_liveshow_signal=False
self.end('normal',"show ended by user")
# play child?
elif self.play_child_signal == True:
self.play_child_signal=False
index = self.medialist.index_of_track('pp-child-show')
if index >=0:
#don't select the track as need to preserve mediashow sequence.
child_track=self.medialist.track(index)
self.display_eggtimer(self.resource('liveshow','m02'))
self.play_selected_track(child_track)
else:
self.mon.err(self,"Child show not found in medialist: "+ self.show_params['pp-child-show'])
self.end('error',"child show not found in medialist")
# otherwise loop to next track
else:
self.livelist_next()
self.play_track()
# ***************************
# Dispatching to Players/Shows
# ***************************
def ready_callback(self):
self.delete_eggtimer()
def play_selected_track(self,selected_track):
""" selects the appropriate player from type field of the medialist and computes
the parameters for that type
selected_track is a dictionary for the track/show
"""
self.canvas.delete('pp-content')
# is menu required
if self.show_params['has-child']=="yes":
enable_child=True
示例8: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
if self.end_trigger_signal==True:
self.end_trigger_signal=False
if self.top==True:
self.state='waiting'
self.wait_for_trigger()
else:
# not at top so stop the show
self.end('normal','sub-show end time trigger')
# user wants to end, wait for any shows or tracks to have ended then end show
# probalby will get here with end_m set when player and shower has finished
elif self.end_mediashow_signal==True:
if self.player==None and self.shower==None:
self.end_mediashow_signal=False
self.end('normal',"show ended by user")
#returning from a subshow needing to move onward
elif self.req_next=='do-next':
self.req_next='nil'
self.medialist.next(self.show_params['sequence'])
self.play_selected_track(self.medialist.selected_track())
#returning from a subshow needing to move backward
elif self.req_next=='do-previous':
self.req_next='nil'
self.direction='backward'
self.medialist.previous(self.show_params['sequence'])
self.play_selected_track(self.medialist.selected_track())
# user wants to play child
elif self.play_child_signal == True:
self.play_child_signal=False
index = self.medialist.index_of_track(self.child_track_ref)
if index >=0:
#don't use select the track as need to preserve mediashow sequence.
child_track=self.medialist.track(index)
self.display_eggtimer(self.resource('mediashow','m07'))
self.play_selected_track(child_track)
else:
self.mon.err(self,"Child show not found in medialist: "+ self.show_params['pp-child-show'])
self.end('error',"child show not found in medialist")
# skip to next track on user input
elif self.next_track_signal==True:
self.next_track_signal=False
if self.medialist.at_end()==True:
if self.show_params['sequence']=="ordered" and self.show_params['repeat']=='oneshot' and self.top==False:
self.end('do-next',"Return from Sub Show")
elif self.show_params['sequence']=="ordered" and self.show_params['repeat']=='single-run' and self.top==False:
self.end('do-next',"Return from Sub Show")
else:
self.medialist.next(self.show_params['sequence'])
self.play_selected_track(self.medialist.selected_track())
else:
self.medialist.next(self.show_params['sequence'])
self.play_selected_track(self.medialist.selected_track())
# skip to previous track on user input
elif self.previous_track_signal==True:
self.previous_track_signal=False
self.direction='backward'
if self.medialist.at_start()==True:
if self.show_params['sequence']=="ordered" and self.show_params['repeat']=='oneshot' and self.top==False:
self.end('do-previous',"Return from Sub Show")
elif self.show_params['sequence']=="ordered" and self.show_params['repeat']=='single-run' and self.top==False:
示例9: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
self.do_play(link[2],edge,source)
return found
# *********************
# INTERNAL FUNCTIONS
# ********************
# *********************
# Show Sequencer
# *********************
def timeout_callback(self):
self.do_play(self.first_track_ref,'front','timeout')
def do_play(self,track_ref,edge,source):
if track_ref<>self.current_track_ref:
# print 'executing play ',track_ref
self.next_track_signal=True
self.next_track_op='play'
self.next_track_arg=track_ref
if self.shower<>None:
self.shower.input_pressed('stop',edge,source)
elif self.player<>None:
self.player.input_pressed('stop')
else:
self.what_next()
def do_first_track(self):
index = self.medialist.index_of_track(self.first_track_ref)
if index >=0:
#don't use select the track as not using selected_track in radiobuttonshow
first_track=self.medialist.track(index)
self.path.append(first_track['track-ref'])
self.current_track_ref=self.first_track_ref
self.play_selected_track(first_track)
else:
self.mon.err(self,"first-track not found in medialist: "+ self.show_params['first-frack-ref'])
self.end('error',"first track not found in medialist")
def what_next(self):
# user wants to end the show
if self.end_radiobuttonshow_signal==True:
self.end_radiobuttonshow_signal=False
self.end('normal',"show ended by user")
# user has selected another track
elif self.next_track_signal==True:
self.next_track_signal=False
self.next_track_ref=self.next_track_arg
self.current_track_ref=self.next_track_ref
index = self.medialist.index_of_track(self.next_track_ref)
if index >=0:
#don't use select the track as not using selected_track in radiobuttonshow
next_track=self.medialist.track(index)
self.play_selected_track(next_track)
else:
self.mon.err(self,"next-track not found in medialist: "+ self.next_track_ref)
self.end('error',"next track not found in medialist")
示例10: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
class MenuShow:
""" Displays a menu with optional hint below it. User can traverse the menu and
select a track using key or button presses.
Interface:
* play - displays the menu and selects the first entry
* key_pressed, button_pressed - receives user events passes them to a Player if a track is playing,
otherwise actions them with _next, _previous, _play_selected_track, _end
Optional display of eggtimer by means of Players ready_callback
Supports imageplayer, videoplayer,messagplayer,audioplayer,menushow,mediashow
Destroys itself on exit
"""
# *********************
# external interface
# ********************
def __init__(self,
show_params,
canvas,
showlist,
pp_home,
pp_profile):
""" canvas - the canvas that the menu is to be written on
show - the name of the configuration dictionary section for the menu
showlist - the showlist
pp_home - Pi presents data_home directory
pp_profile - Pi presents profile directory"""
self.mon=Monitor()
self.mon.on()
#instantiate arguments
self.show_params=show_params
self.showlist=showlist
self.canvas=canvas
self.pp_home=pp_home
self.pp_profile=pp_profile
# open resources
self.rr=ResourceReader()
# init variables
self.drawn = None
self.player=None
self.shower=None
self.menu_timeout_running=None
self.error=False
def play(self,show_id,end_callback,ready_callback=None,top=False,command='nil'):
""" displays the menu
end_callback - function to be called when the menu exits
ready_callback - callback when menu is ready to display (not used)
top is True when the show is top level (run from [start])
"""
#instantiate arguments
self.show_id=show_id
self.end_callback=end_callback
self.ready_callback=ready_callback
self.top=top
self.command=command
# check data files are available.
self.menu_file = self.pp_profile + "/" + self.show_params['medialist']
if not os.path.exists(self.menu_file):
self.mon.err(self,"Medialist file not found: "+ self.menu_file)
self._end('error',"Medialist file not found")
#create a medialist for the menu and read it.
self.medialist=MediaList()
if self.medialist.open_list(self.menu_file,self.showlist.sissue()) == False:
self.mon.err(self,"Version of medialist different to Pi Presents")
self._end('error',"Version of medialist different to Pi Presents")
if self.show_params['has-background']=="yes":
background_index=self.medialist.index_of_track ('pp-menu-background')
if background_index>=0:
self.menu_img_file = self.complete_path(self.medialist.track(background_index))
if not os.path.exists(self.menu_img_file):
self.mon.err(self,"Menu background file not found: "+ self.menu_img_file)
self._end('error',"Menu background file not found")
else:
self.mon.err(self,"Menu background not found in medialist")
self._end('error',"Menu background not found")
self.egg_timer=None
#start timeout alarm if required
if int(self.show_params['timeout'])<>0:
self.menu_timeout_running=self.canvas.after(int(self.show_params['timeout'])*1000,self._timeout_menu)
if self.ready_callback<>None:
self.ready_callback()
self.canvas.delete(ALL)
# display background image
if self.show_params['has-background']=="yes":
#.........这里部分代码省略.........
示例11: __init__
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
if self._end_trigger_signal == True:
self._end_trigger_signal = False
if self.top == True:
self._state = "waiting"
self._wait_for_trigger()
else:
# not at top so stop the show
self._end("normal", "sub-show end time trigger")
# user wants to end, wait for any shows or tracks to have ended then end show
elif self._end_mediashow_signal == True:
if self.player == None and self.shower == None:
self._end_mediashow_signal = False
self._end("normal", "show ended by user")
else:
pass
# returning from a subshow needing to move onward
elif self._req_next == "do-next":
self._req_next = "nil"
self.medialist.next(self.show_params["sequence"])
self._play_selected_track(self.medialist.selected_track())
# returning from a subshow needing to move backward
elif self._req_next == "do-previous":
self._req_next = "nil"
self._direction = "backward"
self.medialist.previous(self.show_params["sequence"])
self._play_selected_track(self.medialist.selected_track())
# user wants to play child
elif self._play_child_signal == True:
self._play_child_signal = False
index = self.medialist.index_of_track("pp-child-show")
if index >= 0:
# don't select the track as need to preserve mediashow sequence.
child_track = self.medialist.track(index)
self._display_eggtimer(self.resource("mediashow", "m07"))
self._play_selected_track(child_track)
else:
self.mon.err(self, "Child show not found in medialist: " + self.show_params["pp-child-show"])
self._end("error", "child show not found in medialist")
# skip to next track on user input
elif self._next_track_signal == True:
self._next_track_signal = False
if self.medialist.at_end() == True:
if (
self.show_params["sequence"] == "ordered"
and self.show_params["repeat"] == "oneshot"
and self.top == False
):
self._end("do-next", "Return from Sub Show")
else:
self.medialist.next(self.show_params["sequence"])
self._play_selected_track(self.medialist.selected_track())
else:
self.medialist.next(self.show_params["sequence"])
self._play_selected_track(self.medialist.selected_track())
# skip to previous track on user input
elif self._previous_track_signal == True:
self._previous_track_signal = False
self._direction = "backward"
if self.medialist.at_start() == True:
if (
示例12: tracks
# 需要导入模块: from pp_medialist import MediaList [as 别名]
# 或者: from pp_medialist.MediaList import index_of_track [as 别名]
#.........这里部分代码省略.........
self.next_track_signal=True
if to.isdigit() or to=='':
self.mon.log(self,'hyperlink command - return by: '+to)
self.next_track_op='return-by'
if to == '':
self.next_track_arg='1'
else:
self.next_track_arg=to
else:
self.mon.log(self,'hyperlink command - return to: '+to)
self.next_track_op='return-to'
self.next_track_arg=to
if self.shower<>None:
self.shower.input_pressed('stop',edge,source)
elif self.player<>None:
self.player.input_pressed('stop')
else:
self.what_next()
def do_home(self,edge,source):
if self.current_track_ref<>self.home_track_ref:
self.mon.log(self,'hyperlink command - home')
self.next_track_signal=True
self.next_track_op='home'
if self.shower<>None:
self.shower.input_pressed('stop',edge,source)
elif self.player<>None:
self.player.input_pressed('stop')
else:
self.what_next()
def do_first_track(self):
index = self.medialist.index_of_track(self.first_track_ref)
if index >=0:
#don't use select the track as not using selected_track in hyperlinkshow
first_track=self.medialist.track(index)
self.current_track_ref=first_track['track-ref']
self.path.append(first_track['track-ref'])
self.play_selected_track(first_track)
else:
self.mon.err(self,"first-track not found in medialist: "+ self.show_params['first-track-ref'])
self.end('error',"first track not found in medialist")
def what_next(self):
# user wants to end the show
if self.end_hyperlinkshow_signal==True:
self.end_hyperlinkshow_signal=False
self.end('normal',"show ended by user")
# user has selected another track
elif self.next_track_signal==True:
self.next_track_signal=False
# home
if self.next_track_op in ('home'):
# back to 1 before home
back_ref=self.path.back_to(self.home_track_ref)
if back_ref=='':
self.mon.err(self,"home - home track not in path: "+self.home_track_ref)
self.end('error',"home - home track not in path")
# play home
self.next_track_ref=self.home_track_ref