From 64744819de905b434ae7d5a80eaa8396b06da7e3 Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sun, 20 Oct 2024 13:45:47 +0200 Subject: [PATCH] reimplement track deletion --- src/playbin.vala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/playbin.vala b/src/playbin.vala index 4a836f7..81c956c 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -245,7 +245,14 @@ public class Playbin : GLib.Object { public void remove_track (uint position) requires (position < this._play_queue.get_n_items ()) { - assert (false); // TODO + assert (this.mpv.command({"playlist-remove", position.to_string ()}) >= 0); + this._play_queue.remove (position); + if (this.play_queue_position > position) this.play_queue_position -= 1; + if (this.play_queue_position == this._play_queue.get_n_items ()) { + // we just killed the last track + this.state = PlaybinState.STOPPED; + this.stopped (); + } } public void clear () {