예제 #1
0
    def actionDialogCallback(self, obj, action):
        airing = obj
        changes = {}

        if action:
            if action == 'watch':
                player.PLAYER.playAiringChannel(airing.gridAiring)
            elif action == 'record':
                airing.schedule()
                self.grid.updateChannelAiringData(
                    path=airing.gridAiring.channel['path'])
            elif action == 'unschedule':
                airing.schedule(False)
                self.grid.updateChannelAiringData(
                    path=airing.gridAiring.channel['path'])

            self.updateGridItem(airing, self.getFocusId())

        if airing.gridAiring.ended():
            secs = airing.gridAiring.secondsSinceEnd()
            changes['start'] = T(32144).format(util.durationToText(secs))
        else:
            self.setDialogButtons(airing, changes)

            secs = airing.gridAiring.secondsToStart()

            if secs < 1:
                start = T(32145).format(util.durationToText(secs * -1))
            else:
                start = T(32146).format(util.durationToText(secs))

            changes['start'] = start

        return changes
예제 #2
0
    def fillTracks(self):
        items = []
        idx = 0
        multiDisc = 0

        for track in self.album.tracks():
            disc = track.parentIndex.asInt()
            if disc > 1:
                if not multiDisc:
                    items.insert(0, kodigui.ManagedListItem(u'{0} 1'.format(T(32420, 'Disc').upper()), properties={'is.header': '1'}))

                if disc != multiDisc:
                    items[-1].setProperty('is.footer', '1')
                    multiDisc = disc
                    items.append(kodigui.ManagedListItem('{0} {1}'.format(T(32420, 'Disc').upper(), disc), properties={'is.header': '1'}))

            mli = self.createListItem(track)
            if mli:
                mli.setProperty('track.ID', track.ratingKey)
                mli.setProperty('index', str(idx))
                mli.setProperty('artist', self.album.parentTitle)
                mli.setProperty('disc', str(disc))
                mli.setProperty('album', self.album.title)
                mli.setProperty('number', '{0:0>2}'.format(track.index))
                items.append(mli)
                idx += 1

        if items:
            items[-1].setProperty('is.footer', '1')

        self.trackListControl.replaceItems(items)
예제 #3
0
    def updateAiringItem(self, airing):
        item = self.getAiringItem(airing)

        item.dataSource['airing'] = airing
        show = self._show or airing.getShow()

        self.setProperty('busy', '')

        if airing.type == 'schedule':
            label = show.title
        else:
            label = airing.title

        if not label:
            label = T(32147).format(airing.displayChannel(), airing.network,
                                    airing.displayTimeStart(),
                                    airing.displayTimeEnd())

        item.setLabel(label)
        item.setLabel2(airing.displayDay())
        item.setThumbnailImage(show.thumb)
        item.setProperty('show.title', show.title)

        if airing.recording():
            item.setProperty('duration', T(32169))
        else:
            item.setProperty(
                'duration',
                util.durationToText(airing.data['video_details']['duration']))

        self.updateItemIndicators(item)
예제 #4
0
    def optionsButtonClicked(self, pos=(670, 1060)):
        track = player.PLAYER.currentTrack()
        if not track:
            return

        options = []

        options.append({'key': 'to_album', 'display': T(32300, 'Go to Album')})
        options.append({
            'key': 'to_artist',
            'display': T(32301, 'Go to Artist')
        })
        options.append({
            'key':
            'to_section',
            'display':
            T(32302, u'Go to {0}').format(track.getLibrarySectionTitle())
        })

        choice = dropdown.showDropdown(options,
                                       pos,
                                       close_direction='down',
                                       pos_is_bottom=True,
                                       close_on_playback_ended=True)
        if not choice:
            return

        if choice['key'] == 'to_album':
            self.processCommand(opener.open(track.parentRatingKey))
        elif choice['key'] == 'to_artist':
            self.processCommand(opener.open(track.grandparentRatingKey))
        elif choice['key'] == 'to_section':
            self.goHome(track.getLibrarySectionId())
