Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def _add_player(self, player_id):
"""
Add player to mpris_players
"""
if not player_id.startswith(SERVICE_BUS):
return False
# Fixes chromium mpris
try:
player = self._dbus.get(player_id, SERVICE_BUS_URL)
except KeyError:
if "chromium" in player_id:
player = BrokenDBusMpris(self._dbus, "Chromium", "Stopped")
else:
return False
if player.Identity not in self._mpris_names:
self._mpris_names[player.Identity] = player_id.split(".")[-1]
for p in self._mpris_players.values():
if not p["name"] and p["identity"] in self._mpris_names:
p["name"] = self._mpris_names[p["identity"]]
p["full_name"] = "{} {}".format(p["name"], p["index"])
identity = player.Identity
name = self._mpris_names.get(identity)
if (
self.player_priority != []
and name not in self.player_priority
and "*" not in self.player_priority
def __init__(self, dbus, identity, playback_status):
self._dbus = dbus
self.Identity = identity
self.PlaybackStatus = playback_status
self.PropertiesChanged = BrokenDBusMpris.PropertiesChanged(self, dbus)
self.Metadata = {"xesam:album": None, "xesam:artist": None, "xesam:title": None}