def main(): args = get_args() if args.debug: logger.setLevel(logging.DEBUG) if args.account: # ## Connect via Account account = MyPlexAccount(args.username, args.password) plex = account.resource(args.resource).connect() elif args.server: # ## Connect via Direct URL baseurl = args.baseurl token = args.token plex = PlexServer(baseurl, token) else: exit(1) all_shows = plex.library.section('TV Shows') # shows = get_unwatched_shows(all_shows.all()) episodes = get_random_episodes(all_shows, n=args.number) for episode in episodes: season_episode = episode.seasonEpisode # skipped = skipped_missing(all_shows.get(title=episode.grandparentTitle), episode) # playlist = Playlist(plex, ) plex.playlist(title=args.name).delete() Playlist.create(server=plex, title=args.name, items=episodes)
def create_playlist(self, name, media): """ Create or update playlist with list of media. """ for playlist in self.server.playlists(): if name == playlist.title: playlist.addItems(media) break else: Playlist.create(self.server, name, media)
def create_playlist(): request_data = request.get_json() playlistname = request_data['name'] section = request_data['section'] d = Playlist(server=plex, data=None) d.create(server=plex, title=f"{playlistname}", smart=True, section=f"{section}") return "playlist created successfully"
def createPlaylist(self, title, items): """Create a playlist. Returns: Playlist """ return Playlist.create(self, title, items)
def createPlaylist(self, title, items): """ Creates and returns a new :class:`~plexapi.playlist.Playlist`. Parameters: title (str): Title of the playlist to be created. items (list<Media>): List of media items to include in the playlist. """ return Playlist.create(self, title, items)
def createPlaylist(self, title, items=None, section=None, limit=None, smart=None, **kwargs): """ Creates and returns a new :class:`~plexapi.playlist.Playlist`. Parameters: title (str): Title of the playlist to be created. items (list<Media>): List of media items to include in the playlist. """ return Playlist.create(self, title, items=items, limit=limit, section=section, smart=smart, **kwargs)
def create(self, content: Tracks = None, **criteria): items = list(_get_tracks(self.plex, content, **criteria)) prefix = '[DRY RUN] Would create' if self.plex.dry_run else 'Creating' log.info(f'{prefix} {self} with {len(items):,d} tracks', extra={'color': 10}) log.debug(f'Creating {self} with tracks: {items}') if not self.plex.dry_run: self._playlist = Playlist.create(self.plex.server, self.name, items)
def createPlaylist(self, title, items): return Playlist.create(self, title, items)
import sys #PLEX INFO url = "http://192.168.1.#:32400" token = "##################" if hasattr(__builtins__, 'raw_input'): input=raw_input plex = PlexServer(url, token) for i, playlist in enumerate(plex.playlists()): print("{position}) {playlist_title}".format(position=i+1, playlist_title=playlist.title)) choice = -1 while choice == -1: selection = input("Select playlist: ") try: selection = int(selection) if selection > 0 and selection <= i+1: choice = selection - 1 else: print("Invalid selection") except: print("Invalid selection") new_playlist_name = input("Enter new playlist name: ") try: Playlist.create(plex, new_playlist_name, plex.playlists()[choice].items()) print("{playlist} created".format(playlist=new_playlist_name)) except: print("Error")