示例#1
0
 def _trackCommercials(self):
     """Method run in a separate thread to skip over commercials"""
     try:
         if len(self._breaks) == 0:
             log.debug('Recording %s has no comm breaks, exiting comm tracker' % safe_str(self.program.title()))
             return
         
         while self.player.isPlaying():
             pos = self.player.getTime()
             if self._isInBreak(pos) and not self._currentBreak.skipped:
                 log.debug('entered comm break = %s' % self._currentBreak)
                 if self._isCloseToStartOfCommercial(pos) and not self._wasUserSkippingAround(pos): 
                     log.debug('Comm skip activated!')
                     showPopup(self.program.title(), self.translator.get(m.SKIPPING_COMMERCIAL) % formatSeconds(self._currentBreak.duration()), 3000)
                     self.player.seekTime(self._currentBreak.end)
                     self._waitForPlayerToPassCommercialBreak()
                     self._currentBreak.skipped = True
                     
                 if self._landedInCommercial(pos):
                     log.debug("Landed in comm break and want to skip forward")  
                     showPopup(self.program.title(), self.translator.get(m.FORWARDING_THROUGH) % formatSeconds(self._currentBreak.duration()), 3000)
                     self.player.seekTime(self._currentBreak.end)
                     self._waitForPlayerToPassCommercialBreak()
                     self._currentBreak.skipped = True
             xbmc.sleep(SLEEP_MILLIS)
         log.debug('Commercial tracker thread exiting')
     except:
         log.exception('_trackCommercials catchall')
示例#2
0
文件: home.py 项目: Jajcus/mythbox
 def startup(self):
     """
     @return: True if startup successful, False otherwise
     """
     self.settingsOK = False
     try:
         self.settings.verify()
         self.settingsOK = True
     except SettingsException, se:
         showPopup(self.t(m.ERROR), safe_str(se), 7000)
         if se.wakeup and self.settings.get("wakeup_command"):
             showPopup(self.t(m.INFO), "Waking the backend up", 7000)
             subprocess.call(self.settings.get("wakeup_command"),
                             shell=True)
             time.sleep(int(self.settings.get("wakeup_wait")))
             try:
                 self.settings.verify()
                 self.settingsOK = True
             except SettingsException:
                 pass
         if not self.settingsOK:
             self.goSettings()
             try:
                 self.settings.verify() # TODO: optimize unnecessary re-verify
                 self.settingsOK = True
             except SettingsException:
                 self.shutdown()
                 self.close()
                 return False
示例#3
0
    def _resumeFromBookmark(self):
        log.debug('bookmarker : before wait for gotFPS')
        
#        # wait for fps to be set by log scaper for a max of 10 seconds
#        cnt = 0
#        while self.fps is None and cnt < 100:
#            time.sleep(0.1)
#            cnt += 1
#        
#        if self.fps is None:
#            log.warn('Timed out waiting for fps to be set on bookmarker')
#        else:
#            log.debug('bookmarker : after wait for gotFPS')
                
        bookmarkSecs = self.program.getBookmark()
        if bookmarkSecs > 0 and bookmarkSecs < (self.program.getDuration() * 60):
            fb = formatSeconds(bookmarkSecs)
            log.debug('Resuming recording at bookmarked position of %s' % fb)
            showPopup(self.program.title(), self.translator.get(m.RESUMING_AT) % fb)
            self.player.seekTime(bookmarkSecs)
            while self.player.getTime() < bookmarkSecs:
                log.debug('Waiting for player time %s to seek past bookmark of %s' %(formatSeconds(self.player.getTime()), fb))
                xbmc.sleep(SLEEP_MILLIS)
        else:
            log.debug('Recording has no bookmark or bookmark exceeds program length')
示例#4
0
    def _resumeFromBookmark(self):
        log.debug('bookmarker : before wait for gotFPS')

        #        # wait for fps to be set by log scaper for a max of 10 seconds
        #        cnt = 0
        #        while self.fps is None and cnt < 100:
        #            time.sleep(0.1)
        #            cnt += 1
        #
        #        if self.fps is None:
        #            log.warn('Timed out waiting for fps to be set on bookmarker')
        #        else:
        #            log.debug('bookmarker : after wait for gotFPS')

        bookmarkSecs = self.program.getBookmark()
        if bookmarkSecs > 0 and bookmarkSecs < (self.program.getDuration() *
                                                60):
            fb = formatSeconds(bookmarkSecs)
            log.debug('Resuming recording at bookmarked position of %s' % fb)
            showPopup(self.program.title(),
                      self.translator.get(m.RESUMING_AT) % fb)
            self.player.seekTime(bookmarkSecs)
            while self.player.getTime() < bookmarkSecs:
                log.debug(
                    'Waiting for player time %s to seek past bookmark of %s' %
                    (formatSeconds(self.player.getTime()), fb))
                xbmc.sleep(SLEEP_MILLIS)
        else:
            log.debug(
                'Recording has no bookmark or bookmark exceeds program length')
示例#5
0
 def doRefreshFanart(self):
     self.fanArt.clear(self.program)
     self.refresh()
     self.bus.publish({
         'id': Event.FANART_REFRESHED,
         'program': self.program
     })
     toolkit.showPopup('Fan Art',
                       'Refreshed Fan Art for %s' % self.program.title(),
                       5000)
