fix(mediacontrols): answer "no artwork" instead of saying nothing #80

Closed
logan wants to merge 1 commits from fix/mpris-stale-art into main
Collaborator

Closes #41.

mpris_linux.go omitted mpris:artUrl when a track had no cover. KDE keeps showing the last image it was handed, so the Plasma taskbar preview for an untagged track displayed the cover of whichever earlier album had one.

The key is now always published, empty when there is nothing behind it. metadataMap is extracted so the dictionary can be asserted on without a bus, and the counter-test pins that this is the exception: every other field stays absent when empty, since a title of "" would make players draw a blank line where they would otherwise fall back to the filename.

What this does and does not promise. We already replaced the whole Metadata dict on every track, so the stale image was Plasma caching the last non-empty value rather than us republishing it — an explicit empty string is the standard way to say "none". If Plasma turns out to ignore an empty artUrl too, the follow-up is a placeholder image, which wants the app icon from #22 to point at. Worth a check on your KDE box before this is called done.

Tests. backend/mediacontrols/mpris_metadata_linux_test.go, table-driven, under the same linux && !android tag so CI runs it.

Closes #41. `mpris_linux.go` omitted `mpris:artUrl` when a track had no cover. KDE keeps showing the last image it was handed, so the Plasma taskbar preview for an untagged track displayed the cover of whichever earlier album had one. The key is now always published, empty when there is nothing behind it. `metadataMap` is extracted so the dictionary can be asserted on without a bus, and the counter-test pins that this is the *exception*: every other field stays absent when empty, since a title of `""` would make players draw a blank line where they would otherwise fall back to the filename. **What this does and does not promise.** We already replaced the whole `Metadata` dict on every track, so the stale image was Plasma caching the last non-empty value rather than us republishing it — an explicit empty string is the standard way to say "none". If Plasma turns out to ignore an empty `artUrl` too, the follow-up is a placeholder image, which wants the app icon from #22 to point at. Worth a check on your KDE box before this is called done. **Tests.** `backend/mediacontrols/mpris_metadata_linux_test.go`, table-driven, under the same `linux && !android` tag so CI runs it.
logan added 1 commit 2026-08-18 15:26:30 +00:00
fix(mediacontrols): answer "no artwork" instead of saying nothing
CI / check (push) Skipped
CI / e2e (push) Skipped
CI / check (pull_request) Successful in 2m30s
CI / e2e (pull_request) Canceled after 0s
128fa85a65
A track with no cover art omitted mpris:artUrl entirely, and KDE's
media controller keeps showing the last image it was handed -- so the
taskbar preview for an untagged track displayed the cover of whichever
earlier album happened to have one, where the user has no way to tell
it is stale.

The key is now always published, empty when there is nothing. Omitting
a field is what an absent value naturally reads as, and artwork is the
one field where that is wrong.

The dictionary build is extracted so it can be asserted on without a
bus. Every other field stays absent when empty -- a title of "" would
make players show a blank line where they would otherwise fall back to
the filename.

Refs #41
Author
Collaborator

Closing as a duplicate of #82, whose b3556d82 fix(mediacontrols): always send an art URL, even when there is no art is the same fix and is a superset of this one.

We arrived at the same shape independently — extract metadataMap(meta, trackID) so the dictionary can be asserted on without a session bus, and always publish mpris:artUrl rather than omitting it. Theirs additionally modernises map[string]interface{}map[string]any and has a third test (TestMetadataMapTrackIDVaries); their TestMetadataMapOmitsEmptyOptionalFields is the same counter-assertion as this branch’s TestEmptyFieldsStayAbsent, i.e. that artUrl is the exception and a title of "" still stays absent.

Nothing here is missing from #82, so there is nothing to port. #41 should be closed by #82.

One caveat worth carrying over to #41 either way: we already replaced the whole Metadata dict on every track, so the stale image is Plasma caching the last non-empty value rather than us republishing it. An empty string is the standard way to say "none", but if Plasma ignores it too, the follow-up is a placeholder image — which wants the app icon from #22 to point at. Worth checking on a real KDE session before calling #41 done.

Closing as a duplicate of #82, whose `b3556d82 fix(mediacontrols): always send an art URL, even when there is no art` is the same fix and is a superset of this one. We arrived at the same shape independently — extract `metadataMap(meta, trackID)` so the dictionary can be asserted on without a session bus, and always publish `mpris:artUrl` rather than omitting it. Theirs additionally modernises `map[string]interface{}` → `map[string]any` and has a third test (`TestMetadataMapTrackIDVaries`); their `TestMetadataMapOmitsEmptyOptionalFields` is the same counter-assertion as this branch’s `TestEmptyFieldsStayAbsent`, i.e. that artUrl is the *exception* and a title of `""` still stays absent. Nothing here is missing from #82, so there is nothing to port. #41 should be closed by #82. One caveat worth carrying over to #41 either way: we already replaced the whole `Metadata` dict on every track, so the stale image is Plasma caching the last non-empty value rather than us republishing it. An empty string is the standard way to say "none", but if Plasma ignores it too, the follow-up is a placeholder image — which wants the app icon from #22 to point at. Worth checking on a real KDE session before calling #41 done.
logan closed this pull request 2026-08-18 15:32:33 +00:00

Pull request closed

This pull request cannot be reopened because the branch was deleted.
Sign in to join this conversation.