예제 #1
0
파일: player.py 프로젝트: Stevie-Bs/ru
    def onAction(self, action):
        LogToXBMC('Action {} | ButtonCode {}'.format(action.getId(), action.getButtonCode()))
            
        if action in CANCEL_DIALOG:
            LogToXBMC('Closes player %s %s' % (action.getId(), action.getButtonCode()))
            self.close()
        elif action.getId() == MyPlayer.ACTION_RBC:
            LogToXBMC('CLOSE PLAYER 101 %s %s' % (action.getId(), action.getButtonCode()))
            self.close()
        elif action.getId() in (3, 4): 
            ############### IF ARROW UP AND DOWN PRESSED - SWITCH CHANNEL ###############
            if action.getId() == 3:
                self.channel_number += 1
                if self.channel_number >= self.parent.list.size():
                    self.channel_number = 1
            else:
                self.channel_number -= 1
                if self.channel_number <= 0:
                    self.channel_number = self.parent.list.size() - 1
            self.channel_number_str = str(self.channel_number)
            self.swinfo.setVisible(True) 
            li = self.parent.list.getListItem(self.channel_number)                            
            self.chinfo.setLabel(li.getLabel())
            defines.MyThread(self.UpdateEpg, li).start()
            if self.select_timer: 
                self.select_timer.cancel() 
                self.select_timer = None
            self.select_timer = threading.Timer(5, self.run_selected_channel)
            self.select_timer.start()
        elif action.getId() in MyPlayer.DIGIT_BUTTONS:
            ############# IF PRESSED DIGIT KEYS - SWITCH CHANNEL #######################
            self.channel_number_str += str(action.getId() - 58)  
            self.swinfo.setVisible(True) 
            self.channel_number = defines.tryStringToInt(self.channel_number_str) 
            li = self.parent.list.getListItem(self.channel_number)                            
            self.chinfo.setLabel(li.getLabel())
            defines.MyThread(self.UpdateEpg, li).start()
            if self.select_timer: 
                self.select_timer.cancel() 
                self.select_timer = None
            self.select_timer = threading.Timer(5, self.run_selected_channel)
            self.select_timer.start()   
        elif action.getId() == 0 and action.getButtonCode() == 61530:
            xbmc.executebuiltin('Action(FullScreen)')
            xbmc.sleep(4000)
            xbmc.executebuiltin('Action(Back)')
        else:
            defines.MyThread(self.UpdateEpg, self.li).start()

        if not self.visible:            
            if self.focusId == MyPlayer.CONTROL_WINDOW_ID:
                self.setFocusId(MyPlayer.CONTROL_BUTTON_PAUSE)
            else:
                self.setFocusId(self.focusId)
            self.setFocusId(self.getFocusId())
            self.control_window.setVisible(True)
            self.hide_control_window()
예제 #2
0
파일: player.py 프로젝트: Stevie-Bs/ru
 def run_selected_channel(self):
     self.channel_number = defines.tryStringToInt(self.channel_number_str)        
     LogToXBMC('CHANNEL NUMBER IS: %i' % self.channel_number)              
     if 0 < self.channel_number < self.parent.list.size() and self.parent.selitem_id != self.channel_number:            
         self.parent.selitem_id = self.channel_number
         self.Stop()    
     self.swinfo.setVisible(False)     
     self.channel_number = self.parent.selitem_id  
     self.chinfo.setLabel(self.parent.list.getListItem(self.parent.selitem_id).getLabel()) 
     self.channel_number_str = ''