Fix album art for browser players: fetch file:// thumbnails that only exist on the host#34
Open
JustLikeFrank3 wants to merge 1 commit into
Conversation
Browser-based players (Chromium, Firefox) expose mpris:artUrl as a file in the host's /tmp, which is not visible inside the flatpak sandbox, so their album art silently never rendered. When the art path does not exist in the sandbox, fetch it via `flatpak-spawn --host` (the app already has org.freedesktop.Flatpak talk permission) and cache it in the plugin cache dir keyed by content hash, so track changes still produce a new path for the thumbnail change detection. flatpak-spawn must be run with cwd="/" because it starts the host command in the caller's working directory, and the sandbox cwd (/app/...) does not exist on the host. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
Browser-based players (Chromium/Chrome, and Firefox on some setups) expose
mpris:artUrlas afile://path in the host's/tmp(e.g.file:///tmp/.com.google.Chrome.XXXXXX). That directory is not visible inside the flatpak sandbox, sothumbnail()returns a path that fails theos.path.isfilecheck in the actions and the album art silently never renders — while https art (Spotify etc.) works fine.Fix
When the resolved
file://path does not exist in the sandbox, fetch the file viaflatpak-spawn --host cat(the app manifest already grantsorg.freedesktop.Flatpaktalk permission) and store it in the existing plugin cache dir (gl.DATA_PATH/com_core447_MediaPlugin/cache, which the plugin already clears on startup).Two details worth noting:
last_thumbnail_path) and leave stale art on track changes.flatpak-spawnmust run withcwd="/"— it starts the host command in the caller's working directory, and the sandbox cwd (/app/bin/StreamController) does not exist on the host, which otherwise fails withPortal call failed: Failed to change to directory "/app/bin/StreamController".Native paths that do exist in the sandbox are returned unchanged, and any failure falls back to the original path (current behavior).
Tested
StreamController 1.5.0-beta.15 (flatpak) on Ubuntu (GNOME 50, Wayland), Stream Deck MK.2, with Chrome as the MPRIS player: Thumbnail Background (2x2 grid mode) went from permanently blank to rendering and following track changes. https-art players are unaffected.
🤖 Generated with Claude Code