soulsync/tests/test_jellyfin_album_thumb.py
BoulderBadgeDad 442ced3dbf 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.
2026-06-08 09:40:27 -07:00

31 lines
1,022 B
Python

"""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