Add tvdb api keys config

This commit is contained in:
Zoe Roux 2024-05-12 23:40:21 +02:00
parent 5f61f4d3a3
commit d08a86a724
No known key found for this signature in database
2 changed files with 19 additions and 2 deletions

View File

@ -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

View File

@ -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