Skip to content

Feat: local artwork cache#38

Closed
josueygp wants to merge 2 commits intowimpysworld:mainfrom
josueygp:feat-local-artwork-cache
Closed

Feat: local artwork cache#38
josueygp wants to merge 2 commits intowimpysworld:mainfrom
josueygp:feat-local-artwork-cache

Conversation

@josueygp
Copy link
Copy Markdown

Description

Many Linux desktop environments (most notably GNOME's built-in media controls) deliberately reject remote https:// URLs in MPRIS payloads for security and rendering performance reasons.

This Pull Request implements asynchronous downloading of the artwork from the remote Apple CDN to a universally readable local path (app.getPath('userData')/art, which evaluates to ~/.config/sidra/art). Using userData over os.tmpDir or AppImage's sandboxed cache ensures the host OS can successfully traverse and read the cached image path across all distribution methods.

The original https:// URL is still emitted immediately as a fallback for more tolerant environments like KDE Plasma, but updates to a compliant file:///... URI once the local JPG is ready.

Reference: #33

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/integrations/mpris/index.ts">

<violation number="1" location="src/integrations/mpris/index.ts:642">
P1: Asynchronous artwork-cache callbacks can overwrite newer track metadata because they update `_metadata` without verifying the track is still current.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

.then(() => {
metadata['mpris:artUrl'] = new Variant('s', fileUrl);
if (playerIfaceRef) {
playerIfaceRef._metadata = metadata;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Asynchronous artwork-cache callbacks can overwrite newer track metadata because they update _metadata without verifying the track is still current.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/integrations/mpris/index.ts, line 642:

<comment>Asynchronous artwork-cache callbacks can overwrite newer track metadata because they update `_metadata` without verifying the track is still current.</comment>

<file context>
@@ -617,6 +623,51 @@ function onNowPlayingItemDidChange(payload: unknown): void {
+        .then(() => {
+          metadata['mpris:artUrl'] = new Variant('s', fileUrl);
+          if (playerIfaceRef) {
+            playerIfaceRef._metadata = metadata;
+            schedulePropertyEmission({ Metadata: metadata });
+          }
</file context>

flexiondotorg added a commit that referenced this pull request Mar 25, 2026
 #39

- Add artwork module with downloadArtwork() to cache remote HTTPS URLs
- Store artwork locally with content-addressable naming (SHA-256
  hashing)
- Emit file:// URIs from MPRIS integration (required for GNOME Shell)
- Provide local file paths to desktop notifications for display
- Implement automatic cache cleanup on app startup (7-day retention)
- Prevent unbounded cache growth in ~/.cache/sidra/artwork/

Signed-off-by: Martin Wimpress <code@wimpress.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant