Skip to content

Commit

Permalink
fix(presences.Twitch): hosrt stream title and avatar handling for bet…
Browse files Browse the repository at this point in the history
…ter display
  • Loading branch information
manucabral committed Nov 1, 2024
1 parent 86aeb33 commit 5c2ce83
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions presences/Twitch/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,17 @@ def on_update(self, runtime: rpp.Runtime, **context):
self.state = "Browsing Twitch"
self.details = None
self.large_image = TWITCH_ICON
self.log.info("Browsing...")
return

title = self.extract_stream_title().textContent.value
avatar = self.extract_stream_avatar().src.value
if len(title) < 2:
title = "|> " + title
if len(title) > 128:
title = title[:125] + "..."
if len(avatar) > 128:
avatar = TWITCH_ICON
channel_name = self.tab.url.split("/")[-1]
self.state = title
self.details = "Watching " + channel_name
Expand Down

0 comments on commit 5c2ce83

Please sign in to comment.