예제 #5
0
    def showUserMenu(self, mouse=False):
        items = []
        if plexapp.ACCOUNT.isSignedIn:
            if len(plexapp.ACCOUNT.homeUsers) > 1:
                items.append(kodigui.ManagedListItem(T(32342, 'Switch User'), data_source='switch'))
        items.append(kodigui.ManagedListItem(T(32343, 'Settings'), data_source='settings'))
        if plexapp.ACCOUNT.isSignedIn:
            items.append(kodigui.ManagedListItem(T(32344, 'Sign Out'), data_source='signout'))
        elif plexapp.ACCOUNT.isOffline:
            items.append(kodigui.ManagedListItem(T(32459, 'Offline Mode'), data_source='go_online'))
        else:
            items.append(kodigui.ManagedListItem(T(32460, 'Sign In'), data_source='signin'))

        if len(items) > 1:
            items[0].setProperty('first', '1')
            items[-1].setProperty('last', '1')
        else:
            items[0].setProperty('only', '1')

        self.userList.reset()
        self.userList.addItems(items)

        self.getControl(801).setHeight((len(items) * 66) + 80)

        if not mouse:
            self.setFocusId(self.USER_LIST_ID)
예제 #6
0
    def updateProperties(self):
        showTitle = self.show_ and self.show_.title or ''

        self.setProperty('background',
                         (self.show_
                          or self.season.show()).art.asTranscodedImageURL(
                              self.width,
                              self.height,
                              blur=128,
                              opacity=60,
                              background=colors.noAlpha.Background))
        self.setProperty(
            'season.thumb',
            self.season.thumb.asTranscodedImageURL(*self.POSTER_DIM))
        self.setProperty('show.title', showTitle)
        self.setProperty('season.title', self.season.title)
        self.setProperty(
            'episodes.header',
            u'{0} \u2022 {1} {2}'.format(showTitle, T(32303, 'Season'),
                                         self.season.index))
        self.setProperty(
            'extras.header',
            u'{0} \u2022 {1} {2}'.format(T(32305,
                                           'Extras'), T(32303, 'Season'),
                                         self.season.index))
        self.setProperty('related.header', T(32306, 'Related Shows'))
        self.genre = self.show_.genres() and self.show_.genres()[0].tag or ''
예제 #7
0
    def subtitleButtonClicked(self):
        options = []

        options.append({'key': 'download', 'display': T(32405, 'Download Subtitles')})
        if xbmc.getCondVisibility('VideoPlayer.HasSubtitles'):
            if xbmc.getCondVisibility('VideoPlayer.SubtitlesEnabled'):
                options.append({'key': 'delay', 'display': T(32406, 'Subtitle Delay')})
                options.append({'key': 'cycle', 'display': T(32407, 'Next Subtitle')})
            options.append(
                {
                    'key': 'enable',
                    'display': xbmc.getCondVisibility(
                        'VideoPlayer.SubtitlesEnabled + VideoPlayer.HasSubtitles'
                    ) and T(32408, 'Disable Subtitles') or T(32409, 'Enable Subtitles')
                }
            )

        choice = dropdown.showDropdown(options, (1360, 1060), close_direction='down', pos_is_bottom=True, close_on_playback_ended=True)

        if not choice:
            return

        if choice['key'] == 'download':
            self.hideOSD()
            builtin.ActivateWindow('SubtitleSearch')
        elif choice['key'] == 'delay':
            self.hideOSD()
            builtin.Action('SubtitleDelay')
        elif choice['key'] == 'cycle':
            builtin.Action('CycleSubtitle')
        elif choice['key'] == 'enable':
            builtin.Action('ShowSubtitles')
예제 #8
0
    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
