summaryrefslogtreecommitdiffhomepage
path: root/yt-music-dl-web/src/features/library/logic.ts
diff options
context:
space:
mode:
Diffstat (limited to 'yt-music-dl-web/src/features/library/logic.ts')
-rw-r--r--yt-music-dl-web/src/features/library/logic.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/yt-music-dl-web/src/features/library/logic.ts b/yt-music-dl-web/src/features/library/logic.ts
index fc29b37..4d3676c 100644
--- a/yt-music-dl-web/src/features/library/logic.ts
+++ b/yt-music-dl-web/src/features/library/logic.ts
@@ -234,9 +234,11 @@ export function trackSidebarItems(track: Track, results: MetadataResult[]): Side
* Build a PATCH /api/library/:id body (UpdateTrackRequest) from a clicked
* sidebar item. The "Current tags" entry (source: "youtube") produces an empty
* body (no-op); an MB result sets title + artist always, album + track only
- * when the result actually carries them. Mirrors fillActions from metadata.ts
- * but produces an UpdateTrackRequest (a PATCH body) instead of EditAction[]
- * (in-memory draft edits). Pure: (item) → request.
+ * when the result actually carries them. When the result has a Cover Art
+ * Archive `artUrl`, it is included so the backend downloads + embeds the
+ * front cover. Mirrors fillActions from metadata.ts but produces an
+ * UpdateTrackRequest (a PATCH body) instead of EditAction[] (in-memory draft
+ * edits). Pure: (item) → request.
*/
export function toUpdateRequestFromItem(item: SidebarItem): UpdateTrackRequest {
if (item.source === "youtube") return {}; // no-op — current tags
@@ -246,6 +248,7 @@ export function toUpdateRequestFromItem(item: SidebarItem): UpdateTrackRequest {
};
if (item.album !== undefined) req.album = item.album;
if (item.trackNumber !== undefined) req.track = item.trackNumber;
+ if (item.artUrl !== undefined) req.artUrl = item.artUrl;
return req;
}