def load(self, text, loaded_callback, enable_menu): # instantiate arguments self.track = text self.loaded_callback = loaded_callback # callback when loaded self.mon.trace(self, '') # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() # can modify self.track with new text, does not touch message location if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the images and text including message text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return else: self.play_state = 'loaded' if self.loaded_callback is not None: self.loaded_callback('loaded', 'message track loaded')
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track # not used self.loaded_callback=loaded_callback #callback when loaded self.mon.trace(self,'') # do common bits of load Player.pre_load(self) # bodge for menuplayer, pass medialist through track parameters if 'medialist_obj' in self.show_params: self.medialist=self.show_params['medialist_obj'] else: self.mon.err(self,'A Menu Track must be run from a Menu Show') self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','A Menu Track must be run from a Menu Show') return # load the images and text status,message=Player.load_x_content(self,enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return else: self.play_state='loaded' if self.loaded_callback is not None: self.loaded_callback('loaded','menu track loaded')
def load(self,text,loaded_callback,enable_menu): # instantiate arguments self.track=text self.loaded_callback=loaded_callback # callback when loaded self.mon.trace(self,'') # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.ttack and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # load the images and text including message text status,message=self.load_x_content(enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return else: self.play_state='loaded' if self.loaded_callback is not None: self.loaded_callback('loaded','message track loaded')
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) # stopwatch for timing functions StopWatch.global_enable = False self.sw = StopWatch() self.sw.off() self.mon.trace(self, '') # and initilise things for this player # get duration from profile if self.track_params['duration'] != "": self.duration = int(self.track_params['duration']) else: self.duration = int(self.show_params['duration']) self.html_message_text_obj = None self.track_obj = None # initialise the state machine self.play_state = 'initialised'
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) # print ' !!!!!!!!!!!videoplayer init' self.mon.trace(self, '') # get player parameters if self.track_params['omx-audio'] != "": self.omx_audio = self.track_params['omx-audio'] else: self.omx_audio = self.show_params['omx-audio'] if self.omx_audio != "": self.omx_audio = "-o " + self.omx_audio if self.track_params['omx-volume'] != "": self.omx_volume = self.track_params['omx-volume'] else: self.omx_volume = self.show_params['omx-volume'] if self.omx_volume != "": self.omx_volume = int(self.omx_volume) * 100 if self.track_params['omx-window'] != '': self.omx_window = self.track_params['omx-window'] else: self.omx_window = self.show_params['omx-window'] if self.track_params['omx-other-options'] != '': self.omx_other_options = self.track_params['omx-other-options'] else: self.omx_other_options = self.show_params['omx-other-options'] if self.track_params['freeze-at-start'] != '': self.freeze_at_start = self.track_params['freeze-at-start'] else: self.freeze_at_start = self.show_params['freeze-at-start'] if self.track_params['freeze-at-end'] != '': freeze_at_end_text = self.track_params['freeze-at-end'] else: freeze_at_end_text = self.show_params['freeze-at-end'] if freeze_at_end_text == 'yes': self.freeze_at_end_required = True else: self.freeze_at_end_required = False if self.track_params['seamless-loop'] == 'yes': self.seamless_loop = ' --loop ' else: self.seamless_loop = '' # initialise video playing state and signals self.quit_signal = False self.unload_signal = False self.play_state = 'initialised' self.frozen_at_end = False
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track self.loaded_callback = loaded_callback #callback when loaded # print '!!!!!!!!!!! videoplayer load',self.track self.mon.log( self, "Load track received from show Id: " + str(self.show_id) + ' ' + self.track) self.mon.trace(self, '') # do common bits of load Player.pre_load(self) # set up video window status, message, command, has_window, x1, y1, x2, y2 = self.parse_video_window( self.omx_window) if status == 'error': self.mon.err( self, 'omx window error: ' + message + ' in ' + self.omx_window) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return else: if has_window is True: self.omx_window_processed = '--win " ' + str(x1) + ' ' + str( y1) + ' ' + str(x2) + ' ' + str(y2) + ' " ' else: self.omx_window_processed = '' # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return if not os.path.exists(track): self.mon.err(self, "Track file not found: " + track) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'track file not found') return self.omx = OMXDriver(self.canvas, self.pp_dir) self.start_state_machine_load(self.track)
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self, '') # get duration limit (secs ) from profile if self.show_params['type'] in ('liveshow', 'artliveshow'): duration_text = '' else: duration_text = self.track_params['duration'] if duration_text != '': self.duration_limit = 20 * int(duration_text) else: self.duration_limit = -1 # print self.duration_limit # get audio device from profile. if self.track_params['mplayer-audio'] != "": self.mplayer_audio = self.track_params['mplayer-audio'] else: self.mplayer_audio = self.show_params['mplayer-audio'] # get audio volume from profile. if self.track_params['mplayer-volume'] != "": mplayer_volume = self.track_params['mplayer-volume'].strip() else: mplayer_volume = self.show_params['mplayer-volume'].strip() mplayer_volume_int = int(mplayer_volume) + 60 self.volume_option = '-volume ' + str(mplayer_volume_int) # get speaker from profile if self.track_params['audio-speaker'] != "": self.audio_speaker = self.track_params['audio-speaker'] else: self.audio_speaker = self.show_params['audio-speaker'] if self.audio_speaker == 'left': self.speaker_option = AudioPlayer._LEFT elif self.audio_speaker == 'right': self.speaker_option = AudioPlayer._RIGHT else: self.speaker_option = AudioPlayer._STEREO if self.track_params['mplayer-other-options'] != '': self.mplayer_other_options = self.track_params[ 'mplayer-other-options'] else: self.mplayer_other_options = self.show_params[ 'mplayer-other-options'] # initialise the state and signals self.tick_timer = None self.quit_signal = False self.play_state = 'initialised' self.waiting = False
def __init__(self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__( self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self,'') # and initialise things for this player # get duration limit (secs ) from profile if self.track_params['duration'] != '': self.duration= int(self.track_params['duration']) else: self.duration= int(self.show_params['duration']) self.duration_limit=20*self.duration # process web window if self.track_params['web-window'] != '': self.web_window= self.track_params['web-window'] else: self.web_window= self.show_params['web-window'] # create an instance of uzbl driver self.bplayer=UZBLDriver(self.canvas) # Initialize variables self.command_timer=None self.tick_timer=None self.quit_signal=False # signal that user has pressed stop # initialise the play state self.play_state='initialised' self.show_state='' self.load_state=''
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track self.loaded_callback=loaded_callback #callback when loaded # print '!!!!!!!!!!! videoplayer load',self.track self.mon.log(self,"Load track received from show Id: "+ str(self.show_id) + ' ' +self.track) self.mon.trace(self,'') # do common bits of load Player.pre_load(self) # set up video window status,message,command,has_window,x1,y1,x2,y2= self.parse_video_window(self.omx_window) if status == 'error': self.mon.err(self,'omx window error: ' + message + ' in ' + self.omx_window) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return else: if has_window is True: self.omx_window_processed= '--win " '+ str(x1) + ' ' + str(y1) + ' ' + str(x2) + ' ' + str(y2) + ' " ' else: self.omx_window_processed='' # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # load the images and text status,message=self.load_x_content(enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return if not os.path.exists(track): self.mon.err(self,"Track file not found: "+ track) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','track file not found') return self.omx=OMXDriver(self.canvas,self.pp_dir) self.start_state_machine_load(self.track)
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) # stopwatch for timing functions StopWatch.global_enable = False self.sw = StopWatch() self.sw.off() self.mon.trace(self, '') # and initialise things for this player # print 'imageplayer init' # get duration from profile if self.track_params['duration'] != '': self.duration = int(self.track_params['duration']) else: self.duration = int(self.show_params['duration']) # get image window from profile if self.track_params['image-window'].strip() != '': self.image_window = self.track_params['image-window'].strip() else: self.image_window = self.show_params['image-window'].strip() # get image rotation from profile if self.track_params['image-rotate'].strip() != '': self.image_rotate = int(self.track_params['image-rotate'].strip()) else: self.image_rotate = int(self.show_params['image-rotate'].strip()) if self.track_params['pause-timeout'] != '': pause_timeout_text = self.track_params['pause-timeout'] else: pause_timeout_text = self.show_params['pause-timeout'] if pause_timeout_text.isdigit(): self.pause_timeout = int(pause_timeout_text) else: self.pause_timeout = 0 self.track_image_obj = None self.tk_img = None self.paused = False self.pause_text_obj = None self.pause_timer = None # initialise the state machine self.play_state = 'initialised'
def show(self, ready_callback, finished_callback, closed_callback): self.ready_callback = ready_callback # callback when paused after load ready to show video self.finished_callback = finished_callback # callback when finished showing self.closed_callback = closed_callback self.mon.trace(self, '') # do animation at start and ready_callback Player.pre_show(self) # start show state machine self.start_state_machine_show()
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self, '') # and initialise things for this player self.dm = DisplayManager() # get duration limit (secs ) from profile if self.track_params['duration'] != '': self.duration_text = self.track_params['duration'] else: self.duration_text = self.show_params['duration'] # process chrome window if self.track_params['chrome-window'] != '': self.chrome_window_text = self.track_params['chrome-window'] else: self.chrome_window_text = self.show_params['chrome-window'] # process chrome things if self.track_params['chrome-freeze-at-end'] != '': self.freeze_at_end = self.track_params['chrome-freeze-at-end'] else: self.freeze_at_end = self.show_params['chrome-freeze-at-end'] if self.track_params['chrome-zoom'] != '': self.chrome_zoom_text = self.track_params['chrome-zoom'] else: self.chrome_zoom_text = self.show_params['chrome-zoom'] if self.track_params['chrome-other-options'] != '': self.chrome_other_options = self.track_params[ 'chrome-other-options'] else: self.chrome_other_options = self.show_params[ 'chrome-other-options'] # Initialize variables self.command_timer = None self.tick_timer = None self.quit_signal = False # signal that user has pressed stop # initialise the play state self.play_state = 'initialised' self.load_state = ''
def show(self,ready_callback,finished_callback,closed_callback): # print "!!!! videoplayer show" # instantiate arguments self.ready_callback=ready_callback # callback when ready to show video self.finished_callback=finished_callback # callback when finished showing self.closed_callback=closed_callback self.mon.trace(self,'') # do animation at start etc. Player.pre_show(self) # start show state machine self.start_state_machine_show()
def show(self, ready_callback, finished_callback, closed_callback): # print "!!!! videoplayer show" # instantiate arguments self.ready_callback = ready_callback # callback when ready to show video self.finished_callback = finished_callback # callback when finished showing self.closed_callback = closed_callback self.mon.trace(self, '') # do animation at start etc. Player.pre_show(self) # start show state machine self.start_state_machine_show()
def show(self,ready_callback,finished_callback,closed_callback): # instantiate arguments self.ready_callback=ready_callback # callback when ready to show an image - self.finished_callback=finished_callback # callback when finished showing self.closed_callback=closed_callback # callback when closed - not used by imageplayer self.mon.trace(self,'') self.quit_signal=False # do common bits Player.pre_show(self) self.start_dwell()
def show(self, ready_callback, finished_callback, closed_callback): # instantiate arguments self.ready_callback = ready_callback # callback when ready to show a web page- self.finished_callback = finished_callback # callback when finished showing - not used self.closed_callback = closed_callback # callback when closed self.mon.trace(self, '') self.play_state = 'showing' # init state and signals self.quit_signal = False # do common bits Player.pre_show(self) #self.driver.get(self.current_url) self.duration_count = self.duration self.tick_timer = self.canvas.after(10, self.show_state_machine)
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self, '') # and initialise things for this player self.display_guidelines = track_params['menu-guidelines'] self.play_state = 'initialised' self.menu_entry_id = [] self.menu_text_obj = None self.hint_text_obj = None
def show(self,ready_callback,finished_callback,closed_callback): # instantiate arguments self.ready_callback=ready_callback # callback when ready to show a web page- self.finished_callback=finished_callback # callback when finished showing - not used self.closed_callback=closed_callback # callback when closed self.mon.trace(self,'') # init state and signals self.quit_signal=False # do common bits Player.pre_show(self) # start show state machine self.start_show_state_machine_show()
def show(self, ready_callback, finished_callback, closed_callback): # instantiate arguments self.ready_callback = ready_callback # callback when ready to show a web page- self.finished_callback = finished_callback # callback when finished showing - not used self.closed_callback = closed_callback # callback when closed self.mon.trace(self, '') # init state and signals self.quit_signal = False # do common bits Player.pre_show(self) # start show state machine self.start_show_state_machine_show()
def __init__(self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__( self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback) # stopwatch for timing functions StopWatch.global_enable=False self.sw=StopWatch() self.sw.off() self.mon.trace(self,'') # and initilise things for this player # get duration from profile if self.track_params['duration'] != "": self.duration= int(self.track_params['duration']) else: self.duration= int(self.show_params['duration']) # initialise the state machine self.play_state='initialised'
def show(self, ready_callback, finished_callback, closed_callback): # instantiate arguments self.ready_callback = ready_callback # callback when ready to show an image - self.finished_callback = finished_callback # callback when finished showing self.closed_callback = closed_callback # callback when closed - not used by Messageplayer self.mon.trace(self, '') # init state and signals self.tick = 100 # tick time for image display (milliseconds) self.dwell = 10 * self.duration self.dwell_counter = 0 self.quit_signal = False # do common bits Player.pre_show(self) # start show state machine self.start_dwell()
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track self.loaded_callback = loaded_callback #callback when loaded self.mon.trace(self, '') # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return if track != '' and self.duration_limit != 0 and not os.path.exists( track): self.mon.err(self, "Track file not found: " + track) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'track file not found: ' + track) return # just create instance of mplayer don't bother with any pre-load self.mplayer = MplayerDriver(self.canvas, self.pp_dir) self.play_state = 'loaded' self.mon.log(self, "<Track loaded from show Id: " + str(self.show_id)) if self.loaded_callback is not None: self.loaded_callback('loaded', 'audio track loaded')
def show(self,ready_callback,finished_callback,closed_callback): # instantiate arguments self.ready_callback=ready_callback # callback when ready to show an image - self.finished_callback=finished_callback # callback when finished showing self.closed_callback=closed_callback # callback when closed - not used by Messageplayer self.mon.trace(self,'') # init state and signals self.tick = 100 # tick time for image display (milliseconds) self.dwell = 10*self.duration self.dwell_counter=0 self.quit_signal=False # do common bits Player.pre_show(self) # start show state machine self.start_dwell()
def show(self, ready_callback, finished_callback, closed_callback): # instantiate arguments self.ready_callback = ready_callback # callback when ready to show video self.finished_callback = finished_callback # callback when finished showing self.closed_callback = closed_callback self.mon.trace(self, '') # do animation begin etc. Player.pre_show(self) # start playing the track. self.mon.log(self, ">start playing track: " + str(self.show_id)) if self.duration_limit != 0: self.start_play_state_machine_show() else: self.mplayer = None if self.closed_callback is not None: self.closed_callback('normal', 'end with zero duration')
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track self.loaded_callback=loaded_callback #callback when loaded self.mon.trace(self,'') # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # load the images and text status,message=self.load_x_content(enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return if track !='' and self.duration_limit!=0 and not os.path.exists(track): self.mon.err(self,"Track file not found: "+ track) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','track file not found') return # just create instance of mplayer don't bother with any pre-load self.mplayer=MplayerDriver(self.canvas,self.pp_dir) self.play_state='loaded' self.mon.log(self,"<Track loaded from show Id: "+ str(self.show_id)) if self.loaded_callback is not None: self.loaded_callback('loaded','audio track loaded')
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track # print 'imageplayer load',self.track self.loaded_callback = loaded_callback # callback when loaded self.mon.trace(self, '') Player.pre_load(self) # parse the image_window status, message, self.command, self.has_coords, self.window_x1, self.window_y1, self.window_x2, self.window_y2, self.image_filter = self.parse_window( self.image_window) if status == 'error': self.mon.err( self, 'image window error, ' + message + ': ' + self.image_window) self.play_state = 'load-failed' self.loaded_callback( 'error', 'image window error, ' + message + ': ' + self.image_window) return # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' self.loaded_callback('error', message) return # load the images and text status, message = Player.load_x_content(self, enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' self.loaded_callback('error', message) return else: self.play_state = 'loaded' if self.loaded_callback is not None: self.loaded_callback('loaded', 'image track loaded')
def show(self, ready_callback, finished_callback, closed_callback): # print "!!!! videoplayer show" # instantiate arguments self.ready_callback = ready_callback # callback when ready to show video self.finished_callback = finished_callback # callback when finished showing self.closed_callback = closed_callback self.mon.trace(self, '') # do animation at start etc. Player.pre_show(self) # start show state machine self.start_state_machine_show() self.video_start_timestamp = self.omx.video_start_timestamp global globalVideoTimestampStart globalVideoTimestampStart = self.video_start_timestamp self.mon.log( self, "Timestamp from show starting: " + str(self.omx.video_start_timestamp))
def show(self,ready_callback,finished_callback,closed_callback): # instantiate arguments self.ready_callback=ready_callback # callback when ready to show video self.finished_callback=finished_callback # callback when finished showing self.closed_callback=closed_callback self.mon.trace(self,'') # do animation begin etc. Player.pre_show(self) # start playing the track. self.mon.log(self,">start playing track: "+ str(self.show_id)) if self.duration_limit != 0: self.start_play_state_machine_show() else: self.mplayer=None if self.closed_callback is not None: self.closed_callback('normal','end with zero duration')
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track # print 'imageplayer load',self.track self.loaded_callback=loaded_callback # callback when loaded self.mon.trace(self,'') Player.pre_load(self) # parse the image_window status,self.command,self.has_coords,self.window_x1,self.window_y1,self.window_x2,self.window_y2,self.image_filter=self.parse_window(self.image_window) if status == 'error': self.mon.err(self,'image window error: '+self.image_window) self.play_state='load-failed' self.loaded_callback('error','image window error: '+self.image_window) return # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' self.loaded_callback('error',message) return # load the images and text status,message=Player.load_x_content(self,enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' self.loaded_callback('error',message) return else: self.play_state='loaded' if self.loaded_callback is not None: self.loaded_callback('loaded','image track loaded')
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track self.loaded_callback = loaded_callback #callback when loaded self.mon.log( self, "Load track received from show Id: " + str(self.show_id) + ' ' + self.track) self.mon.trace(self, '') #process vlc parameters status, message = self.process_params() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return #for pulse get sink name and check device is connected self.audio_sys = self.am.get_audio_sys() if self.audio_sys == 'pulse': status, message, self.vlc_sink = self.am.get_sink(self.vlc_audio) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return if not self.am.sink_connected(self.vlc_sink): self.mon.err( self, self.vlc_audio + ' audio device not connected\n\n sink: ' + self.vlc_sink) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'audio device not connected') return else: self.mon.err( self, 'audio systems other than pulseaudio are not supported\n hint: audio.cfg error' ) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'audio device not connected') return # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # check file exists if not a mrl if not ':' in track: if not os.path.exists(track): self.mon.err(self, "Track file not found: " + track) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'track file not found: ' + track) return cmd = 'DISPLAY= python3 ' + self.pp_dir + '/pp_vlcdriver.py' #print (cmd) # need bash because of DISPLAY= self.vlcdriver = pexpect.spawn('/bin/bash', ['-c', cmd], encoding='utf-8') # get rid of driver start message start_message = self.vlcdriver.readline().strip('\r\n') if start_message != 'VLCDriver starting': self.mon.fatal( self, "VLCDriver failed\n Hint: sudo pip3 install python-vlc ") self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'VLCDriver starting') return self.vlcdriver.setecho(False) self.vlcdriver.sendline('iopts' + self.iopts) self.vlcdriver.sendline('pauseopts' + self.pauseopts) self.vlcdriver.sendline('track ' + track) # load the media self.vlcdriver.sendline('load') #get size of media, do after load and before play. Not used at the moment self.media_width, self.media_height = self.get_size() # calculate and send crop/aspect ratio and aspect mode. Done here as size might be needed in the future status, message = self.aspect_mode() if status != 'normal': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'track file not found: ' + track) return # play until pause at start self.vlcdriver.sendline('play') self.start_state_machine_load()
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) # print ' !!!!!!!!!!!videoplayer init' self.mon.trace(self, '') self.video_start_timestamp = 0 self.dm = DisplayManager() # get player parameters if self.track_params['omx-audio'] != "": self.omx_audio = self.track_params['omx-audio'] else: self.omx_audio = self.show_params['omx-audio'] if self.omx_audio != "": self.omx_audio = "-o " + self.omx_audio self.omx_max_volume_text = self.track_params['omx-max-volume'] if self.omx_max_volume_text != "": self.omx_max_volume = int(self.omx_max_volume_text) else: self.omx_max_volume = 0 if self.track_params['omx-volume'] != "": self.omx_volume = self.track_params['omx-volume'] else: self.omx_volume = self.show_params['omx-volume'] if self.omx_volume != "": self.omx_volume = int(self.omx_volume) else: self.omx_volume = 0 self.omx_volume = min(self.omx_volume, self.omx_max_volume) if self.track_params['omx-window'] != '': self.omx_window = self.track_params['omx-window'] else: self.omx_window = self.show_params['omx-window'] if self.track_params['omx-other-options'] != '': self.omx_other_options = self.track_params['omx-other-options'] else: self.omx_other_options = self.show_params['omx-other-options'] if self.track_params['freeze-at-start'] != '': self.freeze_at_start = self.track_params['freeze-at-start'] else: self.freeze_at_start = self.show_params['freeze-at-start'] if self.track_params['freeze-at-end'] != '': freeze_at_end_text = self.track_params['freeze-at-end'] else: freeze_at_end_text = self.show_params['freeze-at-end'] if freeze_at_end_text == 'yes': self.freeze_at_end_required = True else: self.freeze_at_end_required = False if self.track_params['seamless-loop'] == 'yes': self.seamless_loop = ' --loop ' else: self.seamless_loop = '' if self.track_params['pause-timeout'] != '': pause_timeout_text = self.track_params['pause-timeout'] else: pause_timeout_text = self.show_params['pause-timeout'] if pause_timeout_text.isdigit(): self.pause_timeout = int(pause_timeout_text) else: self.pause_timeout = 0 # initialise video playing state and signals self.quit_signal = False self.unload_signal = False self.play_state = 'initialised' self.frozen_at_end = False self.pause_timer = None
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track self.loaded_callback = loaded_callback #callback when loaded # print '!!!!!!!!!!! videoplayer load',self.track self.mon.log( self, "Load track received from show Id: " + str(self.show_id) + ' ' + self.track) self.mon.trace(self, '') # do common bits of load Player.pre_load(self) # set up video display if self.track_params['display-name'] != "": video_display_name = self.track_params['display-name'] else: video_display_name = self.show_canvas_display_name status, message, self.omx_display_id = self.dm.id_of_display( video_display_name) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback( 'error', 'Display not connected: ' + video_display_name) return # set up video window and calc orientation status, message, command, has_window, x1, y1, x2, y2 = self.parse_video_window( self.omx_window, self.omx_display_id) if status == 'error': self.mon.err( self, 'omx window error: ' + message + ' in ' + self.omx_window) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback( 'error', 'omx window error: ' + message + ' in ' + self.omx_window) return else: if has_window is True: self.omx_window_processed = '--win " ' + str(x1) + ' ' + str( y1) + ' ' + str(x2) + ' ' + str(y2) + ' " ' else: self.omx_window_processed = self.omx_aspect_mode # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return if not (track[0:3] in ('udp', 'tcp') or track[0:4] in ('rtsp', 'rtmp')): if not os.path.exists(track): self.mon.err(self, "Track file not found: " + track) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'track file not found: ' + track) return self.omx = OMXDriver(self.canvas, self.pp_dir) self.start_state_machine_load(self.track)
def __init__(self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__( self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback) # stopwatch for timing functions StopWatch.global_enable=False self.sw=StopWatch() self.sw.off() self.mon.trace(self,'') # and initialise things for this player # print 'imageplayer init' # get duration from profile if self.track_params['duration'] != '': self.duration= int(self.track_params['duration']) else: self.duration= int(self.show_params['duration']) # get image window from profile if self.track_params['image-window'].strip() != '': self.image_window= self.track_params['image-window'].strip() else: self.image_window= self.show_params['image-window'].strip() # get image rotation from profile if self.track_params['image-rotate'].strip() != '': self.image_rotate = int(self.track_params['image-rotate'].strip()) else: self.image_rotate= int(self.show_params['image-rotate'].strip()) self.track_image_obj=None self.tk_img=None # krt 28/1/2016 self.paused=False self.pause_text_obj=None # initialise the state machine self.play_state='initialised'
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__( self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self,'') # get duration limit (secs ) from profile if self.show_params['type'] in ('liveshow','artliveshow'): duration_text='' else: duration_text= self.track_params['duration'] if duration_text != '': self.duration_limit= 20 * int(duration_text) else: self.duration_limit=-1 # print self.duration_limit # get audio device from profile. if self.track_params['mplayer-audio'] != "": self.mplayer_audio= self.track_params['mplayer-audio'] else: self.mplayer_audio= self.show_params['mplayer-audio'] # get audio volume from profile. if self.track_params['mplayer-volume'] != "": mplayer_volume= self.track_params['mplayer-volume'].strip() else: mplayer_volume= self.show_params['mplayer-volume'].strip() mplayer_volume_int=int(mplayer_volume)+100 self.volume_option= '-volume ' + str(mplayer_volume_int) # get speaker from profile if self.track_params['audio-speaker'] != "": self.audio_speaker= self.track_params['audio-speaker'] else: self.audio_speaker= self.show_params['audio-speaker'] if self.audio_speaker == 'left': self.speaker_option=AudioPlayer._LEFT elif self.audio_speaker == 'right': self.speaker_option=AudioPlayer._RIGHT else: self.speaker_option=AudioPlayer._STEREO if self.track_params['mplayer-other-options'] != '': self.mplayer_other_options= self.track_params['mplayer-other-options'] else: self.mplayer_other_options= self.show_params['mplayer-other-options'] # initialise the state and signals self.tick_timer=None self.quit_signal=False self.play_state='initialised' self.waiting=False
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track self.loaded_callback=loaded_callback # callback when loaded self.mon.trace(self,'') # do common bits of load Player.pre_load(self) #parse web window reason,message,command,has_window,x1,y1,x2,y2=self.parse_window(self.web_window) if reason == 'error': self.mon.err(self,'web window error: '+' ' + message + ' in ' + self.web_window) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # compute web_window size if has_window is False: self.geometry = ' --geometry=maximized ' else: width=x2-x1 height=y2-y1 self.geometry = "--geometry=%dx%d%+d%+d " % (width,height,x1,y1) # parse browser commands to self.command_list reason,message=self.parse_commands(self.track_params['browser-commands']) if reason == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # start loading the browser self.play_state='loading' self.bplayer.play(self.track,self.geometry) self.mon.log (self,'Loading browser from show Id: '+ str(self.show_id)) # load the images and text status,message=self.load_x_content(enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # wait for browser to load self.start_load_state_machine()
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.loaded_callback = loaded_callback # callback when loaded self.mon.trace(self, '') status, message, duration100 = Player.parse_duration( self.duration_text) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return self.duration = 2 * duration100 # Is display valid and connected status, message, self.display_id = self.dm.id_of_display( self.show_canvas_display_name) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'cannot find file; ' + track) return # does media exist if not ':' in track: if not os.path.exists(track): self.mon.err(self, 'cannot find file; ' + track) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', 'cannot find file; ' + track) return # add file:// to files. if ':' in track: self.current_url = track else: self.current_url = 'file://' + track # do common bits of load Player.pre_load(self) # prepare chromium options status, message = self.process_chrome_options() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # parse browser commands to self.command_list reason, message = self.parse_commands( self.track_params['browser-commands']) if reason == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # start loading the browser self.play_state = 'loading' # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return #start the browser self.driver_open() # for kiosk and fullscreen need to get the url - in browser command for app mode if self.app_mode is False: self.driver_get(self.current_url) self.mon.log(self, 'Loading browser from show Id: ' + str(self.show_id)) self.play_state = 'loaded' # and start executing the browser commands self.play_commands() self.mon.log(self, " State machine: chromium loaded") if self.loaded_callback is not None: self.loaded_callback('normal', 'browser loaded') return
def __init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__(self, show_id, showlist, root, canvas, show_params, track_params, pp_dir, pp_home, pp_profile, end_callback, command_callback) self.mon.trace(self, '') self.dm = DisplayManager() self.am = AudioManager() # get player parameters from show/track if self.track_params['vlc-audio'] != "": self.vlc_audio = self.track_params['vlc-audio'] else: self.vlc_audio = self.show_params['vlc-audio'] if self.track_params['vlc-volume'] != "": self.vlc_volume_text = self.track_params['vlc-volume'] else: self.vlc_volume_text = self.show_params['vlc-volume'] if self.track_params['vlc-window'] != '': self.vlc_window_text = self.track_params['vlc-window'] else: self.vlc_window_text = self.show_params['vlc-window'] if self.track_params['vlc-aspect-mode'] != '': self.vlc_aspect_mode = self.track_params['vlc-aspect-mode'] else: self.vlc_aspect_mode = self.show_params['vlc-aspect-mode'] if self.track_params['vlc-image-duration'] != '': self.vlc_image_duration_text = self.track_params[ 'vlc-image-duration'] else: self.vlc_image_duration_text = self.show_params[ 'vlc-image-duration'] if self.track_params['vlc-other-options'] != '': self.vlc_other_options = self.track_params['vlc-other-options'] else: self.vlc_other_options = self.show_params['vlc-other-options'] if self.track_params['vlc-layer'] != '': self.vlc_layer_text = self.track_params['vlc-layer'] else: self.vlc_layer_text = self.show_params['vlc-layer'] if self.track_params['vlc-freeze-at-start'] != '': self.freeze_at_start_text = self.track_params[ 'vlc-freeze-at-start'] else: self.freeze_at_start_text = self.show_params['vlc-freeze-at-start'] if self.track_params['vlc-freeze-at-end'] != '': self.freeze_at_end_text = self.track_params['vlc-freeze-at-end'] else: self.freeze_at_end_text = self.show_params['vlc-freeze-at-end'] if self.track_params['pause-timeout'] != '': pause_timeout_text = self.track_params['pause-timeout'] else: pause_timeout_text = self.show_params['pause-timeout'] if pause_timeout_text.isdigit(): self.pause_timeout = int(pause_timeout_text) else: self.pause_timeout = 0 # track only self.vlc_subtitles = self.track_params['vlc-subtitles'] self.vlc_max_volume_text = self.track_params['vlc-max-volume'] self.vlc_aspect_ratio = self.track_params['vlc-aspect-ratio'] self.vlc_crop = self.track_params['vlc-crop'] # initialise video playing state and signals self.quit_signal = False self.unload_signal = False self.play_state = 'initialised' self.frozen_at_end = False self.pause_timer = None
def __init__(self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback): # initialise items common to all players Player.__init__( self, show_id, showlist, root, canvas, show_params, track_params , pp_dir, pp_home, pp_profile, end_callback, command_callback) # print ' !!!!!!!!!!!videoplayer init' self.mon.trace(self,'') # get player parameters if self.track_params['omx-audio'] != "": self.omx_audio= self.track_params['omx-audio'] else: self.omx_audio= self.show_params['omx-audio'] if self.omx_audio != "": self.omx_audio= "-o "+ self.omx_audio if self.track_params['omx-volume'] != "": self.omx_volume= self.track_params['omx-volume'] else: self.omx_volume= self.show_params['omx-volume'] if self.omx_volume != "": self.omx_volume= "--vol "+ str(int(self.omx_volume)*100) + ' ' if self.track_params['omx-window'] != '': self.omx_window= self.track_params['omx-window'] else: self.omx_window= self.show_params['omx-window'] if self.track_params['omx-other-options'] != '': self.omx_other_options= self.track_params['omx-other-options'] else: self.omx_other_options= self.show_params['omx-other-options'] if self.track_params['freeze-at-end'] != '': freeze_at_end_text= self.track_params['freeze-at-end'] else: freeze_at_end_text= self.show_params['freeze-at-end'] if freeze_at_end_text == 'yes': self.freeze_at_end_required=True else: self.freeze_at_end_required=False if self.track_params['seamless-loop'] == 'yes': self.seamless_loop=' --loop ' else: self.seamless_loop='' # initialise video playing state and signals self.quit_signal=False self.unload_signal=False self.play_state='initialised' self.frozen_at_end=False
def load(self,track,loaded_callback,enable_menu): # instantiate arguments self.track=track self.loaded_callback=loaded_callback #callback when loaded self.mon.trace(self,'') #for pulse get sink name and check device is connected self.audio_sys=self.am.get_audio_sys() if self.audio_sys == 'pulse': status,message,self.mplayer_sink = self.am.get_sink(self.mplayer_audio) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return if not self.am.sink_connected(self.mplayer_sink): self.mon.err(self,'audio device not connected - '+self.mplayer_audio + '/n sink: '+self.mplayer_sink) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','audio device not connected') return # do common bits of load Player.pre_load(self) # load the plugin, this may modify self.track and enable the plugin drawign to canvas if self.track_params['plugin'] != '': status,message=self.load_plugin() if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return # load the images and text status,message=self.load_x_content(enable_menu) if status == 'error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error',message) return if self.duration_text != '': status,message,duration100=Player.parse_duration(self.duration_text) if status =='error': self.mon.err(self,message) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','track file not found: ' + track) return self.duration_limit= 2* duration100 else: self.duration_limit=-1 #print (self.duration_limit) if track !='' and self.duration_limit!=0 and not os.path.exists(track): self.mon.err(self,"Track file not found: "+ track) self.play_state='load-failed' if self.loaded_callback is not None: self.loaded_callback('error','track file not found: ' + track) return # just create instance of mplayer don't bother with any pre-load self.mplayer=MplayerDriver(self.canvas,self.pp_dir) self.play_state='loaded' self.mon.log(self,"<Track loaded from show Id: "+ str(self.show_id)) if self.loaded_callback is not None: self.loaded_callback('loaded','audio track loaded')
def load(self, track, loaded_callback, enable_menu): # instantiate arguments self.track = track self.loaded_callback = loaded_callback # callback when loaded self.mon.trace(self, '') # do common bits of load Player.pre_load(self) #parse web window reason, message, command, has_window, x1, y1, x2, y2 = self.parse_window( self.web_window) if reason == 'error': self.mon.err( self, 'web window error: ' + ' ' + message + ' in ' + self.web_window) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # compute web_window size if has_window is False: self.geometry = ' --geometry=maximized ' else: width = x2 - x1 height = y2 - y1 self.geometry = "--geometry=%dx%d%+d%+d " % (width, height, x1, y1) # parse browser commands to self.command_list reason, message = self.parse_commands( self.track_params['browser-commands']) if reason == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # load the plugin, this may modify self.track and enable the plugin drawing to canvas if self.track_params['plugin'] != '': status, message = self.load_plugin() if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # start loading the browser self.play_state = 'loading' self.bplayer.play(self.track, self.geometry) self.mon.log(self, 'Loading browser from show Id: ' + str(self.show_id)) # load the images and text status, message = self.load_x_content(enable_menu) if status == 'error': self.mon.err(self, message) self.play_state = 'load-failed' if self.loaded_callback is not None: self.loaded_callback('error', message) return # wait for browser to load self.start_load_state_machine()