def _add_player(self, player_id):
if not player_id.startswith(SERVICE_BUS):<EOL><INDENT>return False<EOL><DEDENT>player = self._dbus.get(player_id, SERVICE_BUS_URL)<EOL>if player.Identity not in self._mpris_names:<EOL><INDENT>self._mpris_names[player.Identity] = player_id.split("<STR_LIT:.>")[-<NUM_LIT:1>]<EOL>for p in self._mpris_players.values():<EOL><INDENT>if not p["<STR_LIT:name>"] and p["<STR_LIT>"] in self._mpris_names:<EOL><INDENT>p["<STR_LIT:name>"] = self._mpris_names[p["<STR_LIT>"]]<EOL>p["<STR_LIT>"] = u"<STR_LIT>".format(p["<STR_LIT:name>"], p["<STR_LIT:index>"])<EOL><DEDENT><DEDENT><DEDENT>identity = player.Identity<EOL>name = self._mpris_names.get(identity)<EOL>if (<EOL>self.player_priority != []<EOL>and name not in self.player_priority<EOL>and "<STR_LIT:*>" not in self.player_priority<EOL>):<EOL><INDENT>return False<EOL><DEDENT>if identity not in self._mpris_name_index:<EOL><INDENT>self._mpris_name_index[identity] = <NUM_LIT:0><EOL><DEDENT>status = player.PlaybackStatus<EOL>state_priority = WORKING_STATES.index(status)<EOL>index = self._mpris_name_index[identity]<EOL>self._mpris_name_index[identity] += <NUM_LIT:1><EOL>try:<EOL><INDENT>subscription = player.PropertiesChanged.connect(<EOL>self._player_monitor(player_id)<EOL>)<EOL><DEDENT>except AttributeError:<EOL><INDENT>subscription = {}<EOL><DEDENT>self._mpris_players[player_id] = {<EOL>"<STR_LIT>": player,<EOL>"<STR_LIT>": player_id,<EOL>"<STR_LIT>": state_priority,<EOL>"<STR_LIT:index>": index,<EOL>"<STR_LIT>": identity,<EOL>"<STR_LIT:name>": name,<EOL>"<STR_LIT>": u"<STR_LIT>".format(name, index),<EOL>"<STR_LIT:status>": status,<EOL>"<STR_LIT>": subscription,<EOL>}<EOL>return True<EOL>
Add player to mpris_players