Add SPOTIFY_COOKIE_FILE env var and handle correctly when its missing
This commit is contained in:
@@ -172,7 +172,15 @@ for name, func in filters.filters.items():
|
|||||||
|
|
||||||
|
|
||||||
from .providers import SpotifyClient
|
from .providers import SpotifyClient
|
||||||
spotify_client = SpotifyClient('/jellyplist/open.spotify.com_cookies.txt')
|
if app.config['SPOTIFY_COOKIE_FILE']:
|
||||||
|
if os.path.exists(app.config['SPOTIFY_COOKIE_FILE']):
|
||||||
|
spotify_client = SpotifyClient(app.config['SPOTIFY_COOKIE_FILE'])
|
||||||
|
else:
|
||||||
|
app.logger.error(f"Cookie file {app.config['SPOTIFY_COOKIE_FILE']} does not exist. Exiting.")
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
spotify_client = SpotifyClient()
|
||||||
|
|
||||||
spotify_client.authenticate()
|
spotify_client.authenticate()
|
||||||
from .registry import MusicProviderRegistry
|
from .registry import MusicProviderRegistry
|
||||||
MusicProviderRegistry.register_provider(spotify_client)
|
MusicProviderRegistry.register_provider(spotify_client)
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ class Config:
|
|||||||
JELLYFIN_REQUEST_TIMEOUT = int(os.getenv('JELLYFIN_REQUEST_TIMEOUT','10'))
|
JELLYFIN_REQUEST_TIMEOUT = int(os.getenv('JELLYFIN_REQUEST_TIMEOUT','10'))
|
||||||
SPOTIFY_CLIENT_ID = os.getenv('SPOTIFY_CLIENT_ID')
|
SPOTIFY_CLIENT_ID = os.getenv('SPOTIFY_CLIENT_ID')
|
||||||
SPOTIFY_CLIENT_SECRET = os.getenv('SPOTIFY_CLIENT_SECRET')
|
SPOTIFY_CLIENT_SECRET = os.getenv('SPOTIFY_CLIENT_SECRET')
|
||||||
|
SPOTIFY_COOKIE_FILE = os.getenv('SPOTIFY_COOKIE_FILE')
|
||||||
JELLYPLIST_DB_HOST = os.getenv('JELLYPLIST_DB_HOST')
|
JELLYPLIST_DB_HOST = os.getenv('JELLYPLIST_DB_HOST')
|
||||||
JELLYPLIST_DB_PORT = int(os.getenv('JELLYPLIST_DB_PORT','5432'))
|
JELLYPLIST_DB_PORT = int(os.getenv('JELLYPLIST_DB_PORT','5432'))
|
||||||
JELLYPLIST_DB_USER = os.getenv('JELLYPLIST_DB_USER')
|
JELLYPLIST_DB_USER = os.getenv('JELLYPLIST_DB_USER')
|
||||||
|
|||||||
Reference in New Issue
Block a user