From 47cbc8998b83985dda8a1560ecd1c91e3072c414 Mon Sep 17 00:00:00 2001 From: SergSel2006 Date: Sun, 27 Nov 2022 23:29:55 +0700 Subject: [PATCH] make album art to be displayed --- discordrp_mpris/__main__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/discordrp_mpris/__main__.py b/discordrp_mpris/__main__.py index 5511185..3b9be0d 100644 --- a/discordrp_mpris/__main__.py +++ b/discordrp_mpris/__main__.py @@ -169,7 +169,15 @@ async def tick(self) -> None: activity['state'] = self.format_details("{state}", replacements) # set icons and hover texts - if player.name in PLAYER_ICONS: + art_icon_url = metadata.get("mpris:artUrl", "") + if art_icon_url and art_icon_url.startswith( + "http"): # TODO make this work with any other URL, as players also use data:image URL + activity['assets'] = {'large_text': player.name, + 'large_image': metadata.get("mpris:artUrl", ""), + 'small_image': state.lower(), + 'small_text': state} + + elif player.name in PLAYER_ICONS: activity['assets'] = {'large_text': player.name, 'large_image': PLAYER_ICONS[player.name], 'small_image': state.lower(),