mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
🔷 add PlayingFrom component to right sidebar
🔷 move upNext card into separate component 🔷 a lot of refactors
This commit is contained in:
@@ -15,14 +15,20 @@ def add_track(playlistid: str, trackid: str):
|
||||
"""
|
||||
for playlist in api.PLAYLISTS:
|
||||
if playlist.playlistid == playlistid:
|
||||
track = trackslib.get_track_by_id(trackid)
|
||||
tt = trackslib.get_track_by_id(trackid)
|
||||
|
||||
if track not in playlist.tracks:
|
||||
playlist.tracks.append(track)
|
||||
track = {
|
||||
"title": tt.title,
|
||||
"artists": tt.artists,
|
||||
"album": tt.album,
|
||||
}
|
||||
|
||||
try:
|
||||
playlist.add_track(track)
|
||||
instances.playlist_instance.add_track_to_playlist(playlistid, track)
|
||||
return
|
||||
else:
|
||||
raise TrackExistsInPlaylist("Track already in playlist.")
|
||||
except TrackExistsInPlaylist as e:
|
||||
return {"error": str(e)}, 409
|
||||
|
||||
|
||||
def get_playlist_tracks(pid: str):
|
||||
@@ -31,7 +37,6 @@ def get_playlist_tracks(pid: str):
|
||||
return p.tracks
|
||||
|
||||
|
||||
|
||||
def create_all_playlists():
|
||||
"""
|
||||
Gets all playlists from the database.
|
||||
|
||||
Reference in New Issue
Block a user