command/albumart: add "file" field with the artwork path#2467
Open
CamilleScholtz wants to merge 1 commit intoMusicPlayerDaemon:masterfrom
Open
command/albumart: add "file" field with the artwork path#2467CamilleScholtz wants to merge 1 commit intoMusicPlayerDaemon:masterfrom
CamilleScholtz wants to merge 1 commit intoMusicPlayerDaemon:masterfrom
Conversation
Clients have no way of knowing which file in the song's directory was selected as the artwork. Exposing the path enables artwork comparison (do two tracks share artwork?), stable cache keys, detection of changes on disk, and clearer debugging when several candidate files are present. The path is resolved against the database (relative) URI for RELATIVE lookups and against the canonical URI for PATH/ABSOLUTE lookups, mirroring how the song was addressed by the client. Closes MusicPlayerDaemon#2397
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #2397.
The
albumartresponse currently exposes only the artwork's size and bytes. Clients have no way of knowing which file in the song's directory MPD picked (cover.png/cover.jpg/cover.jxl/cover.webp). This adds afilefield with the resolved artwork path, which is useful for:cover.jpgis replaced on disk.Example::
Implementation notes
read_stream_art()now takes both an open directory (still the cache key) and a display directory (used for the response). Their values diverge only for the database (RELATIVE) case, where the open directory is the storage-mapped path while the response should reflect the path as the client addressed it.InputStream's URI viais->GetUriView(), so subsequent chunked requests that hit theLastInputStreamcache continue to report the samefile:value without extra plumbing.RealDirectoryOfSong()now walks the relative and resolved directories in lockstep so CUE-sheet../resolution applies to both forms.PATH/ABSOLUTEURIs the open and display directory are the same, so the response prints the absolute path or URL.Test plan
Verified manually against a test fixture with
cover.pngnext to a song, on macOS:albumart foo/bar.ogg 0→file: foo/cover.pngalbumart /abs/path/foo/bar.ogg 0→file: /abs/path/foo/cover.pngfile:offset > sizestill returnsACK [2@0] {albumart} Offset too large(nofile:line on error)ACK [50@0] {albumart} No file exists