mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-19 19:54:12 +02:00
change metadata provider functions
This commit is contained in:
@@ -17,6 +17,8 @@ class TmdbConfig(BaseSettings):
|
||||
TMDB_API_KEY: str | None = None
|
||||
|
||||
|
||||
ENDED_STATUS = {"Ended", "Canceled"}
|
||||
|
||||
config = TmdbConfig()
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -24,6 +26,9 @@ log = logging.getLogger(__name__)
|
||||
class TmdbMetadataProvider(AbstractMetadataProvider):
|
||||
name = "tmdb"
|
||||
|
||||
def __init__(self, api_key: str = None):
|
||||
tmdbsimple.API_KEY = api_key
|
||||
|
||||
def download_show_poster_image(self, show: Show) -> bool:
|
||||
show_metadata = TV(show.external_id).info()
|
||||
# downloading the poster
|
||||
@@ -92,6 +97,7 @@ class TmdbMetadataProvider(AbstractMetadataProvider):
|
||||
year=year,
|
||||
seasons=season_list,
|
||||
metadata_provider=self.name,
|
||||
ended=show_metadata["status"] in ENDED_STATUS,
|
||||
)
|
||||
|
||||
return show
|
||||
@@ -146,8 +152,6 @@ class TmdbMetadataProvider(AbstractMetadataProvider):
|
||||
log.warning(f"Error processing search result {result}: {e}")
|
||||
return formatted_results
|
||||
|
||||
def __init__(self, api_key: str = None):
|
||||
tmdbsimple.API_KEY = api_key
|
||||
|
||||
|
||||
if config.TMDB_API_KEY is not None:
|
||||
|
||||
Reference in New Issue
Block a user