예제 #9
0
    def setItemAudioAndSubtitleInfo(self, video, mli):
        sas = video.selectedAudioStream()
        mli.setProperty(
            'audio', sas and sas.getTitle(metadata.apiTranslate)
            or T(32309, 'None'))

        sss = video.selectedSubtitleStream()
        if sss:
            if len(video.subtitleStreams) > 1:
                mli.setProperty(
                    'subtitles', u'{0} \u2022 {1} {2}'.format(
                        sss.getTitle(metadata.apiTranslate),
                        len(video.subtitleStreams) - 1, T(32307, 'More')))
            else:
                mli.setProperty('subtitles',
                                sss.getTitle(metadata.apiTranslate))
        else:
            if video.subtitleStreams:
                mli.setProperty(
                    'subtitles',
                    u'{0} \u2022 {1} {2}'.format(T(32309, 'None'),
                                                 len(video.subtitleStreams),
                                                 T(32308, 'Available')))
            else:
                mli.setProperty('subtitles', T(32309, 'None'))
예제 #10
0
    def updateProperties(self):
        self.setProperty('title', self.mediaItem.title)
        self.setProperty('summary', self.mediaItem.summary)
        self.setProperty('thumb', self.mediaItem.defaultThumb.asTranscodedImageURL(*self.THUMB_DIMS[self.mediaItem.type]['main.thumb']))
        self.setProperty(
            'background',
            self.mediaItem.art.asTranscodedImageURL(self.width, self.height, blur=128, opacity=60, background=colors.noAlpha.Background)
        )
        self.setProperty('duration', util.durationToText(self.mediaItem.fixedDuration()))
        self.setProperty('info', '')
        self.setProperty('date', self.mediaItem.year)

        self.setProperty('extras.header', T(32305, 'Extras'))
        self.setProperty('related.header', T(32306, 'Related Shows'))

        if self.mediaItem.creator:
            self.setProperty('directors', u'{0}    {1}'.format(T(32418, 'Creator').upper(), self.mediaItem.creator))
        elif self.mediaItem.studio:
            self.setProperty('directors', u'{0}    {1}'.format(T(32386, 'Studio').upper(), self.mediaItem.studio))

        cast = u' / '.join([r.tag for r in self.mediaItem.roles()][:5])
        castLabel = T(32419, 'Cast').upper()
        self.setProperty('writers', cast and u'{0}    {1}'.format(castLabel, cast) or '')

        genres = self.mediaItem.genres()
        self.setProperty('info', genres and (u' / '.join([g.tag for g in genres][:3])) or '')

        self.setProperties(('rating.stars', 'rating', 'rating.image', 'rating2', 'rating2.image'), '')

        if self.mediaItem.userRating:
            stars = str(int(round((self.mediaItem.userRating.asFloat() / 10) * 5)))
            self.setProperty('rating.stars', stars)

        if self.mediaItem.ratingImage:
            rating = self.mediaItem.rating
            audienceRating = self.mediaItem.audienceRating
            if self.mediaItem.ratingImage.startswith('rottentomatoes:'):
                rating = '{0}%'.format(int(rating.asFloat() * 10))
                if audienceRating:
                    audienceRating = '{0}%'.format(int(audienceRating.asFloat() * 10))

            self.setProperty('rating', rating)
            self.setProperty('rating.image', 'script.plex/ratings/{0}.png'.format(self.mediaItem.ratingImage.replace('://', '/')))
            if self.mediaItem.audienceRatingImage:
                self.setProperty('rating2', audienceRating)
                self.setProperty('rating2.image', 'script.plex/ratings/{0}.png'.format(self.mediaItem.audienceRatingImage.replace('://', '/')))
        else:
            self.setProperty('rating', self.mediaItem.rating)

        sas = self.mediaItem.selectedAudioStream()
        self.setProperty('audio', sas and sas.getTitle() or 'None')

        sss = self.mediaItem.selectedSubtitleStream()
        self.setProperty('subtitles', sss and sss.getTitle() or 'None')

        leafcount = self.mediaItem.leafCount.asFloat()
        if leafcount:
            width = (int((self.mediaItem.viewedLeafCount.asInt() / leafcount) * self.width)) or 1
            self.progressImageControl.setWidth(width)
