[46] TPDb Rate Limit

pull/1953/head
meisnate12 8 months ago
parent 09074e23a5
commit 5cd1635afc

@ -1 +1 @@
1.20.0-develop45 1.20.0-develop46

@ -169,6 +169,7 @@ class ConfigFile:
self.overlays_only = attrs["overlays_only"] if "overlays_only" in attrs else False self.overlays_only = attrs["overlays_only"] if "overlays_only" in attrs else False
self.env_plex_url = attrs["plex_url"] if "plex_url" in attrs else "" self.env_plex_url = attrs["plex_url"] if "plex_url" in attrs else ""
self.env_plex_token = attrs["plex_token"] if "plex_token" in attrs else "" self.env_plex_token = attrs["plex_token"] if "plex_token" in attrs else ""
self.tpdb_timer = None
current_time = datetime.now() current_time = datetime.now()
with open(self.config_path, encoding="utf-8") as fp: with open(self.config_path, encoding="utf-8") as fp:

@ -1,4 +1,4 @@
import os, plexapi, re, requests import os, plexapi, re, requests, time
from datetime import datetime, timedelta from datetime import datetime, timedelta
from modules import builder, util from modules import builder, util
from modules.library import Library from modules.library import Library
@ -791,6 +791,13 @@ class Plex(Library):
@retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex) @retry(stop_max_attempt_number=6, wait_fixed=10000, retry_on_exception=util.retry_if_not_plex)
def _upload_image(self, item, image): def _upload_image(self, item, image):
try: try:
if image.is_url and "theposterdb.com" in image.location:
now = datetime.now()
if self.config.tpdb_timer is not None:
while self.config.tpdb_timer + timedelta(seconds=6) > now:
time.sleep(1)
now = datetime.now()
self.config.tpdb_timer = now
if image.is_poster and image.is_url: if image.is_poster and image.is_url:
item.uploadPoster(url=image.location) item.uploadPoster(url=image.location)
elif image.is_poster: elif image.is_poster:

Loading…
Cancel
Save