home · contact · privacy
Add song deletion to MusicPlayer.
authorChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 03:16:52 +0000 (04:16 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Mon, 7 Dec 2020 03:16:52 +0000 (04:16 +0100)
plomrogue/things.py

index c49b204f1c2e320036ab5cd19b4d2b330fec980c..31820541a7ad46a51a76b8a07bf2f412d3b39267 100644 (file)
@@ -225,6 +225,14 @@ class Thing_MusicPlayer(Thing):
                 return ['playing']
             else:
                 return ['paused']
+        elif command == 'REMOVE':
+            if len(self.playlist) == 0:
+                return ['playlist already empty']
+            del self.playlist[max(0, self.playlist_index)]
+            self.playlist_index -= 1
+            if self.playlist_index < -1:
+                self.playlist_index = -1
+            return ['removed song']
         elif command == 'REWIND':
             self.playlist_index = -1
             self.next_song_start = datetime.datetime.now()