Skip to content

Commit

Permalink
feat(app): add thumbnail or artwork support
Browse files Browse the repository at this point in the history
  • Loading branch information
manucabral committed May 19, 2023
1 parent 3ed8a9e commit 9db5813
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,19 +112,20 @@ 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,
)
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/",
Expand Down
2 changes: 2 additions & 0 deletions src/tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '#'])"
},
)
Expand All @@ -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:
Expand Down

0 comments on commit 9db5813

Please sign in to comment.