示例#6
0
文件: player.py 项目: Jajcus/mythbox
 def _resumeFromBookmark(self):
     log.debug('bookmarker : before wait for gotFPS')
     
     bookmarkSecs = self.program.getBookmark()
     if bookmarkSecs > 0 and bookmarkSecs < (self.program.getDuration() * 60):
         fb = formatSeconds(bookmarkSecs)
         log.debug('Resuming recording at bookmarked position of %s' % fb)
         showPopup(self.program.title(), self.translator.get(m.RESUMING_AT) % fb)
         self.player.seekTime(bookmarkSecs)
         while self.player.getTime() < bookmarkSecs:
             log.debug('Waiting for player time %s to seek past bookmark of %s' %(formatSeconds(self.player.getTime()), fb))
             xbmc.sleep(SLEEP_MILLIS)
     else:
         log.debug('Recording has no bookmark or bookmark exceeds program length')
 def startup(self):
     """
     @return: True if startup successful, False otherwise
     """
     self.settingsOK = False
     try:
         self.settings.verify()
         self.settingsOK = True
     except SettingsException, se:
         showPopup(self.t(m.ERROR), safe_str(se), 7000)
         self.goSettings()
         try:
             self.settings.verify() # TODO: optimize unnecessary re-verify
             self.settingsOK = True
         except SettingsException:
             self.shutdown()
             self.close()
             return False
示例#8
0
 def startup(self):
     """
     @return: True if startup successful, False otherwise
     """
     self.settingsOK = False
     try:
         self.settings.verify()
         self.settingsOK = True
     except SettingsException, se:
         showPopup(self.t(m.ERROR), safe_str(se), 7000)
         self.goSettings()
         try:
             self.settings.verify()  # TODO: optimize unnecessary re-verify
             self.settingsOK = True
         except SettingsException:
             self.shutdown()
             self.close()
             return False
示例#9
0
    def _resumeFromBookmark(self):
        log.debug('bookmarker : before wait for gotFPS')

        bookmarkSecs = self.program.getBookmark()
        if bookmarkSecs > 0 and bookmarkSecs < (self.program.getDuration() *
                                                60):
            fb = formatSeconds(bookmarkSecs)
            log.debug('Resuming recording at bookmarked position of %s' % fb)
            showPopup(self.program.title(),
                      self.translator.get(m.RESUMING_AT) % fb)
            self.player.seekTime(bookmarkSecs)
            while self.player.getTime() < bookmarkSecs:
                log.debug(
                    'Waiting for player time %s to seek past bookmark of %s' %
                    (formatSeconds(self.player.getTime()), fb))
                xbmc.sleep(SLEEP_MILLIS)
        else:
            log.debug(
                'Recording has no bookmark or bookmark exceeds program length')
示例#10
0
    def _trackCommercials(self):
        """Method run in a separate thread to skip over commercials"""
        try:
            if len(self._breaks) == 0:
                log.debug(
                    'Recording %s has no comm breaks, exiting comm tracker' %
                    safe_str(self.program.title()))
                return

            while self.player.isPlaying():
                pos = self.player.getTime()
                if self._isInBreak(pos) and not self._currentBreak.skipped:
                    log.debug('entered comm break = %s' % self._currentBreak)
                    if self._isCloseToStartOfCommercial(
                            pos) and not self._wasUserSkippingAround(pos):
                        log.debug('Comm skip activated!')
                        showPopup(
                            self.program.title(),
                            self.translator.get(m.SKIPPING_COMMERCIAL) %
                            formatSeconds(self._currentBreak.duration()), 3000)
                        self.player.seekTime(self._currentBreak.end)
                        self._waitForPlayerToPassCommercialBreak()
                        self._currentBreak.skipped = True

                    if self._landedInCommercial(pos):
                        log.debug(
                            "Landed in comm break and want to skip forward")
                        showPopup(
                            self.program.title(),
                            self.translator.get(m.FORWARDING_THROUGH) %
                            formatSeconds(self._currentBreak.duration()), 3000)
                        self.player.seekTime(self._currentBreak.end)
                        self._waitForPlayerToPassCommercialBreak()
                        self._currentBreak.skipped = True
                xbmc.sleep(SLEEP_MILLIS)
            log.debug('Commercial tracker thread exiting')
        except:
            log.exception('_trackCommercials catchall')
示例#11
0
 def doRefreshFanart(self):
     self.fanArt.clear(self.program)
     self.refresh()
     self.bus.publish({'id' : Event.FANART_REFRESHED, 'program' : self.program})
     toolkit.showPopup('Fan Art', 'Refreshed Fan Art for %s' % self.program.title(), 5000)
示例#12
0
 def queueJob(self, jobType):
     job = Job.fromProgram(self.program, jobType)
     self.db().addJob(job)
     numJobs = len(self.db().getJobs(jobStatus=JobStatus.QUEUED))
     toolkit.showPopup('Job Queue', 'Queued as job %d of %d ' % (numJobs,numJobs), 5000)
示例#13
0
 def queueJob(self, jobType):
     job = Job.fromProgram(self.program, jobType)
     self.db().addJob(job)
     numJobs = len(self.db().getJobs(jobStatus=JobStatus.QUEUED))
     toolkit.showPopup('Job Queue',
                       'Queued as job %d of %d ' % (numJobs, numJobs), 5000)
示例#14
0
 def doRefreshFanart(self):
     log.debug("Refreshing fanart")
     self.fanArt.clear(self.program)
     self.refresh()
     self.bus.publish({"id": Event.FANART_REFRESHED, "program": self.program})
     toolkit.showPopup("Fan Art", "Refreshed Fan Art for %s" % self.program.title(), 5000)