Skip to content

Commit

Permalink
mpris: use new helper: get_replacements_list introduced with (ultrabu…
Browse files Browse the repository at this point in the history
  • Loading branch information
valdur55 committed Jan 21, 2025
1 parent c2d623a commit 731dd58
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions py3status/modules/mpris.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
Keep in mind that the state has a higher priority than
player_priority. So when player_priority is "[mpd, bomi]" and mpd is
paused and bomi is playing than bomi wins. (default [])
replacements: specify a list/dict of string placeholders to modify (default None)
state_pause: specify icon for pause state (default u'\u25eb')
state_play: specify icon for play state (default u'\u25b7')
state_stop: specify icon for stop state (default u'\u25a1')
Expand Down Expand Up @@ -283,6 +284,10 @@ def metadata(self, metadata=None):
if not self._metadata.get("title"):
self._metadata["title"] = "No Track"

for x in self.parent.replacements_init:
if x in self._metadata and self._metadata[x]:
self._metadata[x] = self.parent.py3.replace(self._metadata[x], x)

@property
def state(self):
return self._state
Expand Down Expand Up @@ -379,6 +384,7 @@ class Py3status:
icon_stop = "\u25a1"
max_width = None
player_priority = []
replacements = None
state_pause = "\u25eb"
state_play = "\u25b7"
state_stop = "\u25a1"
Expand All @@ -394,6 +400,7 @@ class Meta:
}

def post_config_hook(self):
self.replacements_init = self.py3.get_replacements_list(self.format)
self._name_owner_change_match = None
self._kill = False
self._mpris_players: dict[Player] = {}
Expand Down

0 comments on commit 731dd58

Please sign in to comment.