def roleClicked(self): mli = self.rolesListControl.getSelectedItem() if not mli: return sectionRoles = busy.widthDialog(mli.dataSource.sectionRoles, '') if not sectionRoles: util.DEBUG_LOG('No sections found for actor') return if len(sectionRoles) > 1: x, y = self.getRoleItemDDPosition() options = [{ 'role': r, 'display': r.reasonTitle } for r in sectionRoles] choice = dropdown.showDropdown(options, (x, y), pos_is_bottom=True, close_direction='bottom') if not choice: return role = choice['role'] else: role = sectionRoles[0] self.processCommand(opener.open(role))
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
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())
def shutdownClicked(self): options = [] options.append({'key': 'sign_out', 'display': T(32421, 'Sign Out')}) options.append({'key': 'exit', 'display': T(32422, 'Exit')}) if util.getSetting('kiosk.mode', False): if xbmc.getCondVisibility('System.CanPowerDown'): options.append({'key': 'shutdown', 'display': T(32423, 'Shutdown')}) if xbmc.getCondVisibility('System.CanSuspend'): options.append({'key': 'suspend', 'display': T(32424, 'Suspend')}) if xbmc.getCondVisibility('System.CanHibernate'): options.append({'key': 'hibernate', 'display': T(32425, 'Hibernate')}) if xbmc.getCondVisibility('System.CanReboot'): options.append({'key': 'reboot', 'display': T(32426, 'Reboot')}) with self.propertyContext('dropdown'): choice = dropdown.showDropdown(options, (60, 101)) if not choice: return if choice['key'] == 'sign_out': self.selected = 'signout' self.doClose() elif choice['key'] == 'exit': self.doClose() elif choice['key'] == 'shutdown': xbmc.executebuiltin('Powerdown()') elif choice['key'] == 'suspend': xbmc.executebuiltin('Suspend()') elif choice['key'] == 'hibernate': xbmc.executebuiltin('Hibernate()') elif choice['key'] == 'reboot': xbmc.executebuiltin('Reset()')
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')
def optionsButtonClicked(self): options = [] # if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'): # options.append({'key': 'play_next', 'display': 'Play Next'}) if len(self.video.media) > 1: options.append({'key': 'play_version', 'display': T(32451, 'Play Version...')}) if self.video.isWatched: options.append({'key': 'mark_unwatched', 'display': T(32318, 'Mark Unwatched')}) else: options.append({'key': 'mark_watched', 'display': T(32319, 'Mark Watched')}) options.append(dropdown.SEPARATOR) if self.video.type == 'episode': options.append({'key': 'to_season', 'display': T(32400, 'Go to Season')}) options.append({'key': 'to_show', 'display': T(32323, 'Go to Show')}) if self.video.type in ('episode', 'movie'): options.append({'key': 'to_section', 'display': T(32324, u'Go to {0}').format(self.video.getLibrarySectionTitle())}) if self.video.server.allowsMediaDeletion: options.append({'key': 'delete', 'display': T(32322, 'Delete')}) # 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'}) posy = 880 if not util.getGlobalProperty('hide.resume'): posy += 106 if self.getProperty('trailer.button'): posy += 106 choice = dropdown.showDropdown(options, (posy, 618), close_direction='left') if not choice: return if choice['key'] == 'play_version': self.playVideo(play_version=True) elif choice['key'] == 'play_next': xbmc.executebuiltin('PlayerControl(Next)') elif choice['key'] == 'mark_watched': self.video.markWatched() self.refreshInfo() util.MONITOR.watchStatusChanged() elif choice['key'] == 'mark_unwatched': self.video.markUnwatched() self.refreshInfo() util.MONITOR.watchStatusChanged() elif choice['key'] == 'to_season': self.processCommand(opener.open(self.video.parentRatingKey)) elif choice['key'] == 'to_show': self.processCommand(opener.open(self.video.grandparentRatingKey)) elif choice['key'] == 'to_section': self.goHome(self.video.getLibrarySectionId()) elif choice['key'] == 'delete': self.delete()
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': 'Mark Unwatched' }) else: options.append({ 'key': 'mark_watched', 'display': 'Mark Watched' }) # 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())
def chooseVersion(video): if len(video.media) > 1: options = [] for media in video.media: ind = '' if video.mediaChoice and media.id == video.mediaChoice.media.id: ind = 'script.plex/home/device/check.png' options.append({'key': media, 'display': media.versionString(), 'indicator': ind}) choice = dropdown.showDropdown(options, header=T(32450, 'Choose Version'), with_indicator=True) if not choice: return False choice['key'].set('selected', 1) return True
def optionsButtonClicked(self): options = [] if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'): options.append({ 'key': 'play_next', 'display': T(32325, 'Play Next') }) if not options: return choice = dropdown.showDropdown(options, (440, 1020), close_direction='down', pos_is_bottom=True, close_on_playback_ended=True) if not choice: return if choice['key'] == 'play_next': xbmc.executebuiltin('PlayerControl(Next)')
def optionsButtonClicked(self): options = [] if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'): options.append({ 'key': 'play_next', 'display': T(32325, 'Play Next') }) # if self.section.TYPE not in ('artist', 'photo', 'photodirectory'): # options.append({'key': 'mark_watched', 'display': 'Mark All Watched'}) # options.append({'key': 'mark_unwatched', 'display': 'Mark All Unwatched'}) # 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'}) if self.section.TYPE == 'photodirectory': if options: options.append(dropdown.SEPARATOR) options.append({ 'key': 'to_section', 'display': T(32324, u'Go to {0}').format(self.section.getLibrarySectionTitle()) }) choice = dropdown.showDropdown(options, (255, 205)) if not choice: return if choice['key'] == 'play_next': xbmc.executebuiltin('PlayerControl(Next)') elif choice['key'] == 'to_section': self.goHome(self.section.getLibrarySectionId())
def optionsButtonClicked(self, from_item=False): options = [] mli = self.episodeListControl.getSelectedItem() if mli: if len(mli.dataSource.media) > 1: options.append({ 'key': 'play_version', 'display': T(32451, 'Play Version...') }) if mli.dataSource.isWatched and not mli.dataSource.viewOffset.asInt( ): options.append({ 'key': 'mark_unwatched', 'display': T(32318, 'Mark Unwatched') }) else: options.append({ 'key': 'mark_watched', 'display': T(32319, 'Mark Watched') }) # if True: # options.append({'key': 'add_to_playlist', 'display': '[COLOR FF808080]Add To Playlist[/COLOR]'}) if xbmc.getCondVisibility('Player.HasAudio + MusicPlayer.HasNext'): options.append({ 'key': 'play_next', 'display': T(32325, 'Play Next') }) if self.season.isWatched: options.append({ 'key': 'mark_season_unwatched', 'display': T(32320, 'Mark Season Unwatched') }) else: options.append({ 'key': 'mark_season_watched', 'display': T(32321, 'Mark Season Watched') }) if mli.dataSource.server.allowsMediaDeletion: options.append({'key': 'delete', 'display': T(32322, 'Delete')}) # 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_show', 'display': T(32323, 'Go To Show')}) options.append({ 'key': 'to_section', 'display': T(32324, u'Go to {0}').format(self.season.getLibrarySectionTitle()) }) pos = (500, 620) bottom = False setDropdownProp = False if from_item: viewPos = self.episodeListControl.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='top', set_dropdown_prop=setDropdownProp) if not choice: return if choice['key'] == 'play_version': self.episodeListClicked(play_version=True) elif choice['key'] == 'play_next': xbmc.executebuiltin('PlayerControl(Next)') elif choice['key'] == 'mark_watched': mli.dataSource.markWatched() self.updateItems(mli) util.MONITOR.watchStatusChanged() elif choice['key'] == 'mark_unwatched': mli.dataSource.markUnwatched() self.updateItems(mli) util.MONITOR.watchStatusChanged() elif choice['key'] == 'mark_season_watched': self.season.markWatched() self.updateItems() util.MONITOR.watchStatusChanged() elif choice['key'] == 'mark_season_unwatched': self.season.markUnwatched() self.updateItems() util.MONITOR.watchStatusChanged() elif choice['key'] == 'to_show': self.processCommand(opener.open(self.season.parentRatingKey)) elif choice['key'] == 'to_section': self.goHome(self.season.getLibrarySectionId()) elif choice['key'] == 'delete': self.delete()
def optionsButtonClicked(self, item=None): options = [] if item: if item.dataSource.isWatched: options.append({ 'key': 'mark_unwatched', 'display': T(32318, 'Mark Unwatched') }) else: options.append({ 'key': 'mark_watched', 'display': T(32319, 'Mark Watched') }) # 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())
def filter1ButtonClicked(self): check = 'script.plex/home/device/check.png' options = [] if self.section.TYPE in ('movie', 'show'): options.append({ 'type': 'unwatched', 'display': T(32368, 'UNWATCHED').upper(), 'indicator': self.filterUnwatched and check or '' }) if self.filter: options.append({ 'type': 'clear_filter', 'display': T(32376, 'CLEAR FILTER').upper(), 'indicator': 'script.plex/indicators/remove.png' }) if options: options.append(None) # Separator optionsMap = { 'year': { 'type': 'year', 'display': T(32377, 'Year'), 'indicator': self.hasFilter('year') and check or '' }, 'decade': { 'type': 'decade', 'display': T(32378, 'Decade'), 'indicator': self.hasFilter('decade') and check or '' }, 'genre': { 'type': 'genre', 'display': T(32379, 'Genre'), 'indicator': self.hasFilter('genre') and check or '' }, 'contentRating': { 'type': 'contentRating', 'display': T(32380, 'Content Rating'), 'indicator': self.hasFilter('contentRating') and check or '' }, 'network': { 'type': 'studio', 'display': T(32381, 'Network'), 'indicator': self.hasFilter('studio') and check or '' }, 'collection': { 'type': 'collection', 'display': T(32382, 'Collection'), 'indicator': self.hasFilter('collection') and check or '' }, 'director': { 'type': 'director', 'display': T(32383, 'Director'), 'indicator': self.hasFilter('director') and check or '' }, 'actor': { 'type': 'actor', 'display': T(32384, 'Actor'), 'indicator': self.hasFilter('actor') and check or '' }, 'country': { 'type': 'country', 'display': T(32385, 'Country'), 'indicator': self.hasFilter('country') and check or '' }, 'studio': { 'type': 'studio', 'display': T(32386, 'Studio'), 'indicator': self.hasFilter('studio') and check or '' }, 'resolution': { 'type': 'resolution', 'display': T(32362, 'Resolution'), 'indicator': self.hasFilter('resolution') and check or '' }, 'labels': { 'type': 'labels', 'display': T(32387, 'Labels'), 'indicator': self.hasFilter('labels') and check or '' }, 'make': { 'type': 'make', 'display': T(32388, 'Camera Make'), 'indicator': self.hasFilter('make') and check or '' }, 'model': { 'type': 'model', 'display': T(32389, 'Camera Model'), 'indicator': self.hasFilter('model') and check or '' }, 'aperture': { 'type': 'aperture', 'display': T(32390, 'Aperture'), 'indicator': self.hasFilter('aperture') and check or '' }, 'exposure': { 'type': 'exposure', 'display': T(32391, 'Shutter Speed'), 'indicator': self.hasFilter('exposure') and check or '' }, 'iso': { 'type': 'iso', 'display': 'ISO', 'indicator': self.hasFilter('iso') and check or '' }, 'lens': { 'type': 'lens', 'display': T(32392, 'Lens'), 'indicator': self.hasFilter('lens') and check or '' } } if self.section.TYPE == 'movie': for k in ('year', 'decade', 'genre', 'contentRating', 'collection', 'director', 'actor', 'country', 'studio', 'resolution', 'labels'): options.append(optionsMap[k]) elif self.section.TYPE == 'show': for k in ('year', 'genre', 'contentRating', 'network', 'collection', 'actor', 'labels'): options.append(optionsMap[k]) elif self.section.TYPE == 'artist': for k in ('genre', 'country', 'collection'): options.append(optionsMap[k]) elif self.section.TYPE == 'photo': for k in ('year', 'make', 'model', 'aperture', 'exposure', 'iso', 'lens', 'labels'): options.append(optionsMap[k]) result = dropdown.showDropdown( options, (980, 106), with_indicator=True, suboption_callback=self.subOptionCallback) if not result: return choice = result['type'] if choice == 'clear_filter': self.filter = None elif choice == 'unwatched': self.filterUnwatched = not self.filterUnwatched self.librarySettings.setSetting('filter.unwatched', self.filterUnwatched) else: self.filter = result self.updateFilterDisplay() if self.filter or choice in ('clear_filter', 'unwatched'): self.fill()
def sortButtonClicked(self): desc = 'script.plex/indicators/arrow-down.png' asc = 'script.plex/indicators/arrow-up.png' ind = self.sortDesc and desc or asc options = [] if self.section.TYPE == 'movie': for stype in ('addedAt', 'originallyAvailableAt', 'lastViewedAt', 'titleSort', 'rating', 'resolution', 'duration'): option = SORT_KEYS['movie'].get(stype).copy() option['type'] = stype option['indicator'] = self.sort == stype and ind or '' options.append(option) elif self.section.TYPE == 'show': for stype in ('addedAt', 'lastViewedAt', 'originallyAvailableAt', 'titleSort', 'rating', 'unviewedLeafCount'): option = SORT_KEYS['show'].get( stype, SORT_KEYS['movie'].get(stype)).copy() option['type'] = stype option['indicator'] = self.sort == stype and ind or '' options.append(option) elif self.section.TYPE == 'artist': for stype in ('addedAt', 'lastViewedAt', 'viewCount', 'titleSort'): option = SORT_KEYS['artist'].get( stype, SORT_KEYS['movie'].get(stype)).copy() option['type'] = stype option['indicator'] = self.sort == stype and ind or '' options.append(option) elif self.section.TYPE == 'photo': for stype in ('addedAt', 'originallyAvailableAt', 'titleSort', 'rating'): option = SORT_KEYS['photo'].get( stype, SORT_KEYS['movie'].get(stype)).copy() option['type'] = stype option['indicator'] = self.sort == stype and ind or '' options.append(option) else: return result = dropdown.showDropdown(options, (1280, 106), with_indicator=True) if not result: return choice = result['type'] if choice == self.sort: self.sortDesc = not self.sortDesc else: self.sortDesc = False self.sort = choice self.librarySettings.setSetting('sort', self.sort) self.librarySettings.setSetting('sort.desc', self.sortDesc) self.setProperty('sort', choice) self.setProperty('sort.display', result['title']) self.sortShowPanel(choice)