예제 #11
0
    def confirmExit(self):
        button = optionsdialog.show(
            T(32334, 'Confirm Exit'),
            T(32335, 'Are you ready to exit Plex?'),
            T(32336, 'Exit'),
            T(32337, 'Cancel')
        )

        return button == 0
예제 #12
0
    def optionsButtonClicked(self, item=None):
        options = []

        if item:
            if item.dataSource.isWatched:
                options.append({'key': 'mark_unwatched', 'display': T(32318, 'Mark Unplayed')})
            else:
                options.append({'key': 'mark_watched', 'display': T(32319, 'Mark Played')})

            # if False:
            #     options.append({'key': 'add_to_playlist', 'display': '[COLOR FF808080]Add To Playlist[/COLOR]'})
        else:
            if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'):
                options.append({'key': 'play_next', 'display': T(32325, 'Play Next')})

            # if xbmc.getCondVisibility('Player.HasAudio') and self.section.TYPE == 'artist':
            #     options.append({'key': 'add_to_queue', 'display': 'Add To Queue'})

            if options:
                options.append(dropdown.SEPARATOR)

            options.append({'key': 'to_artist', 'display': T(32301, 'Go to Artist')})
            options.append({'key': 'to_section', 'display': T(32302, u'Go to {0}').format(self.album.getLibrarySectionTitle())})

        pos = (460, 1106)
        bottom = True
        setDropdownProp = False
        if item:
            viewPos = self.trackListControl.getViewPosition()
            if viewPos > 6:
                pos = (1490, 312 + (viewPos * 100))
                bottom = True
            else:
                pos = (1490, 167 + (viewPos * 100))
                bottom = False
            setDropdownProp = True
        choice = dropdown.showDropdown(options, pos, pos_is_bottom=bottom, close_direction='right', set_dropdown_prop=setDropdownProp)
        if not choice:
            return

        if choice['key'] == 'play_next':
            xbmc.executebuiltin('PlayerControl(Next)')
        elif choice['key'] == 'mark_watched':
            media = item and item.dataSource or self.album
            media.markWatched()
            self.updateItems(item)
            util.MONITOR.watchStatusChanged()
        elif choice['key'] == 'mark_unwatched':
            media = item and item.dataSource or self.album
            media.markUnwatched()
            self.updateItems(item)
            util.MONITOR.watchStatusChanged()
        elif choice['key'] == 'to_artist':
            self.processCommand(opener.open(self.album.parentRatingKey))
        elif choice['key'] == 'to_section':
            self.goHome(self.album.getLibrarySectionId())
