add route to get all tracks in path

+ add routes to save album and artist as a playlist
This commit is contained in:
mungai-njoroge
2023-08-04 13:40:48 +03:00
parent efb6aae927
commit 655fd8bc22
7 changed files with 169 additions and 38 deletions
+4 -2
View File
@@ -96,8 +96,7 @@ class SQLitePlaylistMethods:
def add_item_to_json_list(playlist_id: int, field: str, items: set[str]):
"""
Adds a string item to a json dumped list using a playlist id and field name.
Takes the playlist ID, a field name,
an item to add to the field, and an error to raise if the item is already in the field.
Takes the playlist ID, a field name, an item to add to the field.
"""
sql = f"SELECT {field} FROM playlists WHERE id = ?"
@@ -121,6 +120,9 @@ class SQLitePlaylistMethods:
@classmethod
def add_tracks_to_playlist(cls, playlist_id: int, trackhashes: list[str]):
"""
Adds trackhashes to a playlist
"""
return cls.add_item_to_json_list(playlist_id, "trackhashes", trackhashes)
@staticmethod