def playButtonClicked(self, shuffle=False): if shuffle: items = self.season.all() pl = playlist.LocalPlaylist(items, self.season.getServer()) pl.shuffle(shuffle, first=True) videoplayer.play(play_queue=pl) else: self.episodeListClicked()
def playButtonClicked(self, shuffle=False): items = self.mediaItem.all() pl = playlist.LocalPlaylist(items, self.mediaItem.getServer()) resume = False if not shuffle and self.mediaItem.type == 'show': resume = self.getPlaylistResume(pl, items, self.mediaItem.title) if resume is None: return pl.shuffle(shuffle, first=True) videoplayer.play(play_queue=pl, resume=resume)
def open(obj, auto_play=False): if isinstance(obj, playqueue.PlayQueue): if busy.widthDialog(obj.waitForInitialization, None): if obj.type == 'audio': import musicplayer return handleOpen(musicplayer.MusicPlayerWindow, track=obj.current(), playlist=obj) elif obj.type == 'photo': import photos return handleOpen(photos.PhotoWindow, play_queue=obj) else: import videoplayer videoplayer.play(play_queue=obj) return '' elif isinstance(obj, basestring): key = obj if not obj.startswith('/'): key = '/library/metadata/{0}'.format(obj) return open(plexapp.SERVERMANAGER.selectedServer.getObject(key)) elif obj.TYPE == 'episode': if not auto_play: return episodeClicked(obj) return playableClicked(obj, auto_play=auto_play) elif obj.TYPE == 'movie': return playableClicked(obj, auto_play=auto_play) elif obj.TYPE in ('show'): return showClicked(obj) elif obj.TYPE in ('artist'): return artistClicked(obj) elif obj.TYPE in ('season'): return seasonClicked(obj) elif obj.TYPE in ('album'): return albumClicked(obj) elif obj.TYPE in ('photo', ): return photoClicked(obj) elif obj.TYPE in ('photodirectory'): return photoDirectoryClicked(obj) elif obj.TYPE in ('track'): return trackClicked(obj) elif obj.TYPE in ('playlist'): return playlistClicked(obj) elif obj.TYPE in ('clip'): import videoplayer return videoplayer.play(video=obj) elif obj.TYPE in ('Genre'): return genreClicked(obj) elif obj.TYPE in ('Director'): return directorClicked(obj) elif obj.TYPE in ('Role'): return actorClicked(obj)
def playVideo(self, play_version=False): if not self.video.available(): util.messageDialog(T(32312, 'Unavailable'), T(32313, 'This item is currently unavailable.')) return if play_version: if not preplayutils.chooseVersion(self.video): return else: preplayutils.resetVersion(self.video) resume = False if self.video.viewOffset.asInt(): button = optionsdialog.show(T(32314, 'In Progress'), T(32315, 'Resume playback?'), T(32316, 'Resume'), T(32317, 'Play From Beginning')) if button is None: return resume = (button == 0) self.processCommand(videoplayer.play(video=self.video, resume=resume))
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 episodeListClicked(self, play_version=False): mli = self.episodeListControl.getSelectedItem() if not mli: return episode = mli.dataSource if not episode.available(): util.messageDialog(T(32312, 'unavailable'), T(32332, 'This item is currently unavailable.')) return if play_version: if not preplayutils.chooseVersion(episode): return else: preplayutils.resetVersion(episode) resume = False if episode.viewOffset.asInt(): button = optionsdialog.show(T(32314, 'In Progress'), T(32315, 'Resume playback?'), T(32316, 'Resume'), T(32317, 'Play From Beginning')) if button is None: return resume = (button == 0) pl = playlist.LocalPlaylist(self.show_.all(), self.show_.getServer()) if len(pl): # Don't use playlist if it's only this video pl.setCurrent(episode) self.processCommand(videoplayer.play(play_queue=pl, resume=resume)) return self.processCommand(videoplayer.play(video=episode, resume=resume))