From c32c6c5d9beb91050cb8bc947ebb4d42a751f0da Mon Sep 17 00:00:00 2001 From: Terry Geng Date: Tue, 3 Mar 2020 23:53:49 +0800 Subject: [PATCH] fix: save playlist problem --- mumbleBot.py | 13 ++++++++----- playlist.py | 5 ++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/mumbleBot.py b/mumbleBot.py index 4d1da1c..54cdd19 100644 --- a/mumbleBot.py +++ b/mumbleBot.py @@ -583,12 +583,15 @@ class MumbleBot: else: self._loop_status = 'Empty queue' else: - if var.playlist.current_item()["ready"] != "downloading": - self.wait_for_downloading = False - self.launch_music() - self.async_download_next() + if var.playlist.current_item(): + if var.playlist.current_item()["ready"] != "downloading": + self.wait_for_downloading = False + self.launch_music() + self.async_download_next() + else: + self._loop_status = 'Wait for downloading' else: - self._loop_status = 'Wait for downloading' + self.wait_for_downloading = False while self.mumble.sound_output.get_buffer_size() > 0: # Empty the buffer before exit diff --git a/playlist.py b/playlist.py index 44bc39c..8986399 100644 --- a/playlist.py +++ b/playlist.py @@ -218,9 +218,8 @@ class PlayList(list): var.db.set("playlist", "current_index", self.current_index) for index, music in enumerate(self): - for music in self: - if music['type'] == 'url' and music['ready'] == 'downloading': - music['ready'] = 'no' + if music['type'] == 'url' and music['ready'] == 'downloading': + music['ready'] = 'no' var.db.set("playlist_item", str(index), json.dumps(music))