Ejemplo n.º 1
0
 def getFrameRate(self):
     """
     Extracts the FPS from the physical file on first call and returns 
     the cached value thereafter as a float. Requires ffmpeg
     """
     if not self._fps:
         ffmpegParser = FFMPEG(
             ffmpeg=self.settings.get('paths_ffmpeg'),
             closeFDs=(type(self._platform) != util.WindowsPlatform))  # close_fds borked on windows
         
         try:
             metadata = ffmpegParser.get_metadata(self.getLocalPath())
         except:
             log.exception('ffmpeg parsing failed')
             metadata = None
             
         log.debug('ffmpeg metadata for %s = %s' % (self.getLocalPath(), metadata))
         if metadata:
             self._fps = float(metadata.frame_rate)
         else:
             self._fps = 29.97
             log.error("""Could not determine FPS for file %s so defaulting to %s FPS.
                          Make sure you have the ffmpeg executable in your path. 
                          Commercial skipping may be inaccurate""" % (self._fps, self.getLocalPath()))
             ui.showPopup('Error', 'FFMpeg could not determine framerate. Comm skip may be inaccurate')
     return self._fps
Ejemplo n.º 2
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' %
                    self._program.title())
                return

            while self._player.isPlaying():
                pos = self._player.getTime()
                if self._isInBreak(pos):
                    log.debug('entered comm break = %s' % self._currentBreak)
                    if self._isCloseToStartOfCommercial(
                            pos) and not self._wasUserSkippingAround(pos):
                        log.debug('Comm skip activated!')
                        ui.showPopup(
                            self._program.title(),
                            'Skipping commercial %s' % mythtv.formatSeconds(
                                self._currentBreak.duration()))
                        self._player.seekTime(self._currentBreak.end)
                        self._waitForPlayerToPassCommercialBreak()
                    else:
                        log.debug(
                            'Position in comm skip region but not activated')
                xbmc.sleep(SLEEP_MILLIS)
            log.debug('Commercial tracker thread exiting')
        except:
            log.exception('_trackCommercials catchall')
Ejemplo n.º 3
0
 def _resumeFromBookmark(self):
     bookmarkSecs = self._program.getBookmark()
     if bookmarkSecs > 0:
         fb = mythtv.formatSeconds(bookmarkSecs)
         log.debug('Resuming recording at bookmarked position of %s' % fb)
         ui.showPopup(self._program.title(), 'Resuming at %s)' %(fb))
         self._player.seekTime(bookmarkSecs)
         while self._player.getTime() < bookmarkSecs:
             log.debug('Waiting for player time %s to seek past bookmark of %s' %(
                 mythtv.formatSeconds(self._player.getTime()), fb))
             xbmc.sleep(SLEEP_MILLIS)
     else:
         log.debug('Recording has no bookmark')
Ejemplo n.º 4
0
 def _resumeFromBookmark(self):
     bookmarkSecs = self._program.getBookmark()
     if bookmarkSecs > 0:
         fb = mythtv.formatSeconds(bookmarkSecs)
         log.debug('Resuming recording at bookmarked position of %s' % fb)
         ui.showPopup(self._program.title(), 'Resuming at %s)' % (fb))
         self._player.seekTime(bookmarkSecs)
         while self._player.getTime() < bookmarkSecs:
             log.debug(
                 'Waiting for player time %s to seek past bookmark of %s' %
                 (mythtv.formatSeconds(self._player.getTime()), fb))
             xbmc.sleep(SLEEP_MILLIS)
     else:
         log.debug('Recording has no bookmark')
Ejemplo n.º 5
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' % self._program.title())
             return
         
         while self._player.isPlaying():
             pos = self._player.getTime()
             if self._isInBreak(pos):
                 log.debug('entered comm break = %s' % self._currentBreak)
                 if self._isCloseToStartOfCommercial(pos) and not self._wasUserSkippingAround(pos): 
                     log.debug('Comm skip activated!')
                     ui.showPopup(self._program.title(), 
                         'Skipping commercial %s' % mythtv.formatSeconds(self._currentBreak.duration()))
                     self._player.seekTime(self._currentBreak.end)
                     self._waitForPlayerToPassCommercialBreak()
                 else:
                     log.debug('Position in comm skip region but not activated')
             xbmc.sleep(SLEEP_MILLIS)
         log.debug('Commercial tracker thread exiting')
     except:
         log.exception('_trackCommercials catchall')