Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def exit(cls):
ControllerApi.notify_widget.show_message("通知", "退出 FM 播放模式")
def delete_playlist(self):
m = QMessageBox(QMessageBox.Warning, '警告', '确认删除歌单么 ?',
QMessageBox.Yes | QMessageBox.No)
if m.exec() != QMessageBox.Yes:
return False
pid = self.data['id']
flag = ControllerApi.api.delete_playlist(pid)
if flag:
ControllerApi.notify_widget.show_message('◕◡◔', '删除歌单成功')
self.close()
self.deleteLater()
return True
else:
ControllerApi.notify_widget.show_message('◕◠◔', '删除歌单失败')
return False
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 add_to_playlist(self, pid):
if not ControllerApi.state['current_mid']:
return False
flag = ControllerApi.api.add_song_to_playlist(ControllerApi.state['current_mid'], pid)
if flag:
ControllerApi.notify_widget.show_message('◕◡◔', '加入歌单成功')
else:
ControllerApi.notify_widget.show_message('◕◠◔', '加入歌单失败, 可能早已在列表了哦')
def change_to_simi(self):
PlaylistItem.de_active_all()
if self.current_mode == 1:
FmMode.exit_()
elif self.current_mode == 2:
ControllerApi.notify_widget.show_message("提示", "你正处于单曲电台模式")
return
self.current_mode = 2
ControllerApi.player.change_player_mode_to_other()
SimiSongsMode.load_()
def toggle_desktop_mini(cls):
if ControllerApi.desktop_mini.isVisible():
ControllerApi.desktop_mini.close()
else:
ControllerApi.desktop_mini.show()
ControllerApi.notify_widget.show_message(
"Tips", "按ESC可以退出mini模式哦 ~")