コード例 #1
0
    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(ALL)
        if self.show['progress'] == "manual":
            self._display_eggtimer(self.resource('mediashow', 'm04'))

        # is menu required
        if self.show['has-child'] == "yes":
            enable_child = True
        else:
            enable_child = False

        #dispatch track by type
        self.player = None
        self.shower = None
        track_type = selected_track['type']
        self.mon.log(self, "Track type is: " + track_type)

        if track_type == "video":
            # create a videoplayer
            track_file = self.complete_path(selected_track)
            self.player = VideoPlayer(self.canvas, self.show, selected_track)
            self.player.play(track_file,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "image":
            track_file = self.complete_path(selected_track)
            # images played from menus don't have children
            self.player = ImagePlayer(self.canvas, self.show, selected_track)
            self.player.play(track_file,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "message":
            # bit odd because MessagePlayer is used internally to display text.
            text = selected_track['text']
            self.player = MessagePlayer(self.canvas, self.show, selected_track)
            self.player.play(text,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "show":
            # get the show from the showlist
            index = self.showlist.index_of_show(selected_track['sub-show'])
            if index >= 0:
                self.showlist.select(index)
                selected_show = self.showlist.selected_show()
            else:
                self.mon.err(
                    self, "Show not found in showlist: " +
                    selected_track['sub-show'])
                self._end('error', "Unknown show")

            if selected_show['type'] == "mediashow":
                self.shower = MediaShow(selected_show, self.canvas,
                                        self.showlist, self.pp_home,
                                        self.pp_profile)
                self.shower.play(self.end_shower,
                                 top=False,
                                 command=self._direction)

            elif selected_show['type'] == "liveshow":
                self.shower = LiveShow(selected_show, self.canvas,
                                       self.showlist, self.pp_home,
                                       self.pp_profile)
                self.shower.play(self.end_shower, top=False, command='nil')

            elif selected_show['type'] == "menu":
                self.shower = MenuShow(selected_show, self.canvas,
                                       self.showlist, self.pp_home,
                                       self.pp_profile)
                self.shower.play(self.end_shower, top=False, command='nil')

            else:
                self.mon.err(self,
                             "Unknown Show Type: " + selected_show['type'])
                self._end('error' "Unknown show type")

        else:
            self.mon.err(self, "Unknown Track Type: " + track_type)
            self._end('error', "Unknown track type")
コード例 #2
0
    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.delete_eggtimer()
        if self.show_params['progress']=="manual":
            self.display_eggtimer(self.resource('mediashow','m04'))

        # is menu required
        if self.show_params['has-child']=="yes":
            self.enable_child=True
        else:
            self.enable_child=False

        #dispatch track by type
        self.player=None
        self.shower=None
        track_type = selected_track['type']
        self.mon.log(self,self.show_params['show-ref']+ ' '+ str(self.show_id)+ ": Track type is: "+ track_type)
        if track_type=="video":
            # NIK
            # bug fix hack where multiple omxplayers were running at the same time, causing display problems
            subprocess.call("killall omxplayer.bin", shell=True)
            # NIK

            # create a videoplayer
            track_file=self.complete_path(selected_track)
            self.player=VideoPlayer(self.show_id,self.root,self.canvas,self.show_params,selected_track,self.pp_dir,self.pp_home,self.pp_profile)
            self.player.play(track_file,
                                        self.showlist,
                                        self.end_player,
                                        self.ready_callback,
                                        enable_menu=self.enable_child)
  
        elif track_type=="audio":
            # create a audioplayer
            track_file=self.complete_path(selected_track)
            self.player=AudioPlayer(self.show_id,self.root,self.canvas,self.show_params,selected_track,self.pp_dir,self.pp_home,self.pp_profile)
            self.player.play(track_file,
                                        self.showlist,
                                        self.end_player,
                                        self.ready_callback,
                                        enable_menu=self.enable_child)
 
        elif track_type=="web":
            # create a browser
            track_file=self.complete_path(selected_track)
            self.player=BrowserPlayer(self.show_id,self.root,self.canvas,self.show_params,selected_track,self.pp_dir,self.pp_home,self.pp_profile)
            self.player.play(track_file,
                                        self.showlist,
                                        self.end_player,
                                        self.ready_callback,
                                        enable_menu=self.enable_child)
  


 
        elif track_type=="image":
            track_file=self.complete_path(selected_track)
            # images played from menus don't have children
            self.player=ImagePlayer(self.show_id,self.root,self.canvas,self.show_params,selected_track,self.pp_dir,self.pp_home,self.pp_profile)
            self.player.play(track_file,
                                    self.showlist,
                                    self.end_player,
                                    self.ready_callback,
                                    enable_menu=self.enable_child)
                                    
        elif track_type=="message":
            # bit odd because MessagePlayer is used internally to display text. 
            text=selected_track['text']
            self.player=MessagePlayer(self.show_id,self.root,self.canvas,self.show_params,selected_track,self.pp_dir,self.pp_home,self.pp_profile)
            self.player.play(text,
                                    self.showlist,
                                    self.end_player,
                                    self.ready_callback,
                                    enable_menu=self.enable_child
                                    )

 
        elif track_type=="show":
            # get the show from the showlist
            index = self.showlist.index_of_show(selected_track['sub-show'])
            if index >=0:
                self.showlist.select(index)
                selected_show=self.showlist.selected_show()
            else:
                self.mon.err(self,"Show not found in showlist: "+ selected_track['sub-show'])
                self.end('error',"Unknown show")
                
            if selected_show['type']=="mediashow":    
                self.shower= MediaShow(selected_show,
                                                               self.root,
                                                                self.canvas,
                                                                self.showlist,
                                                               self.pp_dir,
                                                                self.pp_home,
                                                                self.pp_profile)
                self.shower.play(self.show_id,self.end_shower,self.ready_callback,top=False,command=self.direction)

            elif selected_show['type']=="liveshow":    
                self.shower= LiveShow(selected_show,
                                                                self.root,
                                                                self.canvas,
                                                                self.showlist,
                                                                self.pp_dir,
                                                                self.pp_home,
                                                                self.pp_profile)
                self.shower.play(self.show_id,self.end_shower,self.ready_callback,top=False,command='nil')

            elif selected_show['type']=="radiobuttonshow":
                self.shower= RadioButtonShow(selected_show,
                                                         self.root,
                                                        self.canvas,
                                                        self.showlist,
                                                        self.pp_dir,
                                                        self.pp_home,
                                                        self.pp_profile)
                self.shower.play(self.show_id,self.end_shower,self.ready_callback,top=False,command='nil')

            elif selected_show['type']=="hyperlinkshow":
                self.shower= HyperlinkShow(selected_show,
                                                       self.root,
                                                        self.canvas,
                                                        self.showlist,
                                                       self.pp_dir,
                                                        self.pp_home,
                                                        self.pp_profile)
                self.shower.play(self.show_id,self.end_shower,self.ready_callback,top=False,command='nil')
            
            elif selected_show['type']=="menu":
                self.shower= MenuShow(selected_show,
                                                        self.root,
                                                        self.canvas,
                                                        self.showlist,
                                                          self.pp_dir,
                                                        self.pp_home,
                                                        self.pp_profile)
                self.shower.play(self.show_id,self.end_shower,self.ready_callback,top=False,command='nil')
                
            else:
                self.mon.err(self,"Unknown Show Type: "+ selected_show['type'])
                self.end('error'"Unknown show type")  
            
        else:
            self.mon.err(self,"Unknown Track Type: "+ track_type)
            self.end('error',"Unknown track type")            
コード例 #3
0
    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
        """

        if self.timeout_running <> None:
            self.canvas.after_cancel(self.timeout_running)
            self.timeout_running = None

        # self.canvas.delete(ALL)
        self.display_eggtimer(self.resource('hyperlinkshow', 'm01'))

        self.current_track_type = selected_track['type']

        #read the show links. Track links will be added by ready_callback
        links_text = self.show_params['links']
        reason, message, self.links = self.path.parse_links(links_text)
        if reason == 'error':
            self.mon.err(self, message + " in show")
            self.end('error', message)

        #start timeout for the track if required

        if self.current_track_ref <> self.first_track_ref and int(
                self.show_params['timeout']) <> 0:
            self.timeout_running = self.canvas.after(
                int(self.show_params['timeout']) * 1000, self.timeout_callback)

        # dispatch track by type
        self.player = None
        self.shower = None
        track_type = selected_track['type']
        self.mon.log(self, "Track type is: " + track_type)

        if track_type == "video":
            # create a videoplayer
            track_file = self.complete_path(selected_track)
            self.player = VideoPlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.page_callback,
                             enable_menu=False)

        elif track_type == "audio":
            # create a audioplayer
            track_file = self.complete_path(selected_track)
            self.player = AudioPlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.page_callback,
                             enable_menu=False)

        elif track_type == "image":
            track_file = self.complete_path(selected_track)
            self.player = ImagePlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(
                track_file,
                self.showlist,
                self.end_player,
                self.page_callback,
                enable_menu=False,
            )

        elif track_type == "web":
            # create a browser
            track_file = self.complete_path(selected_track)
            self.player = BrowserPlayer(self.show_id, self.root, self.canvas,
                                        self.show_params, selected_track,
                                        self.pp_dir, self.pp_home,
                                        self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.page_callback,
                             enable_menu=False)

        elif track_type == "message":
            # bit odd because MessagePlayer is used internally to display text.
            text = selected_track['text']
            self.player = MessagePlayer(self.show_id, self.root, self.canvas,
                                        self.show_params, selected_track,
                                        self.pp_dir, self.pp_home,
                                        self.pp_profile)
            self.player.play(text,
                             self.showlist,
                             self.end_player,
                             self.page_callback,
                             enable_menu=False)

        elif track_type == "show":
            self.enable_click_areas()
            # get the show from the showlist
            index = self.showlist.index_of_show(selected_track['sub-show'])
            if index >= 0:
                self.showlist.select(index)
                selected_show = self.showlist.selected_show()
            else:
                self.mon.err(
                    self, "Show not found in showlist: " +
                    selected_track['sub-show'])
                self.end("Unknown show")

            if selected_show['type'] == "mediashow":
                self.shower = MediaShow(selected_show, self.root, self.canvas,
                                        self.showlist, self.pp_dir,
                                        self.pp_home, self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "liveshow":
                self.shower = LiveShow(selected_show, self.root, self.canvas,
                                       self.showlist, self.pp_dir,
                                       self.pp_home, self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "radiobuttonshow":
                self.shower = RadioButtonShow(selected_show, self.root,
                                              self.canvas, self.showlist,
                                              self.pp_dir, self.pp_home,
                                              self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "hyperlinkshow":
                self.shower = HyperlinkShow(selected_show, self.root,
                                            self.canvas, self.showlist, self,
                                            pp_dir, self.pp_home,
                                            self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "menu":
                self.shower = MenuShow(selected_show, self.root, self.canvas,
                                       self.showlist, self.pp_dir,
                                       self.pp_home, self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')
            else:
                self.mon.err(self,
                             "Unknown Show Type: " + selected_show['type'])
                self.end("Unknown show type")

        else:
            self.mon.err(self, "Unknown Track Type: " + track_type)
            self.end("Unknown track type")
コード例 #4
0
    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
        else:
            enable_child = False

        #dispatch track by type
        self.player = None
        self.shower = None
        track_type = selected_track['type']
        self.mon.log(self, "Track type is: " + track_type)

        if track_type == "image":
            track_file = self.complete_path(selected_track)
            # images played from menus don't have children
            self.player = ImagePlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "video":
            # create a videoplayer
            track_file = self.complete_path(selected_track)
            self.player = VideoPlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "audio":
            # create a audioplayer
            track_file = self.complete_path(selected_track)
            self.player = AudioPlayer(self.show_id, self.root, self.canvas,
                                      self.show_params, selected_track,
                                      self.pp_dir, self.pp_home,
                                      self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "message":
            # bit odd because MessagePlayer is used internally to display text.
            text = selected_track['text']
            self.player = MessagePlayer(self.show_id, self.root, self.canvas,
                                        self.show_params, selected_track,
                                        self.pp_dir, self.pp_home,
                                        self.pp_profile)
            self.player.play(text,
                             self.showlist,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "web":
            # create a browser
            track_file = self.complete_path(selected_track)
            self.player = BrowserPlayer(self.show_id, self.root, self.canvas,
                                        self.show_params, selected_track,
                                        self.pp_dir, self.pp_home,
                                        self.pp_profile)
            self.player.play(track_file,
                             self.showlist,
                             self.end_player,
                             self.ready_callback,
                             enable_menu=enable_child)

        elif track_type == "show":
            # get the show from the showlist
            index = self.showlist.index_of_show(selected_track['sub-show'])
            if index >= 0:
                self.showlist.select(index)
                selected_show = self.showlist.selected_show()
            else:
                self.mon.err(
                    self, "Show not found in showlist: " +
                    selected_track['sub-show'])
                self.end_liveshow_signal = True

            if selected_show['type'] == "mediashow":
                self.shower = MediaShow(selected_show, self.root, self.canvas,
                                        self.showlist, self.pp_dir,
                                        self.pp_home, self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "menu":
                self.shower = MenuShow(selected_show, self.root, self.canvas,
                                       self.showlist, self.pp_dir,
                                       self.pp_home, self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "radiobuttonshow":
                self.shower = RadioButtonShow(selected_show, self.root,
                                              self.canvas, self.showlist,
                                              self.pp_dir, self.pp_home,
                                              self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            elif selected_show['type'] == "hyperlinkshow":
                self.shower = HyperlinkShow(selected_show, sef.root,
                                            self.canvas, self.showlist,
                                            self.pp_dir, self.pp_home,
                                            self.pp_profile)
                self.shower.play(self.show_id,
                                 self.end_shower,
                                 self.ready_callback,
                                 top=False,
                                 command='nil')

            else:
                self.mon.err(self,
                             "Unknown Show Type: " + selected_show['type'])
                self.end_liveshow_signal = True

        else:
            self.mon.err(self, "Unknown Track Type: " + track_type)
            self.end_liveshow_signal = True
コード例 #5
0
    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
        """
         #remove menu and show working.....        
        self.canvas.delete(ALL)
        if self.menu_timeout_running<>None:
            self.canvas.after_cancel(self.menu_timeout_running)
            self.menu_timeout_running=None
        self._display_eggtimer(self.resource('menushow','m01'))
    
        # dispatch track by type
        self.player=None
        self.shower=None
        track_type = selected_track['type']
        self.mon.log(self,"Track type is: "+ track_type)
        
        if track_type=="video":
            # create a videoplayer
            track_file=self.complete_path(selected_track)
            self.player=VideoPlayer(self.canvas,self.show,selected_track)
            self.player.play(track_file,
                                        self._end_player,
                                        self._delete_eggtimer,
                                        enable_menu=False)
                                        
        elif track_type=="image":
            # images played from menus don't have children
            enable_child=False
            track_file=self.complete_path(selected_track)
            self.player=ImagePlayer(self.canvas,self.show,selected_track)
            self.player.play(track_file,
                                    self._end_player,
                                    self._delete_eggtimer,
                                    enable_menu=enable_child,
                                    )
                                    
        elif track_type=="message":
            # bit odd because MessagePlayer is used internally to display text. 
            text=selected_track['text']
            self.player=MessagePlayer(self.canvas,self.show,selected_track)
            self.player.play(text,
                                    self._end_player,
                                    self._delete_eggtimer,
                                    enable_menu=False
                                    )
 
        elif track_type=="show":
            # get the show from the showlist
            index = self.showlist.index_of_show(selected_track['sub-show'])
            if index >=0:
                self.showlist.select(index)
                selected_show=self.showlist.selected_show()
            else:
                self.mon.err(self,"Show not found in showlist: "+ selected_track['sub-show'])
                self._end("Unknown show")
            
            if selected_show['type']=="mediashow":    
                self.shower= MediaShow(selected_show,
                                                                self.canvas,
                                                                self.showlist,
                                                                self.pp_home,
                                                                self.pp_profile)
                self.shower.play(self._end_shower,top=False,command='nil')

            elif selected_show['type']=="liveshow":    
                self.shower= LiveShow(selected_show,
                                                                self.canvas,
                                                                self.showlist,
                                                                self.pp_home,
                                                                self.pp_profile)
                self.shower.play(self.end_shower,top=False,command='nil')

            elif selected_show['type']=="menu": 
                self.shower= MenuShow(selected_show,
                                                        self.canvas,
                                                        self.showlist,
                                                        self.pp_home,
                                                        self.pp_profile)
                self.shower.play(self._end_shower,top=False,command='nil')                    
            else:
                self.mon.err(self,"Unknown Show Type: "+ selected_show['type'])
                self._end("Unknown show type")  
                
        else:
            self.mon.err(self,"Unknown Track Type: "+ track_type)
            self._end("Unknown track type")
コード例 #6
0
    def base_init_selected_player(self, selected_track):
        # dispatch track by type
        track_type = selected_track['type']
        self.mon.log(self, "Track type is: " + track_type)

        if track_type == "image":
            return ImagePlayer(self.show_id, self.showlist, self.root,
                               self.show_canvas, self.show_params,
                               selected_track, self.pp_dir, self.pp_home,
                               self.pp_profile, self.end,
                               self.command_callback)

        elif track_type == "video":
            return VideoPlayer(self.show_id, self.showlist, self.root,
                               self.show_canvas, self.show_params,
                               selected_track, self.pp_dir, self.pp_home,
                               self.pp_profile, self.end,
                               self.command_callback)

        elif track_type == "vlc":
            return VLCPlayer(self.show_id, self.showlist, self.root,
                             self.show_canvas, self.show_params,
                             selected_track, self.pp_dir, self.pp_home,
                             self.pp_profile, self.end, self.command_callback)

        elif track_type == "audio":
            return AudioPlayer(self.show_id, self.showlist, self.root,
                               self.show_canvas, self.show_params,
                               selected_track, self.pp_dir, self.pp_home,
                               self.pp_profile, self.end,
                               self.command_callback)

        elif track_type == "web" and self.show_params['type'] not in (
                'artmediashow', 'artliveshow'):
            return BrowserPlayer(self.show_id, self.showlist, self.root,
                                 self.show_canvas, self.show_params,
                                 selected_track, self.pp_dir, self.pp_home,
                                 self.pp_profile, self.end,
                                 self.command_callback)

        elif track_type == "chrome" and self.show_params['type'] not in (
                'artmediashow', 'artliveshow'):
            return ChromePlayer(self.show_id, self.showlist, self.root,
                                self.show_canvas, self.show_params,
                                selected_track, self.pp_dir, self.pp_home,
                                self.pp_profile, self.end,
                                self.command_callback)

        elif track_type == "message":
            return MessagePlayer(self.show_id, self.showlist, self.root,
                                 self.show_canvas, self.show_params,
                                 selected_track, self.pp_dir, self.pp_home,
                                 self.pp_profile, self.end,
                                 self.command_callback)

        elif track_type == "menu":
            return MenuPlayer(self.show_id, self.showlist, self.root,
                              self.show_canvas, self.show_params,
                              selected_track, self.pp_dir, self.pp_home,
                              self.pp_profile, self.end, self.command_callback)

        else:
            return None