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 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 hubItemClicked(self, hubControlID): control = self.hubControls[hubControlID - 400] mli = control.getSelectedItem() if not mli: return if mli.dataSource is None: return command = opener.open(mli.dataSource) self.updateListItem(mli) if not mli.dataSource.exists(): control.removeItem(mli.pos()) if not control.size(): idx = self.hubFocusIndexes[hubControlID - 400] while idx > -1: idx -= 1 controlID = 400 + self.hubFocusIndexes.index(idx) control = self.hubControls[self.hubFocusIndexes.index(idx)] if control.size(): self.setFocusId(controlID) break else: self.setFocusId(self.SECTION_LIST_ID) self.processCommand(command)
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 openItem(self, control=None, item=None): if not item: mli = control.getSelectedItem() if not mli: return item = mli.dataSource self.processCommand(opener.open(item))
def playlistListClicked(self, no_item=False, shuffle=False): if no_item: mli = None else: mli = self.playlistListControl.getSelectedItem() if not mli or not mli.dataSource: return try: self.isPlaying = True self.tasks.cancel() player.PLAYER.stop( ) # Necessary because if audio is already playing, it will close the window when that is stopped if self.playlist.playlistType == 'audio': if self.playlist.leafCount.asInt() <= PLAYLIST_INITIAL_SIZE: self.playlist.setShuffle(shuffle) self.playlist.setCurrent(mli and mli.pos() or 0) self.showAudioPlayer(track=mli and mli.dataSource or self.playlist.current(), playlist=self.playlist) else: args = {'sourceType': '8', 'shuffle': shuffle} if mli: args['key'] = mli.dataSource.key pq = plexnet.playqueue.createPlayQueueForItem( self.playlist, options=args) opener.open(pq) elif self.playlist.playlistType == 'video': if self.playlist.leafCount.asInt() <= PLAYLIST_INITIAL_SIZE: self.playlist.setShuffle(shuffle) self.playlist.setCurrent(mli and mli.pos() or 0) videoplayer.play(play_queue=self.playlist) else: args = {'shuffle': shuffle} if mli: args['key'] = mli.dataSource.key pq = plexnet.playqueue.createPlayQueueForItem( self.playlist, options=args) opener.open(pq) finally: self.isPlaying = False self.restartFill()
def playButtonClicked(self, shuffle=False): filter_ = self.getFilterOpts() sort = self.getSortOpts() args = {} if filter_: args[filter_[0]] = filter_[1] if sort: args['sort'] = '{0}:{1}'.format(*sort) if self.section.TYPE == 'movie': args['sourceType'] = '1' elif self.section.TYPE == 'show': args['sourceType'] = '2' else: args['sourceType'] = '8' pq = playqueue.createPlayQueueForItem(self.section, options={'shuffle': shuffle}, args=args) opener.open(pq)
def hubItemClicked(self, hubControlID): for controls in self.hubControls: for control in controls.values(): if control.controlID == hubControlID: break else: continue break else: return mli = control.getSelectedItem() if not mli: return hubItem = mli.dataSource if hubItem.TYPE == 'playlist' and not hubItem.exists( ): # Workaround for server bug util.messageDialog('No Access', 'Playlist not accessible by this user.') util.DEBUG_LOG( 'Search: Playlist does not exist - probably wrong user') return self.doClose() try: command = opener.open(hubItem) if not hubItem.exists(): control.removeManagedItem(mli) self.processCommand(command) finally: if not self.exitCommand: self.show() else: self.isActive = False
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()
# -*- encoding:utf-8 -*- ''' Created on 2012-11-21 各种测试 @author: zhaowei ''' import urllib, opener, alltestfunc opener = opener.getoperner() #暂时思考,待确认 #opener添加了HTTPRedirectHandler,所以可以自动处理302跳转和跳转之后的返回 #否则,必须代码实现获取跳转url,和返回url print "begain login ..." opener.open("http://sharepytest.free4lab.com") data = urllib.urlencode({"email":"*****@*****.**","epsw":"telestar","passwordMd5":"40cc1685b089b83039c635980cc4ec50"}) accounturl = "http://account.free4lab.com/loginCheck" opener.open(accounturl, data) #开始测试各种发布资源 print "begain publishtest..." print "--------------------------" print "publish article..." alltestfunc.article(opener) print "publish article end"
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 showPhoto(self, photo): if isinstance(photo, plexnet.photo.Photo) or photo.TYPE == 'clip': self.processCommand(opener.open(photo)) else: self.processCommand(opener.sectionClicked(photo))
# -*- encoding:utf-8 -*- ''' Created on 2012-11-21 各种测试 @author: zhaowei ''' import urllib, opener, alltestfunc opener = opener.getoperner() #暂时思考,待确认 #opener添加了HTTPRedirectHandler,所以可以自动处理302跳转和跳转之后的返回 #否则,必须代码实现获取跳转url,和返回url print "begain login ..." opener.open("http://sharepytest.free4lab.com") data = urllib.urlencode({ "email": "*****@*****.**", "epsw": "telestar", "passwordMd5": "40cc1685b089b83039c635980cc4ec50" }) accounturl = "http://account.free4lab.com/loginCheck" opener.open(accounturl, data) #开始测试各种发布资源 print "begain publishtest..." print "--------------------------" print "publish article..." alltestfunc.article(opener) print "publish article end"
def openItem(self, obj): self.processCommand(opener.open(obj))