예제 #13
0
 def createEpisodeListItem(self, 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 = kodigui.ManagedListItem(episode.title, label2, thumbnailImage=episode.thumb.asTranscodedImageURL(*self.LI_AR16X9_THUMB_DIM), data_source=episode)
     mli.setProperty('track.duration', util.durationToShortText(episode.duration.asInt()))
     mli.setProperty('video', '1')
     mli.setProperty('watched', episode.isWatched and '1' or '')
     return mli
예제 #14
0
    def updateSelectedDetails(self):
        airing = self.getSelectedAiring()
        if not airing:
            return

        self.setProperty('background', airing.background)
        self.setProperty('thumb', airing.thumb)
        self.setProperty('title', airing.title)

        self.setProperty('info', airing.data.get('title', ''))
        if airing.type == 'movie' and airing.quality_rating:
            info = []
            if airing.film_rating:
                info.append(airing.film_rating.upper())
            if airing.release_year:
                info.append(str(airing.release_year))

            self.setProperty('info', u' / '.join(info) + u' /')
            self.setProperty('stars', str(airing.quality_rating / 2))
            self.setProperty('half.star', str(airing.quality_rating % 2))
        else:
            self.setProperty('stars', '0')
            self.setProperty('half.star', '')

        if airing.type == 'series':
            info = []
            if airing.data.get('title'):
                info.append(airing.data.get('title'))
            if airing.data.get('season_number'):
                info.append(T(32155).format(airing.data['season_number']))
            if airing.data.get('episode_number'):
                info.append(T(32158).format(airing.data['episode_number']))

            self.setProperty('info', u' / '.join(info))

        if airing.ended():
            secs = airing.secondsSinceEnd()
            start = T(32144).format(util.durationToText(secs))
        else:
            secs = airing.secondsToStart()

            if secs < 1:
                start = T(32145).format(util.durationToText(secs * -1))
            else:
                start = T(32146).format(util.durationToText(secs))

        if airing.conflicted:
            self.setProperty('indicator', 'indicators/conflict_pill_hd.png')
        elif airing.scheduled:
            self.setProperty('indicator', 'indicators/rec_pill_hd.png')
        else:
            self.setProperty('indicator', '')

        self.setProperty('start', start)
예제 #15
0
def showQualityDialog(video):
    options = [(13 - i, T(l)) for (i, l) in enumerate((32001, 32002, 32003, 32004, 32005, 32006, 32007, 32008, 32009,
                                                       32010, 32011))]

    choice = showOptionsDialog(T(32397, 'Quality'), options)
    if choice is None:
        return

    video.settings.setPrefOverride('local_quality', choice)
    video.settings.setPrefOverride('remote_quality', choice)
    video.settings.setPrefOverride('online_quality', choice)
예제 #16
0
    def setTitle(self):
        if self.section.TYPE == 'artist':
            self.setProperty('screen.title', T(32394, 'MUSIC').upper())
        elif self.section.TYPE in ('photo', 'photodirectory'):
            self.setProperty('screen.title', T(32349, 'photos').upper())
        else:
            self.setProperty(
                'screen.title',
                self.section.TYPE == 'show' and T(32393, 'TV SHOWS').upper()
                or T(32348, 'movies').upper())

        self.updateFilterDisplay()
예제 #17
0
    def airingClicked(self, airing):
        # while not airing and backgroundthread.BGThreader.working() and not xbmc.abortRequested:
        #     xbmc.sleep(100)
        #     airing = item.dataSource.get('airing')
        try:
            info = T(32143).format(airing.gridAiring.displayChannel(),
                                   airing.gridAiring.network,
                                   airing.gridAiring.displayDay(),
                                   airing.gridAiring.displayTimeStart(),
                                   airing.gridAiring.displayTimeEnd())
        except tablo.ConnectionError:
            xbmcgui.Dialog().ok(T(32161),
                                T(32157).format(tablo.API.device.displayName))
            return

        kwargs = {
            'number':
            airing.gridAiring.number,
            'background':
            airing.background,
            'callback':
            self.actionDialogCallback,
            'obj':
            airing,
            'start_indicator1':
            'new' in airing.qualifiers and 'indicators/qualifier_new_hd.png'
            or '',
            'start_indicator2':
            'live' in airing.qualifiers and 'indicators/qualifier_live_hd.png'
            or ''
        }

        self.setDialogButtons(airing, kwargs)

        if airing.type == 'movie':
            try:
                show = airing.gridAiring.getShow()
                description = show.plot or show.description
            except:
                util.ERROR()
                description = ''
        else:
            description = airing.gridAiring.description

        secs = airing.gridAiring.secondsToStart()

        if secs < 1:
            start = T(32145).format(util.durationToText(secs * -1))
        else:
            start = T(32146).format(util.durationToText(secs))

        actiondialog.openDialog(airing.title, info, description, start,
                                **kwargs)
예제 #18
0
 def onClick(self, controlID):
     if controlID == 300:
         self.showDevices()
     elif controlID == 200:
         mli = self.deviceList.getSelectedItem()
         if tablo.API.selectDevice(mli.dataSource.ID):
             util.saveTabloDeviceID(mli.dataSource.ID)
             self.exit = False
             self.doClose()
         else:
             xbmcgui.Dialog().ok(
                 T(32102),
                 T(32103).format(tablo.API.device.displayName))
예제 #19
0
    def optionsButtonClicked(self):
        options = []
        if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'):
            options.append({'key': 'play_next', 'display': 'Play Next'})

        if self.mediaItem.type != 'artist':
            if self.mediaItem.isWatched:
                options.append({
                    'key': 'mark_unwatched',
                    'display': T(32318, 'Mark Unplayed')
                })
            else:
                options.append({
                    'key': 'mark_watched',
                    'display': T(32319, 'Mark Played')
                })

        # if xbmc.getCondVisibility('Player.HasAudio') and self.section.TYPE == 'artist':
        #     options.append({'key': 'add_to_queue', 'display': 'Add To Queue'})

        # if False:
        #     options.append({'key': 'add_to_playlist', 'display': 'Add To Playlist'})

        options.append(dropdown.SEPARATOR)

        options.append({
            'key':
            'to_section',
            'display':
            u'Go to {0}'.format(self.mediaItem.getLibrarySectionTitle())
        })

        choice = dropdown.showDropdown(options, (880, 618),
                                       close_direction='left')
        if not choice:
            return

        if choice['key'] == 'play_next':
            xbmc.executebuiltin('PlayerControl(Next)')
        elif choice['key'] == 'mark_watched':
            self.mediaItem.markWatched()
            self.updateItems()
            self.updateProperties()
            util.MONITOR.watchStatusChanged()
        elif choice['key'] == 'mark_unwatched':
            self.mediaItem.markUnwatched()
            self.updateItems()
            self.updateProperties()
            util.MONITOR.watchStatusChanged()
        elif choice['key'] == 'to_section':
            self.goHome(self.mediaItem.getLibrarySectionId())
예제 #20
0
class ScheduledWindow(guide.GuideWindow):
    name = 'SCHEDULED'
    view = 'guide'
    state = 'scheduled'
    section = T(32195)
    emptyMessage = (T(32116), )

    types = ((None, ''), ('SERIES', ''), ('MOVIES', ''), ('SPORTS', ''))

    def onFirstInit(self):
        self.setProperty('hide.menu', '1')
        guide.GuideWindow.onFirstInit(self)

    def onReInit(self):
        self.setFilter()
        self.setProperty('hide.menu', '1')

        if not self._showingDialog and not WM.windowWasLast(self):
            self.fillShows(clear=True)

        self.setFocusId(self.SHOW_GROUP_ID)

    def onFocus(self, controlID):
        if controlID == 50:
            self.setShowFocus()
            guide.WM.showMenu()
            return

    @base.dialogFunction
    def showClicked(self):
        item = self.showList.getSelectedItem()
        if not item:
            return

        show = item.dataSource.get('show')

        if not show:
            self.getSingleShowData(item.dataSource['path'])
            while not show and backgroundthread.BGThreader.working(
            ) and not xbmc.abortRequested:
                xbmc.sleep(100)
                show = item.dataSource.get('show')
        if self.closing():
            return

        w = guide.GuideShowWindow.open(show=show)
        if w.modified:
            self.fillShows(clear=True)

        self.updateShowItem(show)
예제 #21
0
    def setupScheduleDialog(self):
        self.setProperty(
            'schedule.message',
            T(32188).format(util.LOCALIZED_RECORDING_TYPES_PLURAL[
                self._show.type].lower()))

        self.scheduleButtonActions = {}

        self.scheduleButtonActions[self.SCHEDULE_BUTTON_TOP_ID] = 'delete'
        self.scheduleButtonActions[self.SCHEDULE_BUTTON_BOT_ID] = 'cancel'
        self.setProperty('schedule.top.color', '52FF0000')
        self.setProperty(
            'schedule.top',
            T(32189).format(
                util.LOCALIZED_RECORDING_TYPES_PLURAL[self._show.type]))
        self.setProperty('schedule.bottom', T(32149))
예제 #22
0
def showAudioDialog(video):
    options = [(s, s.getTitle()) for s in video.audioStreams]
    choice = showOptionsDialog(T(32048, 'Audio'), options)
    if choice is None:
        return

    video.selectStream(choice)
예제 #23
0
 def onFirstInit(self):
     if self.updating and len(tablo.API.devices.tablos) < 2:
         name = tablo.API.device and tablo.API.device.name or 'Tablo'
         self.setProperty('updating', name)
         self.setProperty('tablo.found', '1')
         self.setProperty('initialized', '1')
         self._waitForUpdate()
         self.doClose()
     else:
         if self.updating:
             name = tablo.API.device and tablo.API.device.name or 'Tablo'
             xbmcgui.Dialog().ok(T(32100), T(32101).format(name))
         self.setProperty('updating', '')
         self.setProperty('tablo.found', '')
         self.setProperty('initialized', '')
         self.connect()
예제 #24
0
    def valueLabel(self):
        try:
            import platform
            dist = platform.dist()
            if dist and len(dist) > 1:
                plat = u'{0} {1}'.format(dist[0], dist[1])
            else:
                plat = platform.platform()
                plat = u'{0} {1}'.format(plat[0],
                                         '.'.join(plat[1].split('.', 2)[:2]))
        except:
            util.ERROR()

        plat = plat.strip()

        if not plat:
            if xbmc.getCondVisibility('System.Platform.Android'):
                plat = 'Android'
            elif xbmc.getCondVisibility('System.Platform.OSX'):
                plat = 'OSX'
            elif xbmc.getCondVisibility('System.Platform.Darwin'):
                plat = 'Darwin'
            elif xbmc.getCondVisibility('System.Platform.Linux.RaspberryPi'):
                plat = 'Linux (RPi)'
            elif xbmc.getCondVisibility('System.Platform.Linux'):
                plat = 'Linux'
            elif xbmc.getCondVisibility('System.Platform.Windows'):
                plat = 'Windows'

        return plat or T(32411, 'Unknown')
예제 #25
0
    def updateAiringItem(self, airing):
        item = self.airingItems[airing.path]
        item.setProperty('disabled', '')
        item.dataSource['airing'] = airing

        if airing.type == 'schedule':
            label = self._show.title
        else:
            label = airing.title

        if not label:
            label = T(32147).format(airing.displayChannel(), airing.network,
                                    airing.displayTimeStart(),
                                    airing.displayTimeEnd())

        item.setLabel(label)
        item.setLabel2(airing.displayDay())
        item.setProperty('number', str(airing.number or ''))
        item.setProperty('airing', airing.airingNow() and '1' or '')
        if 'new' in airing.qualifiers:
            item.setProperty('qualifier', 'indicators/qualifier_new_hd')
        else:
            item.setProperty(
                'qualifier',
                'live' in airing.qualifiers and 'indicators/qualifier_live_hd'
                or '')

        self.updateItemIndicators(item)
예제 #26
0
    def subOptionCallback(self, option):
        check = 'script.plex/home/device/check.png'
        options = None
        subKey = None
        if self.filter:
            if self.filter.get('sub'):
                subKey = self.filter['sub']['val']

        if option['type'] in ('year', 'decade', 'genre', 'contentRating',
                              'collection', 'director', 'actor', 'country',
                              'studio', 'resolution', 'labels', 'make',
                              'model', 'aperture', 'exposure', 'iso', 'lens'):
            options = [{
                'val': o.key,
                'display': o.title,
                'indicator': o.key == subKey and check or ''
            } for o in self.section.listChoices(option['type'])]
            if not options:
                options = [{
                    'val': None,
                    'display': T(32375, 'No filters available'),
                    'ignore': True
                }]

        return options
예제 #27
0
    def fillOnDeck(self):
        items = []
        idx = 0

        onDeckHub = self.hubs.get('tv.ondeck', self.hubs.get('movie.similar'))
        if not onDeckHub:
            self.onDeckListControl.reset()
            return False

        for ondeck in onDeckHub.items:
            title = ondeck.grandparentTitle or ondeck.title
            if ondeck.type == 'episode':
                #thumb = ondeck.defaultArt.asTranscodedImageURL(*self.THUMB_POSTER_DIM)
                thumb = ondeck.defaultArt.asTranscodedImageURL(
                    *self.ONDECK_DIM)
                #thumb = ondeck.thumb.asTranscodedImageURL(*self.ONDECK_DIM)
                #thumb = ondeck.defaultThumb.asTranscodedImageURL(*self.THUMB_POSTER_DIM)
            else:
                thumb = ondeck.defaultArt.asTranscodedImageURL(
                    *self.ONDECK_DIM)

            mli = kodigui.ManagedListItem(title or '',
                                          thumbnailImage=thumb,
                                          data_source=ondeck)
            if mli:
                mli.setProperty('index', str(idx))
                mli.setProperty(
                    'thumb.fallback',
                    'script.plex/thumb_fallbacks/{0}.png'.format(
                        ondeck.type in ('show', 'season', 'episode') and 'show'
                        or 'movie'))
                if ondeck.type in 'episode':
                    mli.setLabel2(u'{0}{1} \u2022 {2}{3}'.format(
                        T(32310, 'S'), ondeck.parentIndex, T(32311, 'E'),
                        ondeck.index))
                else:
                    mli.setLabel2(ondeck.year)

                items.append(mli)
                idx += 1

        if not items:
            return False

        self.onDeckListControl.reset()
        self.onDeckListControl.addItems(items)
        return True
예제 #28
0
    def setDialogIndicators(self, airing, show, arg_dict):
        if airing.type == 'schedule':
            description = show.description or ''
        else:
            description = airing.description or ''

        failed = airing.data['video_details']['state'] == 'failed'

        if failed:
            msg = RECORDING_FAILED_MESSAGES.get(
                airing.data['video_details']['error']['details'],
                RECORDING_FAILED_MESSAGES.get(None))
            description += u'[CR][CR][COLOR FFC81010]{0}[/COLOR]'.format(msg)
        else:
            if airing.watched:
                arg_dict['indicator'] = ''
            else:
                if airing.data['user_info']['position']:
                    arg_dict['indicator'] = 'indicators/seen_partial_hd.png'
                else:
                    arg_dict['indicator'] = 'indicators/seen_unwatched_hd.png'

            if airing.data['user_info']['position'] and not airing.recording():
                left = airing.data['video_details']['duration'] - airing.data[
                    'user_info']['position']
                total = airing.data['video_details']['duration']
                description += u'[CR][CR]{0}'.format(T(32168)).format(
                    util.durationToText(left), util.durationToText(total))
                arg_dict['seenratio'] = airing.data['user_info'][
                    'position'] / float(total)
                arg_dict['seen'] = airing.data['user_info']['position']
            else:
                if airing.recording():
                    description += u'[CR][CR]{1}'.format(T(32169))
                    if airing.data['user_info']['position']:
                        arg_dict['seen'] = airing.data['user_info']['position']
                else:
                    description += '[CR][CR]{0}: {1}'.format(
                        T(32170),
                        util.durationToText(
                            airing.data['video_details']['duration']))
                    arg_dict['seen'] = None

                arg_dict['seenratio'] = None

        arg_dict['plot'] = description
예제 #29
0
def showSubtitlesDialog(video):
    options = [(s, s.getTitle()) for s in video.subtitleStreams]
    options.insert(0, (plexnet.plexstream.NoneStream(), 'None'))
    choice = showOptionsDialog(T(32396, 'Subtitles'), options)
    if choice is None:
        return

    video.selectStream(choice)
예제 #30
0
 def editInteger(self, mli, setting):
     result = xbmcgui.Dialog().input(T(32417, 'Enter Port Number'),
                                     str(setting.get()),
                                     xbmcgui.INPUT_NUMERIC)
     if not result:
         return
     setting.set(int(result))
     mli.setLabel2(result)