Fix track lookup
This commit is contained in:
parent
19d22d1428
commit
f287780bcd
@ -21,7 +21,7 @@ def track_from_ids(
|
|||||||
yield track if isinstance(track, str) else track.spotify_id
|
yield track if isinstance(track, str) else track.spotify_id
|
||||||
|
|
||||||
for track_id_chunk in chunk(_to_id(), chunk_size):
|
for track_id_chunk in chunk(_to_id(), chunk_size):
|
||||||
track_chunk = client.tracks(track_id_chunk)
|
track_chunk = client.tracks(track_id_chunk)["tracks"]
|
||||||
|
|
||||||
for track in track_chunk:
|
for track in track_chunk:
|
||||||
yield Track(**track)
|
yield Track(**track)
|
||||||
|
@ -32,13 +32,13 @@ def read_credentials_server(path: Path) -> Spotify:
|
|||||||
return Spotify(client_credentials_manager=credentials_manager)
|
return Spotify(client_credentials_manager=credentials_manager)
|
||||||
|
|
||||||
|
|
||||||
def read_credentials_oauth(path: Path, redirect_uri: str, scopes: List[str]) -> Spotify:
|
def read_credentials_oauth(path: Path, redirect_uri: str, scopes: List[str], open_browser: bool = True) -> Spotify:
|
||||||
"Read credentials from a YAML file and authorize a user"
|
"Read credentials from a YAML file and authorize a user"
|
||||||
|
|
||||||
with open(path, "r") as credentials_file:
|
with open(path, "r") as credentials_file:
|
||||||
credentials = yaml.safe_load(credentials_file)
|
credentials = yaml.safe_load(credentials_file)
|
||||||
credentials_manager = SpotifyOAuth(
|
credentials_manager = SpotifyOAuth(
|
||||||
credentials["client_id"], credentials["client_secret"], redirect_uri, scope=scopes
|
credentials["client_id"], credentials["client_secret"], redirect_uri, scope=scopes, open_browser=open_browser
|
||||||
)
|
)
|
||||||
return Spotify(client_credentials_manager=credentials_manager)
|
return Spotify(client_credentials_manager=credentials_manager)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user