Compare commits
No commits in common. "2f99ae9edfeb287ace77ee9c772fe746f0d663e3" and "0f1bbec5dea61f0cc95957081158c3a36946aa51" have entirely different histories.
2f99ae9edf
...
0f1bbec5de
2 changed files with 7 additions and 16 deletions
|
@ -40,7 +40,6 @@ class Playbin : GLib.Object {
|
||||||
|
|
||||||
private bool notify_next_playing;
|
private bool notify_next_playing;
|
||||||
public signal void now_playing ();
|
public signal void now_playing ();
|
||||||
public signal void stopped ();
|
|
||||||
|
|
||||||
public double position { get; private set; default = 0.0; }
|
public double position { get; private set; default = 0.0; }
|
||||||
public double duration { get; private set; default = 0.0; }
|
public double duration { get; private set; default = 0.0; }
|
||||||
|
@ -115,15 +114,10 @@ class Playbin : GLib.Object {
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
assert (data.name == "playlist-pos");
|
assert (data.name == "playlist-pos");
|
||||||
if (data.parse_int64 () < 0) {
|
if (data.format == Mpv.Format.NONE) {
|
||||||
debug ("playlist-pos is null, sending stopped event");
|
this.play_queue_position = 0;
|
||||||
this.play_queue_position = this.play_queue.get_n_items ();
|
|
||||||
this.song = null;
|
|
||||||
this.state = PlaybinState.STOPPED;
|
|
||||||
this.stopped ();
|
|
||||||
} else {
|
} else {
|
||||||
this.play_queue_position = (uint) data.parse_int64 ();
|
this.play_queue_position = (uint) data.parse_int64 ();
|
||||||
debug (@"playlist-pos has been updated to $(this.play_queue_position)");
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -133,16 +127,17 @@ class Playbin : GLib.Object {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Mpv.EventId.START_FILE:
|
case Mpv.EventId.FILE_LOADED:
|
||||||
debug ("START_FILE received");
|
if (this.notify_next_playing) {
|
||||||
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 ());
|
||||||
|
|
|
@ -82,10 +82,6 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.playbin.stopped.connect (() => {
|
|
||||||
this.playing_cover_art = Gdk.Paintable.empty (1, 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.play_queue.selection.user_selected.connect ((position) => {
|
this.play_queue.selection.user_selected.connect ((position) => {
|
||||||
this.playbin.select_track (position);
|
this.playbin.select_track (position);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue