mirror of
https://github.com/pkkid/python-plexapi
synced 2024-11-24 20:53:09 +00:00
first pass on tools and tests
This commit is contained in:
parent
940efc0013
commit
6138c709cd
4 changed files with 7 additions and 10 deletions
|
@ -7,7 +7,6 @@ from os import environ
|
|||
import plexapi
|
||||
import pytest
|
||||
import requests
|
||||
from plexapi import compat
|
||||
from plexapi.client import PlexClient
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
from plexapi.server import PlexServer
|
||||
|
@ -354,7 +353,7 @@ def is_section(key):
|
|||
|
||||
|
||||
def is_string(value, gte=1):
|
||||
return isinstance(value, compat.string_type) and len(value) >= gte
|
||||
return isinstance(value, str) and len(value) >= gte
|
||||
|
||||
|
||||
def is_thumb(key):
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
import os
|
||||
from datetime import datetime
|
||||
from time import sleep
|
||||
from urllib.parse import quote_plus
|
||||
|
||||
import pytest
|
||||
from plexapi.exceptions import BadRequest, NotFound
|
||||
from plexapi.compat import quote_plus
|
||||
|
||||
from . import conftest as utils
|
||||
|
||||
|
|
|
@ -16,12 +16,12 @@ import shutil
|
|||
import socket
|
||||
import time
|
||||
from glob import glob
|
||||
from shutil import copyfile
|
||||
from os import makedirs
|
||||
from shutil import copyfile, which
|
||||
from subprocess import call
|
||||
from uuid import uuid4
|
||||
|
||||
import plexapi
|
||||
from plexapi.compat import makedirs, which
|
||||
from plexapi.exceptions import BadRequest, NotFound
|
||||
from plexapi.myplex import MyPlexAccount
|
||||
from plexapi.server import PlexServer
|
||||
|
|
|
@ -10,10 +10,9 @@ Original contribution by lad1337.
|
|||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
from urllib.parse import unquote
|
||||
|
||||
from plexapi import utils
|
||||
from plexapi.compat import unquote
|
||||
from plexapi.video import Episode, Movie, Show
|
||||
|
||||
VALID_TYPES = (Movie, Episode, Show)
|
||||
|
@ -63,7 +62,7 @@ def get_item_from_url(url):
|
|||
raise SystemExit('Unknown or ambiguous client id: %s' % clientid)
|
||||
server = servers[0].connect()
|
||||
return server.fetchItem(key)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Command line parser
|
||||
from plexapi import CONFIG
|
||||
|
@ -73,7 +72,7 @@ if __name__ == '__main__':
|
|||
default=CONFIG.get('auth.myplex_username'))
|
||||
parser.add_argument('-p', '--password', help='Your Plex password',
|
||||
default=CONFIG.get('auth.myplex_password'))
|
||||
parser.add_argument('--url', default=None, help='Download from URL (only paste after !)')
|
||||
parser.add_argument('--url', default=None, help='Download from URL (only paste after !)')
|
||||
opts = parser.parse_args()
|
||||
# Search item to download
|
||||
account = utils.getMyPlexAccount(opts)
|
||||
|
@ -86,4 +85,3 @@ if __name__ == '__main__':
|
|||
filepath = utils.download(url, token=account.authenticationToken, filename=filename, savepath=os.getcwd(),
|
||||
session=item._server._session, showstatus=True)
|
||||
#print(' %s' % filepath)
|
||||
|
||||
|
|
Loading…
Reference in a new issue