]> git.0d.be Git - botaradio.git/commitdiff
fix: save playlist problem
authorTerry Geng <gengyanda@gmail.com>
Tue, 3 Mar 2020 15:53:49 +0000 (23:53 +0800)
committerTerry Geng <gengyanda@gmail.com>
Tue, 3 Mar 2020 15:53:49 +0000 (23:53 +0800)
mumbleBot.py
playlist.py

index 4d1da1c8207fce026d09ec2d447b0e6a5add4b6f..54cdd1954d439be1752c033e06735ec9173c31a1 100644 (file)
@@ -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
index 44bc39cc9b5c536f6a2d0dc2b76ad1f1c373a29d..89863991162a78bae457f056ca13634b2f26271c 100644 (file)
@@ -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))