From: Christian Heller Date: Mon, 7 Dec 2020 03:16:52 +0000 (+0100) Subject: Add song deletion to MusicPlayer. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/do_todos?a=commitdiff_plain;h=d13e2f639316c1dba7a62d84f3c850bc937c2b1e;p=plomrogue2 Add song deletion to MusicPlayer. --- 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()