diff --git a/src/playbin.vala b/src/playbin.vala index 54a2310..95f2790 100644 --- a/src/playbin.vala +++ b/src/playbin.vala @@ -148,6 +148,11 @@ public class Playbin : GLib.Object { } else { this.inc_position = true; } + + // estimate duration from api data + // while mpv doesn't know it + this.duration = ((Subsonic.Song) this._play_queue.get_item (this.play_queue_position)).duration; + this.new_track (); break; @@ -158,10 +163,9 @@ public class Playbin : GLib.Object { warning ("playback of track aborted: %s", data.error.to_string ()); } - if (this.inc_position) { - // reached the end + if (this.inc_position && this.play_queue_position+1 == this._play_queue.get_n_items ()) { + // reached the end (?) this.play_queue_position += 1; - assert (this.play_queue_position == this._play_queue.get_n_items ()); this.state = PlaybinState.STOPPED; this.stopped (); }