Exemplo n.º 1
0
    def setPosition(self, position):
        position = min(position, self.maxTimestamp)

        self.setProperty('current', util.durationToShortText(position))

        util.DEBUG_LOG('TrickMode: Setting position at {0} of {1}'.format(
            position, self.duration))

        if not (self.maxTimestamp):
            return

        self.setProgress(position)
        self.setProgressSelect(position)

        if self.bif:
            i = -1
            for i, frame in enumerate(self.bif.frames):
                if position > frame['timestamp']:
                    continue
                break
            i -= 1

            if i >= 0:
                self.select = i
        else:
            timestamp = 0
            for i, segment in enumerate(self.playlist.segments):
                timestamp += segment.duration
                if timestamp > position:
                    self.select = i
                    break
            else:
                self.select = 0
Exemplo n.º 2
0
 def createMovieListItem(self, mli, movie):
     mli.setLabel2(movie.year)
     mli.setThumbnailImage(
         movie.art.asTranscodedImageURL(*self.LI_AR16X9_THUMB_DIM))
     mli.setProperty('track.duration',
                     util.durationToShortText(movie.duration.asInt()))
     mli.setProperty('video', '1')
     mli.setProperty('watched', movie.isWatched and '1' or '')
Exemplo n.º 3
0
    def setProgressSelect(self, position):
        if not self.started:
            return

        x = self.PROGRESS_SELECT_IMAGE_X + int(
            (position / float(self.maxTimestamp)) * self.PROGRESS_WIDTH)
        self.progressSelectImage.setPosition(x, self.PROGRESS_SELECT_IMAGE_Y)

        self.setProperty('select', util.durationToShortText(position))
Exemplo n.º 4
0
 def createEpisodeListItem(self, mli, episode):
     label2 = u'{0} \u2022 {1}'.format(
         episode.grandparentTitle, u'{0}{1} \u2022 {2}{3}'.format(T(32310, 'S'), episode.parentIndex, T(32311, 'E'), episode.index)
     )
     mli.setLabel2(label2)
     mli.setThumbnailImage(episode.thumb.asTranscodedImageURL(*self.LI_AR16X9_THUMB_DIM))
     mli.setProperty('track.duration', util.durationToShortText(episode.duration.asInt()))
     mli.setProperty('video', '1')
     mli.setProperty('watched', episode.isWatched and '1' or '')
Exemplo n.º 5
0
    def onFirstInit(self):
        self.imageList = kodigui.ManagedControlList(self, self.IMAGE_LIST_ID,
                                                    4)
        self.progressImage = self.getControl(self.PROGRESS_IMAGE_ID)
        self.progressSelectImage = self.getControl(
            self.PROGRESS_SELECT_IMAGE_ID)

        self.fillImageList()

        self.setProperty('end', util.durationToShortText(self.duration))
Exemplo n.º 6
0
 def createMovieListItem(self, movie):
     mli = kodigui.ManagedListItem(
         movie.title,
         movie.year,
         thumbnailImage=movie.art.asTranscodedImageURL(
             *self.LI_AR16X9_THUMB_DIM),
         data_source=movie)
     mli.setProperty('track.duration',
                     util.durationToShortText(movie.duration.asInt()))
     mli.setProperty('video', '1')
     mli.setProperty('watched', movie.isWatched and '1' or '')
     return mli
Exemplo n.º 7
0
    def startTimer(self):
        if not util.getSetting('post_play_auto', True):
            util.DEBUG_LOG('Post play auto-play disabled')
            return

        if not self.next:
            return

        if time.time() > self.passoutProtection and self.prev.duration.asInt(
        ) > PASSOUT_LAST_VIDEO_DURATION_MILLIS:
            util.DEBUG_LOG('Post play auto-play skipped: Passout protection')
            return
        else:
            millis = (self.passoutProtection - time.time()) * 1000
            util.DEBUG_LOG(
                'Post play auto-play: Passout protection in {0}'.format(
                    util.durationToShortText(millis)))

        util.DEBUG_LOG('Staring post-play timer')
        self.timeout = time.time() + 16
        threading.Thread(target=self.countdown).start()