Jellyfin/Emby: populate album thumb_url during the library scan (root cause of "flags every album")

JellyfinArtist sets self.thumb (→ artists.thumb_url on scan); JellyfinAlbum
never did. So for Jellyfin/Emby the library scan read getattr(album, 'thumb',
None) == None and albums.thumb_url stayed empty for the WHOLE library. Two
downstream effects: blank album art in the web UI, and the Cover Art Filler
flagging every album as "missing cover art" (db_missing = empty thumb_url) —
making the filler the only thing that ever populated the column, which is
backwards. It should come from the scan, like artist thumbs do.

Fix: JellyfinAlbum.thumb = /Items/<id>/Images/Primary (same shape as the artist
thumb, which already normalizes + displays via fix_artist_image_url). Now the
scan stores album thumbs, the UI shows art, and the filler only flags albums
that are genuinely missing art. Navidrome + Plex already set album thumbs.

Tests: album exposes the Primary-image thumb, None without an id, same shape as
the artist thumb.
This commit is contained in:
BoulderBadgeDad 2026-06-08 09:40:27 -07:00
parent c83d4862e8
commit 442ced3dbf
2 changed files with 45 additions and 2 deletions

View file

@ -65,6 +65,18 @@ class JellyfinAlbum:
self.title = jellyfin_data.get('Name', 'Unknown Album')
self.addedAt = self._parse_date(jellyfin_data.get('DateCreated'))
self._artist_id = jellyfin_data.get('AlbumArtists', [{}])[0].get('Id', '') if jellyfin_data.get('AlbumArtists') else ''
# Album cover image, mirroring JellyfinArtist.thumb — so the library
# scan stores albums.thumb_url instead of leaving it empty. Without
# this, EVERY album reads back with no thumb, the web UI shows blank
# art, and the Cover Art Filler flags the entire library as "missing
# cover art" (it became the only thing populating the column).
self.thumb = self._get_album_image_url()
def _get_album_image_url(self) -> Optional[str]:
"""Jellyfin/Emby album primary image URL (same shape as the artist one)."""
if not self.ratingKey:
return None
return f"/Items/{self.ratingKey}/Images/Primary"
def _parse_date(self, date_str: Optional[str]) -> Optional[datetime]:
if not date_str:

View file

@ -0,0 +1,31 @@
"""JellyfinAlbum must expose a cover-image thumb so the library scan stores
albums.thumb_url (mirroring JellyfinArtist). Without it the whole library reads
back with empty album thumbs blank art in the UI + the Cover Art Filler
flagging every album as "missing cover art".
"""
from __future__ import annotations
from core.jellyfin_client import JellyfinAlbum, JellyfinArtist
class _Client:
pass
def test_album_has_primary_image_thumb():
alb = JellyfinAlbum({'Id': 'abc123', 'Name': 'For You'}, _Client())
assert alb.thumb == '/Items/abc123/Images/Primary'
def test_album_thumb_none_without_id():
alb = JellyfinAlbum({'Name': 'No Id Album'}, _Client())
assert alb.thumb is None
def test_album_thumb_matches_artist_shape():
# Same URL shape the artist uses (already proven to display) — just the
# album's own item id.
art = JellyfinArtist({'Id': 'xyz', 'Name': 'A'}, _Client())
alb = JellyfinAlbum({'Id': 'xyz', 'Name': 'B'}, _Client())
assert alb.thumb == art.thumb