|
|
@ -5,6 +5,7 @@ from modules.util import Failed, NotScheduled, NotScheduledRange, Overlay, Delet
|
|
|
|
from plexapi.audio import Artist, Album, Track
|
|
|
|
from plexapi.audio import Artist, Album, Track
|
|
|
|
from plexapi.exceptions import BadRequest, NotFound
|
|
|
|
from plexapi.exceptions import BadRequest, NotFound
|
|
|
|
from plexapi.video import Movie, Show, Season, Episode
|
|
|
|
from plexapi.video import Movie, Show, Season, Episode
|
|
|
|
|
|
|
|
from requests.exceptions import ConnectionError
|
|
|
|
from urllib.parse import quote
|
|
|
|
from urllib.parse import quote
|
|
|
|
|
|
|
|
|
|
|
|
logger = util.logger
|
|
|
|
logger = util.logger
|
|
|
@ -787,11 +788,13 @@ class CollectionBuilder:
|
|
|
|
|
|
|
|
|
|
|
|
def _poster(self, method_name, method_data):
|
|
|
|
def _poster(self, method_name, method_data):
|
|
|
|
if method_name == "url_poster":
|
|
|
|
if method_name == "url_poster":
|
|
|
|
image_response = self.config.get(method_data, headers=util.header())
|
|
|
|
try:
|
|
|
|
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]:
|
|
|
|
image_response = self.config.get(method_data, headers=util.header())
|
|
|
|
logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}")
|
|
|
|
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]:
|
|
|
|
else:
|
|
|
|
raise ConnectionError
|
|
|
|
self.posters[method_name] = method_data
|
|
|
|
self.posters[method_name] = method_data
|
|
|
|
|
|
|
|
except ConnectionError:
|
|
|
|
|
|
|
|
logger.warning(f"{self.Type} Warning: No Poster Found at {method_data}")
|
|
|
|
elif method_name == "tmdb_poster":
|
|
|
|
elif method_name == "tmdb_poster":
|
|
|
|
self.posters[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).poster_url
|
|
|
|
self.posters[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).poster_url
|
|
|
|
elif method_name == "tmdb_profile":
|
|
|
|
elif method_name == "tmdb_profile":
|
|
|
@ -806,11 +809,13 @@ class CollectionBuilder:
|
|
|
|
|
|
|
|
|
|
|
|
def _background(self, method_name, method_data):
|
|
|
|
def _background(self, method_name, method_data):
|
|
|
|
if method_name == "url_background":
|
|
|
|
if method_name == "url_background":
|
|
|
|
image_response = self.config.get(method_data, headers=util.header())
|
|
|
|
try:
|
|
|
|
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]:
|
|
|
|
image_response = self.config.get(method_data, headers=util.header())
|
|
|
|
logger.warning(f"{self.Type} Warning: No Background Found at {method_data}")
|
|
|
|
if image_response.status_code >= 400 or image_response.headers["Content-Type"] not in ["image/jpeg", "image/png"]:
|
|
|
|
else:
|
|
|
|
raise ConnectionError
|
|
|
|
self.backgrounds[method_name] = method_data
|
|
|
|
self.backgrounds[method_name] = method_data
|
|
|
|
|
|
|
|
except ConnectionError:
|
|
|
|
|
|
|
|
logger.warning(f"{self.Type} Warning: No Background Found at {method_data}")
|
|
|
|
elif method_name == "tmdb_background":
|
|
|
|
elif method_name == "tmdb_background":
|
|
|
|
self.backgrounds[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).backdrop_url
|
|
|
|
self.backgrounds[method_name] = self.config.TMDb.get_movie_show_or_collection(util.regex_first_int(method_data, 'TMDb ID'), self.library.is_movie).backdrop_url
|
|
|
|
elif method_name == "tvdb_background":
|
|
|
|
elif method_name == "tvdb_background":
|
|
|
|