From d13e2f639316c1dba7a62d84f3c850bc937c2b1e Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Mon, 7 Dec 2020 04:16:52 +0100 Subject: [PATCH] Add song deletion to MusicPlayer. --- plomrogue/things.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/plomrogue/things.py b/plomrogue/things.py index c49b204..3182054 100644 --- a/plomrogue/things.py +++ b/plomrogue/things.py @@ -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() -- 2.30.2