def do_play(self, query): """切换为播放状态或者播放一首特定的歌曲 假设有一首歌的id是: 1314 你可以通过以下命令播放你所指定的这首歌 用法示例: \033[92mfeeluown ☛ play 1314\033[0m 你也可以不加参数,它可以让播放器从暂停状态切换为播放状态: \033[92mfeeluown ☛ play\033[0m """ func = 'play()' if query != '': try: func = 'play(%d)' % int(query) except ValueError: Helpers.print_hint("参数必须是歌曲的 id") return Client.send(func) Client.recv()
def do_search(self, query): """搜索歌曲、歌手、专辑 etc. 用法示例: \033[92mfeeluown ☛ search 刘德华\033[0m """ if query.startswith('"'): query = query[1:-1] func = 'search("%s")' % query Client.send(func) data = Client.recv() songs = data.get('result', None) if type(songs) == list: self.songs = songs[:10] Helpers.print_music_list(songs) else: Helpers.print_hint("蛋疼,没有搜到...")
def do_play_preview(self, query): """播放上一个歌曲""" Client.send('play_previous()') Client.recv()
def do_play_next(self, query): """播放下一首歌曲""" Client.send('play_next()') Client.recv()
def do_pause(self, query): """暂停播放歌曲""" Client.send('pause()') Client.recv()