better event tracking
This commit is contained in:
parent
0f1bbec5de
commit
df3484f147
1 changed files with 11 additions and 7 deletions
|
@ -115,10 +115,15 @@ class Playbin : GLib.Object {
|
||||||
case 2:
|
case 2:
|
||||||
assert (data.name == "playlist-pos");
|
assert (data.name == "playlist-pos");
|
||||||
if (data.format == Mpv.Format.NONE) {
|
if (data.format == Mpv.Format.NONE) {
|
||||||
this.play_queue_position = 0;
|
this.play_queue_position = this.play_queue.get_n_items ();
|
||||||
} else {
|
} else {
|
||||||
this.play_queue_position = (uint) data.parse_int64 ();
|
if (data.parse_int64 () < 0) {
|
||||||
|
this.play_queue_position = this.play_queue.get_n_items ();
|
||||||
|
} else {
|
||||||
|
this.play_queue_position = (uint) data.parse_int64 ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
debug (@"playlist-pos has been updated to $(this.play_queue_position)");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -127,17 +132,16 @@ class Playbin : GLib.Object {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Mpv.EventId.FILE_LOADED:
|
case Mpv.EventId.START_FILE:
|
||||||
if (this.notify_next_playing) {
|
debug ("START_FILE received");
|
||||||
|
if (this.play_queue_position < this.play_queue.get_n_items ()) {
|
||||||
this.song = (Subsonic.Song) this.play_queue.get_item (this.play_queue_position);
|
this.song = (Subsonic.Song) this.play_queue.get_item (this.play_queue_position);
|
||||||
this.now_playing ();
|
this.now_playing ();
|
||||||
} else {
|
|
||||||
assert (this.song == (Subsonic.Song) this.play_queue.get_item (this.play_queue_position));
|
|
||||||
this.notify_next_playing = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Mpv.EventId.END_FILE:
|
case Mpv.EventId.END_FILE:
|
||||||
|
debug ("END_FILE received");
|
||||||
var data = event.parse_end_file ();
|
var data = event.parse_end_file ();
|
||||||
if (data.error < 0) {
|
if (data.error < 0) {
|
||||||
warning ("playback of track aborted: %s", data.error.to_string ());
|
warning ("playback of track aborted: %s", data.error.to_string ());
|
||||||
|
|
Loading…
Reference in a new issue