|
|
@ -2,7 +2,6 @@ import logging, requests
|
|
|
|
from modules import util
|
|
|
|
from modules import util
|
|
|
|
from modules.util import Failed
|
|
|
|
from modules.util import Failed
|
|
|
|
from plexapi.exceptions import BadRequest, NotFound
|
|
|
|
from plexapi.exceptions import BadRequest, NotFound
|
|
|
|
from plexapi.video import Movie, Show
|
|
|
|
|
|
|
|
from retrying import retry
|
|
|
|
from retrying import retry
|
|
|
|
|
|
|
|
|
|
|
|
logger = logging.getLogger("Plex Meta Manager")
|
|
|
|
logger = logging.getLogger("Plex Meta Manager")
|
|
|
@ -12,7 +11,7 @@ builders = ["tautulli_popular", "tautulli_watched"]
|
|
|
|
class TautulliAPI:
|
|
|
|
class TautulliAPI:
|
|
|
|
def __init__(self, params):
|
|
|
|
def __init__(self, params):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
response = requests.get(f"{params['url']}/api/v2?apikey={params['apikey']}&cmd=get_library_names").json()
|
|
|
|
response = self._request(f"{params['url']}/api/v2?apikey={params['apikey']}&cmd=get_library_names")
|
|
|
|
except Exception:
|
|
|
|
except Exception:
|
|
|
|
util.print_stacktrace()
|
|
|
|
util.print_stacktrace()
|
|
|
|
raise Failed("Tautulli Error: Invalid url")
|
|
|
|
raise Failed("Tautulli Error: Invalid url")
|
|
|
@ -65,5 +64,5 @@ class TautulliAPI:
|
|
|
|
|
|
|
|
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
@retry(stop_max_attempt_number=6, wait_fixed=10000)
|
|
|
|
def _request(self, url):
|
|
|
|
def _request(self, url):
|
|
|
|
logger.debug(f"Tautulli URL: {url.replace(self.apikey, '################################')}")
|
|
|
|
logger.debug(f"Tautulli URL: {url.replace(self.apikey, '###############')}")
|
|
|
|
return requests.get(url).json()
|
|
|
|
return requests.get(url).json()
|
|
|
|