From 9db58133bde6222ce0095eaf5d5052ad53a90436 Mon Sep 17 00:00:00 2001 From: Manu Date: Fri, 19 May 2023 20:10:49 -0300 Subject: [PATCH] feat(app): add thumbnail or artwork support --- src/app.py | 5 +++-- src/tab.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app.py b/src/app.py index cac0cca..1f62791 100644 --- a/src/app.py +++ b/src/app.py @@ -112,6 +112,7 @@ def run(self) -> None: self.last_tab = tab state = self.last_tab.artist if self.last_tab.artist else "Unknown" details = self.last_tab.title if self.last_tab.title else "Unknown" + artwork = self.last_tab.artwork if self.last_tab.artwork else "logo" Logger.write( message=f"Playing {state} by {details}", origin=self, @@ -119,12 +120,12 @@ def run(self) -> None: self.__presence.update( details=details, state=state, - large_image="logo", + large_image=artwork, large_text=f"{self.title} v{self.version}", small_image="pause" if self.last_tab.pause else "play", small_text=self.__browser["fullname"], buttons=[ - {"label": "Play", "url": self.last_tab.url}, + {"label": "Listen to Youtube Music", "url": self.last_tab.url}, { "label": "Download App", "url": "https://manucabral.github.io/YoutubeMusicRPC/", diff --git a/src/tab.py b/src/tab.py index 804772c..1cfa66a 100644 --- a/src/tab.py +++ b/src/tab.py @@ -35,6 +35,7 @@ def sync(self): navigator.mediaSession.metadata.title, \ navigator.mediaSession.metadata.artist, \ navigator.mediaSession.metadata.album, \ + navigator.mediaSession.metadata.artwork[0].src, \ ].join([separator = '#'])" }, ) @@ -47,6 +48,7 @@ def sync(self): self.title = self.metadata[1] self.artist = self.metadata[2] self.album = self.metadata[3] + self.artwork = self.metadata[4] def close(self): if self.connected: