예제 #1
0
파일: mpris2.py 프로젝트: pjw91/osdlyrics
    def _get_player_from_bus_names(self, names):
        """ Returns list of `PlayerInfo` objects according to names.

        The bus names in names with prefix of MPRIS2_PREFIX will be treated as MPRIS2
        players. The suffix of these names will be treated as player name

        Arguments:
        - `names`: list of bus names
        """
        return [
            PlayerInfo.from_name(name[len(MPRIS2_PREFIX):]) for name in names
            if name.startswith(MPRIS2_PREFIX) and name != DAEMON_MPRIS2_NAME
        ]
예제 #2
0
 def __init__(self):
     super().__init__('Mpd')
     self._player = None
     self._init_address()
     self._client = None
     self._player_info = PlayerInfo(name=PLAYER_NAME,
                                    appname='mpd',
                                    binname='mpd',
                                    cmd='mpd')
     self._player = None
     self._io_watch = None
     self._fetch_queue = []
     self._on_idle = False
예제 #3
0
    def _get_player_from_bus_names(self, names):
        """ Returns list of `PlayerInfo` objects according to names.

        The bus names in names with prefix of MPRIS2_PREFIX will be treated as MPRIS2
        players. The suffix of these names will be treated as player name

        Arguments:
        - `names`: list of bus names
        """
        return [
            PlayerInfo.from_name(name[len(MPRIS2_PREFIX):])
            for name in names
            if name.startswith(MPRIS2_PREFIX) and name != DAEMON_MPRIS2_NAME
        ]
예제 #4
0
 def do_list_active_players(self):
     ret = []
     for v in self._players.values():
         ret.append(PlayerInfo(v.name))
     return ret
예제 #5
0
 def _get_player_from_bus_names(self, names):
     return [
         PlayerInfo.from_name(name[len(MPRIS1_PREFIX):]) for name in names
         if name.startswith(MPRIS1_PREFIX)
         and not name.startswith(MPRIS1_PREFIX + 'MediaPlayer2.')
     ]
예제 #6
0
def player_info_from_name(name):
    return PlayerInfo(name, icon=name)
예제 #7
0
 def do_list_active_players(self):
     return [PlayerInfo(v.name) for v in self._players.values()]
예제 #8
0
 def _get_player_from_bus_names(self, names):
     return [
         PlayerInfo.from_name(name[len(MPRIS1_PREFIX):])
         for name in names
         if name.startswith(MPRIS1_PREFIX) and not name.startswith(MPRIS1_PREFIX + 'MediaPlayer2.')
     ]
예제 #9
0
def player_info_from_name(name):
    """ Returns a dict representing a player info by the given name
    """
    return PlayerInfo(name, icon=name)