System Gen93 @ 2025-08-01-00:56:55 by jonas@monolith

This commit is contained in:
2025-08-01 00:56:55 +02:00
parent 0f8c6fc562
commit 9a056ce6b0
4 changed files with 91 additions and 56 deletions

View File

@@ -2,8 +2,10 @@ from spotipy.oauth2 import SpotifyOAuth
from spotipy import Spotify
from spotify_shortcuts.config import Config
CALLBACK_URI = "http://127.0.0.1:45632/callback"
def authenticated_session(cfg: Config) -> Spotify:
def authenticated_session(cfg: Config, scopes: list[str]) -> Spotify:
assert cfg.client_id, "Spotify client ID is required"
assert cfg.client_secret, "Spotify client secret is required"
@@ -11,8 +13,8 @@ def authenticated_session(cfg: Config) -> Spotify:
auth_manager=SpotifyOAuth(
client_id=cfg.client_id,
client_secret=cfg.client_secret,
redirect_uri="http://127.0.0.1:45632/callback",
scope="user-library-read user-library-modify user-read-playback-state",
redirect_uri=CALLBACK_URI,
scope=" ".join(scopes),
cache_path=cfg.cache_file,
)
)