reimplement track deletion

This commit is contained in:
Erica Z 2024-10-20 13:45:47 +02:00
parent f09a89140d
commit 64744819de

View file

@ -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 () {