def end(self, reason, message): Show.delete_admin_message(self) self.base_withdraw_show_background() self.base_delete_show_background() self.mon.log(self, "Ending Artshow: " + self.show_params['show-ref']) self.end_callback(self.show_id, reason, message) self = None
def handle_input_event_this_show(self, symbol): # check symbol against mediashow triggers if self.state == 'waiting' and self.show_params[ 'trigger-start-type'] in ( 'input', 'input-persist' ) and symbol == self.show_params['trigger-start-param']: self.mon.stats(self.show_params['type'], self.show_params['show-ref'], self.show_params['title'], 'start trigger', '', '', '') Show.delete_admin_message(self) self.start_list() elif self.state == 'playing' and self.show_params[ 'trigger-end-type'] == 'input' and symbol == self.show_params[ 'trigger-end-param']: self.end_trigger_signal = True if self.shower is not None: self.shower.do_operation('stop') elif self.current_player is not None: self.current_player.input_pressed('stop') elif self.state == 'playing' and self.show_params[ 'trigger-next-type'] == 'input' and symbol == self.show_params[ 'trigger-next-param']: self.mon.stats(self.show_params['type'], self.show_params['show-ref'], self.show_params['title'], 'next trigger', '', '', '') self.next() else: # event is not a trigger so must be internal operation operation = self.base_lookup_control(symbol, self.controls_list) if operation != '': self.do_operation(operation)
def wait_for_not_empty(self): if self.medialist.display_length()==0: # list is empty retry after 5 secs self.canvas.after(5000,self.wait_for_not_empty) else: Show.delete_admin_message(self) self.not_empty()
def wait_for_not_empty(self): if self.medialist.display_length() == 0: # list is empty retry after 5 secs self.canvas.after(5000, self.wait_for_not_empty) else: Show.delete_admin_message(self) self.not_empty()
def do_operation(self, operation): # print 'do_operation ',operation self.mon.trace(self, operation) if operation == 'exit': self.exit() elif operation == 'stop': if self.level != 0: # not at top so stop the show self.user_stop_signal = True # and stop the track first if self.current_player is not None: self.current_player.input_pressed('stop') else: # at top, just stop track if running if self.current_player is not None: self.current_player.input_pressed('stop') elif operation == 'up' and self.state == 'playing': # print '\nUP' self.previous() elif operation == 'down' and self.state == 'playing': next(self) elif operation == 'repeat' and self.state == 'playing': self.repeat() elif operation == 'play': # use 'play' to start child if state=playing or to trigger the show if waiting for trigger if self.state == 'playing': if self.show_params['child-track-ref'] != '': # set a signal because must stop current track before running child show self.play_child_signal = True self.child_track_ref = self.show_params['child-track-ref'] # and stop the current track if its running if self.current_player is not None: self.current_player.input_pressed('stop') else: if self.state == 'waiting': self.mon.stats(self.show_params['type'], self.show_params['show-ref'], self.show_params['title'], 'start trigger', '', '', '') Show.delete_admin_message(self) self.start_list() elif operation in ('pause', 'pause-on', 'pause-off', 'mute', 'unmute', 'go', 'inc-volume', 'dec-volume'): if self.current_player is not None: self.current_player.input_pressed(operation) elif operation in ('no-command', 'null'): return # if the operation is omxplayer mplayer or uzbl runtime control then pass it to player if running elif operation[0:4] == 'omx-' or operation[ 0:6] == 'mplay-' or operation[0:5] == 'uzbl-': if self.current_player is not None: self.current_player.input_pressed(operation)
def handle_input_event_this_show(self,symbol): self.mon.trace(self, "Handling input event in this show: " + symbol + " State:" + self.state) # check symbol against mediashow triggers if self.state == 'waiting' and self.show_params['trigger-start-type'] in ('input','input-persist') and symbol == self.show_params['trigger-start-param']: self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'start trigger', '','','') Show.delete_admin_message(self) self.start_list() elif self.state == 'playing' and self.show_params['trigger-end-type'] == 'input' and symbol == self.show_params['trigger-end-param']: self.end_trigger_signal=True if self.shower is not None: self.shower.do_operation('stop') elif self.current_player is not None: self.current_player.input_pressed('stop') elif self.state == 'playing' and self.show_params['trigger-next-type'] == 'input' and symbol == self.show_params['trigger-next-param']: self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'next trigger', '','','') self.mon.trace(self, "trigger-next-type detected; Calling next()") self.next() else: # event is not a trigger so must be internal operation operation=self.base_lookup_control(symbol,self.controls_list) if operation != '': self.do_operation(operation) else: self.mon.trace(self, "No operation found for event")
def end(self,reason,message): Show.delete_admin_message(self) self.base_withdraw_show_background() self.base_delete_show_background() self.mon.log(self,"Ending Artshow: "+ self.show_params['show-ref']) self.end_callback(self.show_id,reason,message) self=None
def do_operation(self,operation): # print 'do_operation ',operation self.mon.trace(self, operation) if operation == 'exit': self.exit() elif operation == 'stop': if self.level != 0 : # not at top so stop the show self.user_stop_signal=True # and stop the track first if self.current_player is not None: self.current_player.input_pressed('stop') else: # at top, just stop track if running if self.current_player is not None: self.current_player.input_pressed('stop') elif operation == 'up' and self.state == 'playing': # print '\nUP' self.previous() elif operation == 'down' and self.state == 'playing': self.next() elif operation == 'play': # use 'play' to start child if state=playing or to trigger the show if waiting for trigger if self.state == 'playing': if self.show_params['child-track-ref'] != '': # set a signal because must stop current track before running child show self.play_child_signal=True self.child_track_ref=self.show_params['child-track-ref'] # and stop the current track if its running if self.current_player is not None: self.current_player.input_pressed('stop') else: if self.state == 'waiting': self.mon.stats(self.show_params['type'],self.show_params['show-ref'],self.show_params['title'],'start trigger', '','','') Show.delete_admin_message(self) self.start_list() elif operation in ('pause','pause-on','pause-off','mute','unmute','go'): if self.current_player is not None: self.current_player.input_pressed(operation) elif operation in ('no-command','null'): return # if the operation is omxplayer mplayer or uzbl runtime control then pass it to player if running elif operation[0:4] == 'omx-' or operation[0:6] == 'mplay-'or operation[0:5] == 'uzbl-': if self.current_player is not None: self.current_player.input_pressed(operation)
def what_to_load_next(self): self.mon.trace(self, self.pretty_state()) # closing down so don't load anything if self.ending_reason in ('killed', 'error'): return # wanting to exit so don't load just skip to what-next if self.terminate_signal is True or self.exit_signal is True or self.req_next == 'error': self.what_next() # has content of list been changed (replaced if it has, used for content of livelist) # print 'WHAT to load NEXT' self.medialist.create_new_livelist() # print result, self.medialist.new_length(),self.medialist.anon_length() if self.medialist.livelist_changed() is True: # print 'ITS CHANGED' self.ending_reason = 'change-medialist' self.close_current_and_next() else: # get the next track and init player self.medialist.next(self.show_params['sequence']) Show.delete_admin_message(self) if self.medialist.at_end() is True: self.end_medialist_warning = True # print "!!!!! artshow init next " self.next_player = Show.base_init_selected_player( self, self.medialist.selected_track()) if self.next_player is None: self.mon.err( self, "Track Type cannot be played by this show: " + self.medialist.selected_track()['type']) self.req_next = 'error' self.what_next() else: # load the next track while current is showing # messageplayer passes the text not a file name if self.medialist.selected_track()['type'] == 'message': track_file = self.medialist.selected_track()['text'] else: track_file = Show.base_complete_path( self, self.medialist.selected_track()['location']) # print "!!!!! artshow load next ",track_file self.mon.trace(self, track_file) self.next_player.load(track_file, self.loaded_callback, enable_menu=False)
def what_to_load_next(self): self.mon.trace(self,self.pretty_state ()) # closing down so don't load anything if self.ending_reason in ('killed','error'): return # wanting to exit so don't load just skip to what-next if self.terminate_signal is True or self.exit_signal is True or self.req_next=='error': self.what_next() # has content of list been changed (replaced if it has, used for content of livelist) # print 'WHAT to load NEXT' self.medialist.create_new_livelist() # print result, self.medialist.new_length(),self.medialist.anon_length() if self.medialist.livelist_changed() is True: # print 'ITS CHANGED' self.ending_reason='change-medialist' self.close_current_and_next() else: # get the next track and init player self.medialist.next(self.show_params['sequence']) Show.delete_admin_message(self) if self.medialist.at_end() is True: self.end_medialist_warning=True # print "!!!!! artshow init next " self.next_player=Show.base_init_selected_player(self,self.medialist.selected_track()) if self.next_player is None: self.mon.err(self,"Track Type cannot be played by this show: "+self.medialist.selected_track()['type']) self.req_next='error' self.what_next() else: # load the next track while current is showing # messageplayer passes the text not a file name if self.medialist.selected_track()['type'] == 'message': track_file=self.medialist.selected_track()['text'] else: track_file=Show.base_complete_path(self,self.medialist.selected_track()['location']) # print "!!!!! artshow load next ",track_file self.mon.trace(self, track_file) self.next_player.load(track_file, self.loaded_callback, enable_menu=False)
def remove_list_empty_message(self): Show.delete_admin_message(self) self.load_first_track()
def trigger_next(self): self.next_track_signal = True Show.delete_admin_message(self) self.what_next_after_showing()