Ejemplo n.º 1
0
 def setSkipDistance(self):
     if self.skip_first and self.config_event_start:
         logger.debug("position: %s, event_start: %s",
                      ptsToSeconds(self.getPosition()), self.event_start)
         if abs(self.getPosition() - self.event_start) <= secondsToPts(60):
             self.skip_distance = self.skip_distance_short
         else:
             self.skip_distance = self.skip_distance_long
         logger.debug("skip_distance: %s", self.skip_distance)
Ejemplo n.º 2
0
 def getRecordingPosition(self):
     position = 0
     path = self.service.getPath()
     recording = isRecording(path)
     if recording:
         position = secondsToPts(time() - self.recording_start_time)
     else:
         position = self.getPosition()
     return position
Ejemplo n.º 3
0
 def doEofInternal(self, playing):
     logger.info("playing: %s, self.execing: %s", playing, self.execing)
     if self.execing:
         if isRecording(self.service.getPath()):
             self.session.nav.playService(self.service)
             self.doSeekRelative(secondsToPts(-1))
         else:
             self.is_closing = True
         if self.leave_on_eof:
             self.leavePlayer()
Ejemplo n.º 4
0
 def getLength(self):
     length = 0
     if self.service.type == SID_DVB:
         length = self.__length
         if self.recording_start_time and self.event_start_time > self.recording_start_time:
             length += self.event_start_time - self.recording_start_time
         length = secondsToPts(length)
     else:
         length = self.getSeekLength()
     logger.info("length: %ss (%s)", ptsToSeconds(length), length)
     return length
Ejemplo n.º 5
0
 def skipForward(self):
     logger.info("...")
     self.reset_skip_timer.start(SKIP_TIMEOUT, True)
     self.setSkipDistance()
     if not self.skip_first and (
             not self.skip_forward or
         (self.config_skip_first_long and self.skip_distance
          == self.skip_distance_long and self.skip_index == 0)):
         self.skip_index = len(
             self.skip_distance) - 1 if self.skip_index >= len(
                 self.skip_distance) - 1 else self.skip_index + 1
     self.skip_forward = True
     self.skip_first = False
     distance = secondsToPts(self.skip_distance[self.skip_index])
     position = self.getPosition()
     length = self.getSeekLength() - secondsToPts(1)
     if position + distance > length:
         distance = max(0, length - position)
     logger.debug("distance: %s, position: %s, length: %s",
                  ptsToSeconds(distance), ptsToSeconds(position),
                  ptsToSeconds(length))
     if distance > 0 and not self.block_skip_timer.isActive():
         self.doSeekRelative(distance)
         self.block_skip_timer.start(BLOCK_TIMEOUT, True)
Ejemplo n.º 6
0
    def __init__(self, service, config_plugins_plugin):

        self.service = service
        self.config_plugins_plugin = config_plugins_plugin

        self.service_handler = ServiceCenter.getInstance()
        self.__length = self.service_handler.info(self.service).getLength()
        self.event_start_time = self.service_handler.info(
            self.service).getEventStartTime()
        self.recording_start_time = self.service_handler.info(
            self.service).getRecordingStartTime()
        event_start = self.event_start_time - self.recording_start_time
        self.event_start = secondsToPts(event_start) if event_start > 0 else 0
        CockpitSmartSeek.__init__(
            self, config_plugins_plugin.movie_start_position.value,
            self.event_start, True)
Ejemplo n.º 7
0
def MVCkeyOK(self):
    from MediaCenter import MediaCenter
    sel = self["config"].getCurrent()[1]
    if sel == self.positionEntry:
        if self.length:
            # seekTo() doesn't work for DVD Player
            oldPosition = self.seek.getPlayPosition()[1]
            newPosition = int(float(self.length[1]) / 100.0 * self.percent)
            if newPosition > oldPosition:
                pts = newPosition - oldPosition
            else:
                pts = -1 * (oldPosition - newPosition)
            MediaCenter.doSeekRelative(self.infobarInstance, pts)
            self.exit()
    elif sel == self.minuteInput:
        pts = secondsToPts(self.minuteInput.value * 60)
        if self.fwd is False:
            pts = -1 * pts
        MediaCenter.doSeekRelative(self.infobarInstance, pts)
        self.exit()
Ejemplo n.º 8
0
 def skipBackward(self):
     logger.info("...")
     self.reset_skip_timer.start(SKIP_TIMEOUT, True)
     self.setSkipDistance()
     if not self.skip_first and self.skip_forward:
         self.skip_index = len(
             self.skip_distance) - 1 if self.skip_index >= len(
                 self.skip_distance) - 1 else self.skip_index + 1
     self.skip_forward = False
     self.skip_first = False
     distance = secondsToPts(self.skip_distance[self.skip_index])
     position = self.getPosition()
     length = self.getSeekLength()
     if position - distance < 0:
         distance = position
     logger.debug("distance: %s, position: %s, length: %s",
                  ptsToSeconds(distance), ptsToSeconds(position),
                  ptsToSeconds(length))
     if not self.block_skip_timer.isActive():
         self.doSeekRelative(-distance)
         self.block_skip_timer.start(BLOCK_TIMEOUT, True)