Try both readpicture and albumart, prefer the former

This commit is contained in:
Danielle McLean 2024-05-17 10:18:54 +10:00
parent 569372d4e2
commit fd7866ed14
Signed by: 00dani
GPG key ID: 6854781A0488421C
3 changed files with 10 additions and 6 deletions

View file

@ -6,7 +6,7 @@ from ..async_tools import run_background_task
from ..cache import Cache, make_cache
from .types import CurrentSongResponse, MpdStateHandler
CACHE_TTL = 60 * 60 # seconds = 1 hour
CACHE_TTL = 60 * 60 # seconds = 1 hour
class ArtCacheEntry(TypedDict):
@ -49,7 +49,7 @@ class MpdArtworkCache:
return None
async def cache_artwork(self, song: CurrentSongResponse) -> None:
art = ArtCacheEntry(data=await self.mpd.readpicture(song["file"]))
art = ArtCacheEntry(data=await self.mpd.get_art(song["file"]))
try:
await self.album_cache.add(calc_album_key(song), art, ttl=CACHE_TTL)
except ValueError: