feat: use Cover Art Archive for albums with MusicBrainz IDs #27
Reference in New Issue
Block a user
Delete Branch "feat/cover-art-archive"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Closes #10. Supersedes #12 with a simpler approach.
coverartarchive.org/release/{MBZAlbumID}/front-500to check for artwork/release-group/{MBZReleaseGroupID}/front-500), which resolves to the best available release with art in the same grouparchive.orgredirect URL from theLocationheader (usingNoFollowRedirects) and passes it directly to Discord — no image download or re-upload neededDifferences from #12
MBZAlbumID— will also tryMBZReleaseGroupIDalonearchive.orgURL directly to Discord instead of constructing it from the API responseTest plan
headCoverArt: 307 with Location, 404, HTTP error, missing Location headergetImageViaCoverArt: cache hit/miss, release fallback to release-group, both fail, empty IDsgetImageURLintegration: CAA hit skips other methods, CAA miss falls through to uguu/directgetImageURL(username, TrackInfo)signaturego test -race ./...passesmake buildandmake packagesucceedSummary of Changes
Hello, I'm Gemini Code Assist1 ! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces a significant enhancement to how album artwork is retrieved and displayed. It integrates with the Cover Art Archive (CAA) using MusicBrainz IDs, providing a more robust and efficient method for sourcing high-quality cover art. The changes include a new configuration option, an intelligent fallback system for artwork discovery, and optimized handling of image URLs to minimize resource usage, ultimately improving the user experience by ensuring more accurate and readily available album art.
Highlights
coverartarchive.orgto check for artwork, avoiding full API responses.archive.orgredirect URL is now passed directly to Discord, eliminating the need for image download or re-upload.🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point by creating a comment using either
/gemini <command>or@gemini-code-assist <command>. Below is a summary of the supported commands on the current page./gemini review/gemini summary/gemini helpCustomization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a
.gemini/folder in the base of the repository. Detailed instructions can be found here.Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩︎
Download the plugin for this PR: discord-rich-presence.zip
Built from
76d4074ca1on 2026-03-21T00:33:56ZCode Review
This pull request introduces a great new feature to fetch cover art from the Cover Art Archive. The implementation is clean, efficient by using HEAD requests, and includes thoughtful features like release-group fallback and caching. The accompanying tests are comprehensive and cover many scenarios. My feedback includes a couple of minor suggestions to improve code maintainability.
@@ -7,10 +7,94 @@ import (To improve maintainability and avoid magic numbers, it's better to define
5000as a constant, for exampleconst caaRequestTimeoutMs = 5000, and use it here. You could define it with the other constants in this file.@@ -30,2 +30,4 @@activityNameKey = "activityname"spotifyLinksKey = "spotifylinks"caaEnabledKey = "caaenabled"uguuEnabledKey = "uguuenabled"These constants are only used in
coverart.go. To improve code organization and maintainability, it's best to define constants in the file where they are used. Please consider movingcaaEnabledKeyanduguuEnabledKeytocoverart.go. This would also be consistent with howuguuEnabledKeywas defined before this change.Pull request overview
Adds optional Cover Art Archive (CAA) lookups for album artwork when MusicBrainz IDs are available, prioritizing CAA over existing artwork sources and caching results to reduce repeated network calls.
Changes:
caaenabledconfig toggle and allows HTTP access tocoverartarchive.org.getImageURLto acceptTrackInfo(so it can use MBZ IDs) and adjusts tests/dependencies accordingly.Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
coverartarchive.orgto allowed HTTP hosts and introduces thecaaenabledconfig option/UI control.NowPlayingto call the newgetImageURL(username, TrackInfo)signature.caaenabledconfig access.headCoverArt,getImageViaCoverArt, and updatedgetImageURLbehavior.💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@@ -7,10 +7,94 @@ import (getImageViaCoverArtcaches an empty string forcaaCacheTTLMisswheneverimageURL == "", including whenheadCoverArtfailed due to transient conditions (network error, 429/5xx, etc.). This can suppress retries for 4 hours after a temporary outage or rate-limit response. Consider distinguishing “definite miss” (e.g., 404) from “request failure” and only caching the former (or using a much shorter TTL for failures).@@ -7,10 +7,94 @@ import (Already extracted to
caaTimeOutconstant in a subsequent commit.@@ -30,2 +30,4 @@activityNameKey = "activityname"spotifyLinksKey = "spotifylinks"caaEnabledKey = "caaenabled"uguuEnabledKey = "uguuenabled"Intentional — all config keys are grouped together in
main.gofor discoverability. Having them scattered across files makes it harder to audit which config keys exist.@@ -7,10 +7,94 @@ import (Fixed in
76d4074.headCoverArtnow returns(url, definitive)— transient failures (network errors, unexpected status codes) returndefinitive=falseand are not cached, allowing immediate retries on the next track event. Only 404s are cached as misses.