diff --git a/src/mpd_now_playable/mpd/listener.py b/src/mpd_now_playable/mpd/listener.py index 9559937..960dc8c 100644 --- a/src/mpd_now_playable/mpd/listener.py +++ b/src/mpd_now_playable/mpd/listener.py @@ -95,6 +95,13 @@ class MpdStateListener(Player): print(song) listener.update(song) + async def albumart(self, file: str) -> bytes | None: + try: + albumart = await self.client.albumart(file) + return albumart.get("binary") + except CommandError: + return None + async def readpicture(self, file: str) -> bytes | None: try: readpic = await self.client.readpicture(file) diff --git a/stubs/mpd/asyncio.pyi b/stubs/mpd/asyncio.pyi index 221fcf4..6968141 100644 --- a/stubs/mpd/asyncio.pyi +++ b/stubs/mpd/asyncio.pyi @@ -13,6 +13,7 @@ class MPDClient(MPDClientBase): def idle(self, subsystems: Sequence[str] = ...) -> AsyncIterator[Sequence[str]]: ... async def status(self) -> types.StatusResponse: ... async def currentsong(self) -> types.CurrentSongResponse: ... + async def albumart(self, uri: str) -> types.ReadPictureResponse: ... async def readpicture(self, uri: str) -> types.ReadPictureResponse: ... async def play(self) -> None: ... async def pause(self, pause: Literal[1, 0, None] = None) -> None: