Add album art backend: MusicBrainz + Cover Art Archive, proxied and cached
New GET /api/v1/art/album?artist=&album= resolves and streams an album's cover art. Lookups go through MusicBrainz release-group search then Cover Art Archive's release-group front-image endpoint, both free and keyless - no setup required by self-hosters. Results (hits, misses and errors) are cached in a new album_art table keyed case-insensitively on (artist, album), since Scrobble.mbid can't be trusted as a release identifier. The service layer separates resolving where the art is (lookup()) from fetching the bytes (fetch_image()) so a future move to storing the bytes ourselves only touches the latter. Also widens the UI's CSP (img-src) to allow blob: URLs, since the frontend will fetch art with the existing bearer-auth header and hand the browser a blob: object URL rather than hotlinking. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7b169ea807
commit
5bdeeddb0b
13 files changed
+627
-2
No files matched your search
@@ -48,7 +48,7 @@ def init_app(app: Flask) -> None:
|
||||
},
|
||||
)
|
||||
|
||||
from scrobbler.api import apps, auth, health, imports, sessions, stats, tokens, tracks
|
||||
from scrobbler.api import apps, art, auth, health, imports, sessions, stats, tokens, tracks
|
||||
|
||||
api.register_blueprint(auth.blp, url_prefix="/api/v1/auth")
|
||||
api.register_blueprint(apps.blp, url_prefix="/api/v1/apps")
|
||||
@@ -57,6 +57,7 @@ def init_app(app: Flask) -> None:
|
||||
api.register_blueprint(stats.blp, url_prefix="/api/v1/me")
|
||||
api.register_blueprint(tracks.blp, url_prefix="/api/v1/me/tracks")
|
||||
api.register_blueprint(imports.blp, url_prefix="/api/v1/imports")
|
||||
api.register_blueprint(art.blp, url_prefix="/api/v1/art")
|
||||
api.register_blueprint(health.blp)
|
||||
|
||||
from scrobbler.openapi import lastfm
|
||||
|
||||
Reference in new issue
Block a user