def fetch_server(args): if args.resource and args.username and args.password: log(0, 'Signing in as MyPlex account %s..' % args.username) account = MyPlexAccount.signin(args.username, args.password) log(0, 'Connecting to Plex server %s..' % args.resource) return account.resource(args.resource).connect(), account elif args.baseurl and args.token: log(0, 'Connecting to Plex server %s..' % args.baseurl) return server.PlexServer(args.baseurl, args.token), None return server.PlexServer(), None
def __init__(self, url: str, token: str): """ Work with the Plex API :param url: Plex Media Server url :type url: str :param token: Plex Media Server token :type token: str """ if not url or not token: raise ValueError("url and token must be set") self.server = server.PlexServer(url, token)
def fetch_server(args): if args.server: user = MyPlexUser.signin(args.username, args.password) return user.getServer(args.server).connect(), user return server.PlexServer(), None
def __init__(self, url, token): self.url = url self.token = token self.server = server.PlexServer(url, token)
parser.add_argument("-x", "--shuffle", action="store_true", help="Shuffle items once channel is completed.") parser.add_argument("-v", "--verbose", action="store_true", help="Verbose (for debugging)") args = parser.parse_args() #channel_name = ", ".join(name for name in args.studio) if args.token is not None and len(args.token) > 0: PLEX_TOKEN = args.token plex_server = server.PlexServer(PLEX_URL, PLEX_TOKEN) if args.studio is None and args.genre is None and args.collection is None and args.playlist is None: print( f"Either studio, genre, collection or playlist must be passed in. Exiting." ) exit(1) all_items = [] for section in args.section: if args.studio is not None: for studio in args.studio: print(f"Looking up content from {studio}...") studio_items = plex_server.library.section(section).search( studio=f"{quote(studio)}") if studio_items:
def __post_init__(self) -> None: self.server = pserv.PlexServer(self.plex_url, self.token) self.collection = self.server.library.sectionByID(7)
parser.add_argument('--plex-url', type=str, required=True) parser.add_argument('--dizquetv-url', type=str, required=True) parser.add_argument("-s", "--shuffle", action="store_true", help="Shuffle items once channel is completed.") parser.add_argument("-v", "--verbose", action="store_true", help="Verbose (for debugging)") parser.add_argument("--dry-run", action="store_true") args = parser.parse_args() channel_name = ", ".join(name for name in args.studio) plex_server = server.PlexServer(args.plex_url, args.plex_token) all_items = [] for studio in args.studio: print(f"Looking up content from {studio}...") studio_items = plex_server.library.search(studio=f"{quote(studio)}") if studio_items: print("Matching items:") for item in studio_items: if item.studio == studio: print(f"{item.studio} - {item.title}") all_items.append(item) if all_items: if not args.dry_run: dtv = API(url=args.dizquetv_url, verbose=args.verbose)