diff --git a/.env.example b/.env.example index fbd997ee..2298b20a 100644 --- a/.env.example +++ b/.env.example @@ -37,9 +37,14 @@ GOCODER_PRESET=fast # You can input multiple api keys separated by a , KYOO_APIKEYS=t7H5!@4iMNsAaSJQ49pat4jprJgTcF656if#J3 -# Keep this empty to use kyoo's default api key. You can also specify a custom API key if you want. -# To get one, go to https://www.themoviedb.org/settings/api and copy the api key (not the read access token, the api key) +# Keep those empty to use kyoo's default api key. You can also specify a custom API key if you want. +# go to https://www.themoviedb.org/settings/api and copy the api key (not the read access token, the api key) THEMOVIEDB_APIKEY= +# go to https://thetvdb.com/api-information/signup and copy the api key +TVDB_APIKEY= +# you can also input your subscriber's pin to support TVDB +TVDB_PIN= + # The url you can use to reach your kyoo instance. This is used during oidc to redirect users to your instance. PUBLIC_URL=http://localhost:5000 diff --git a/scanner/providers/provider.py b/scanner/providers/provider.py index b6d1c8da..535de39a 100644 --- a/scanner/providers/provider.py +++ b/scanner/providers/provider.py @@ -1,3 +1,4 @@ +from logging import getLogger import os from aiohttp import ClientSession from abc import abstractmethod, abstractproperty @@ -11,6 +12,8 @@ from .types.episode import Episode from .types.movie import Movie from .types.collection import Collection +logger = getLogger(__name__) + class Provider: @classmethod @@ -29,6 +32,14 @@ class Provider: tmdb = TheMovieDatabase(languages, client, tmdb) providers.append(tmdb) + from providers.implementations.thetvdb import TVDB + + tvdb = os.environ.get("TVDB_APIKEY") or TVDB.DEFAULT_API_KEY + if tvdb != "disabled": + pin = os.environ.get("TVDB_PIN") or None + tvdb = TVDB(client, tvdb, pin, languages) + providers.append(tvdb) + if not any(providers): raise ProviderError( "No provider configured. You probably forgot to specify an API Key" @@ -37,6 +48,7 @@ class Provider: from providers.implementations.thexem import TheXem provider = next(iter(providers)) + logger.info(f"Starting with provider: {provider.name}") return TheXem(client, provider) @abstractproperty