mirror of
https://github.com/MrPatben8/konduktor.git
synced 2026-11-27 10:22:51 +01:00
Implemented cross-platform track color support
This commit is contained in:
1 parent
0605dbabe6
commit
06361a851f
38 files changed
+547
-34
No files matched your search
@@ -60,6 +60,7 @@ from .schemas import (
|
||||
LibraryInfo,
|
||||
PlatformOption,
|
||||
EditTrack,
|
||||
SetTrackColor,
|
||||
Facets,
|
||||
FileTagOutcome,
|
||||
CreateExportSet,
|
||||
@@ -1320,6 +1321,17 @@ def edit_track(body: EditTrack) -> dict:
|
||||
return {"status": "updated", "id": body.track_id}
|
||||
|
||||
|
||||
@app.patch("/api/tracks/color")
|
||||
def set_track_color(body: SetTrackColor) -> dict:
|
||||
"""Set (or clear) the colour tag of every given track (in-memory; persisted
|
||||
on save). Gated on `tracks.colors`: the platform's swatches."""
|
||||
a = require_adapter()
|
||||
if not a.capabilities().tracks.colors:
|
||||
raise Unsupported("This library cannot store a track colour")
|
||||
tracks = [a.set_track_color(tid, body.color) for tid in body.track_ids]
|
||||
return {"status": "updated", "tracks": [t for t in tracks if t is not None]}
|
||||
|
||||
|
||||
@app.get("/api/tracks/art")
|
||||
def track_art(track_id: str) -> Response:
|
||||
"""Stream a track's embedded cover art (staged replacement if unsaved)."""
|
||||
|
||||
Reference in new issue
Block a user