Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def Stop(self):
ControllerApi.player.stop()
def reset_song_list(cls):
ControllerApi.player.clear_playlist()
if len(cls._songs) > 0:
song = cls._songs.pop()
mid = song['id']
music_model = ControllerApi.api.get_song_detail(mid)
if not ControllerApi.api.is_response_ok(music_model):
ControllerApi.notify_widget.show_message("Error", "网络异常,请检查网络连接")
return
ControllerApi.player.set_music_list([music_model])
else:
cls._songs = cls.get_songs()
if not ControllerApi.api.is_response_ok(cls._songs):
ControllerApi.player.stop()
ControllerApi.notify_widget.show_message("Error", "网络异常,请检查网络连接")
elif cls._songs == []:
ControllerApi.notify_widget.show_message("|--|", "未知错误")
else:
cls.reset_song_list()
def load(cls):
ControllerApi.notify_widget.show_message("通知", "进入 FM 播放模式")
ControllerApi.player.stop()
cls.reset_song_list()
data = reply.data
while len(data):
event, data = rq.EventField(None).parse_binary_value(
data, self.disp.display, None, None)
if event.type == X.KeyPress:
pass
elif event.type == X.KeyRelease:
keycode = event.detail
keysym = self.disp.keycode_to_keysym(keycode, 0)
if hex(keysym) == MediaKey.media_next.value:
ControllerApi.player.play_next()
elif hex(keysym) == MediaKey.media_previous.value:
ControllerApi.player.play_last()
elif hex(keysym) == MediaKey.media_stop.value:
ControllerApi.player.stop()
elif hex(keysym) == MediaKey.media_play_pause.value:
ControllerApi.player.play_or_pause()