Test that label playlists are working
This commit is contained in:
@ -57,7 +57,7 @@ def album_from_ids(
|
||||
for album_id_chunk in chunk(_to_id(), chunk_size):
|
||||
album_chunk = client.albums(album_id_chunk)
|
||||
|
||||
for album in album_chunk:
|
||||
for album in album_chunk["albums"]:
|
||||
yield SimplifiedAlbum(**album)
|
||||
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
"""
|
||||
Methods for printing results to console; primarily useful when developing/debugging pipelines to
|
||||
check results before committing.
|
||||
"""
|
||||
from typing import Iterable
|
||||
|
||||
from spotify_model import SearchAlbum, SimplifiedTrack
|
||||
|
||||
|
||||
def echo_albums(albums: Iterable[SearchAlbum]) -> None:
|
||||
"Print album metadata"
|
||||
|
||||
for album in albums:
|
||||
print(album.name)
|
||||
|
||||
|
||||
def echo_tracks(tracks: Iterable[SimplifiedTrack]) -> None:
|
||||
"Print track metadata"
|
||||
|
||||
for track in tracks:
|
||||
print(track.name)
|
@ -4,7 +4,7 @@ Selectors for querying and modifying playlists
|
||||
from functools import partial
|
||||
from typing import Iterable
|
||||
|
||||
from spotify_model import Paging, SimplifiedPlaylist, SimplifiedTrack
|
||||
from spotify_model import Paging, PlaylistTrack, SimplifiedPlaylist, SimplifiedTrack
|
||||
from spotipy import Spotify
|
||||
|
||||
from .user import user_current
|
||||
@ -89,4 +89,4 @@ def playlist_tracks(client: Spotify, playlist_ids: Iterable[str]) -> Iterable[Si
|
||||
playlist_function = partial(_playlist_tracks, playlist_id=playlist_id)
|
||||
|
||||
for track in exhaust(playlist_function):
|
||||
yield SimplifiedTrack(**track)
|
||||
yield PlaylistTrack(**track).track
|
||||
|
@ -16,6 +16,13 @@ DEFAULT_LIMIT = 50
|
||||
T = TypeVar("T") # pylint: disable=invalid-name
|
||||
|
||||
|
||||
def echo(elements: Iterable[T]) -> Iterable[T]:
|
||||
"Echo the elements of an iterable and re-yield them"
|
||||
for element in elements:
|
||||
print(element)
|
||||
yield element
|
||||
|
||||
|
||||
def read_credentials_server(path: Path) -> Spotify:
|
||||
"Read credentials from a YAML file and construct a Spotify client using the server workflow"
|
||||
|
||||
|
Reference in New Issue
Block a user