def updateCurrent(self): ratio = self.trueOffset() / float(self.duration) w = int(ratio * self.SEEK_IMAGE_WIDTH) self.positionControl.setWidth(w) to = self.trueOffset() self.setProperty('time.current', util.timeDisplay(to)) self.setProperty('time.left', util.timeDisplay(self.duration - to)) self.setProperty('time.end', time.strftime('%I:%M %p', time.localtime(time.time() + ((self.duration - to) / 1000))).lstrip('0'))
def updateProperties(self, **kwargs): if not self.started: return if self.fromSeek: self.setFocusId(self.MAIN_BUTTON_ID) self.fromSeek = 0 self.setProperty('has.bif', self.bifURL and '1' or '') self.setProperty('video.title', self.title) self.setProperty('video.title2', self.title2) self.setProperty('is.show', (self.player.video.type == 'episode') and '1' or '') self.setProperty('time.left', util.timeDisplay(self.duration)) pq = self.handler.playlist if pq: self.setProperty('has.playlist', '1') self.setProperty('pq.isRemote', pq.isRemote and '1' or '') self.setProperty('pq.hasnext', pq.hasNext() and '1' or '') self.setProperty('pq.hasprev', pq.hasPrev() and '1' or '') self.setProperty('pq.repeat', pq.isRepeat and '1' or '') self.setProperty('pq.repeat.one', pq.isRepeatOne and '1' or '') self.setProperty('pq.shuffled', pq.isShuffled and '1' or '') else: self.setProperties(('pq.isRemote', 'pq.hasnext', 'pq.hasprev', 'pq.repeat', 'pq.shuffled', 'has.playlist'), '') self.updateCurrent() div = int(self.duration / 12) items = [] for x in range(12): offset = div * x items.append(kodigui.ManagedListItem(data_source=offset)) self.bigSeekControl.reset() self.bigSeekControl.addItems(items)
def updateCurrent(self, update_position_control=True): ratio = self.trueOffset() / float(self.duration) if update_position_control: w = int(ratio * self.SEEK_IMAGE_WIDTH) self.positionControl.setWidth(w) to = self.trueOffset() self.setProperty('time.current', util.timeDisplay(to)) self.setProperty('time.left', util.timeDisplay(self.duration - to)) _fmt = util.timeFormat.replace(":%S", "") val = time.strftime( _fmt, time.localtime(time.time() + ((self.duration - to) / 1000))) if not util.padHour and val[0] == "0" and val[1] != ":": val = val[1:] self.setProperty('time.end', val)
def getPlaylistResume(self, pl, items, title): resume = False watched = False for i in items: if (watched and not i.isWatched) or i.get('viewOffset').asInt(): if i.get('viewOffset'): choice = dropdown.showDropdown( options=[{ 'key': 'resume', 'display': T(32429, 'Resume from {0}').format( util.timeDisplay(i.viewOffset.asInt()).lstrip( '0').lstrip(':')) }, { 'key': 'play', 'display': T(32317, 'Play from beginning') }], pos=(660, 441), close_direction='none', set_dropdown_prop=False, header=u'{0} - {1}{2} \u2022 {3}{4}'.format( title, T(32310, 'S'), i.parentIndex, T(32311, 'E'), i.index)) if not choice: return None if choice['key'] == 'resume': resume = True pl.setCurrent(i) break elif i.isWatched: watched = True else: break return resume