Compare commits
2 commits
d550d8f9b7
...
8c4c4f8e74
Author | SHA1 | Date | |
---|---|---|---|
8c4c4f8e74 | |||
36d6734e73 |
2 changed files with 16 additions and 0 deletions
|
@ -74,6 +74,7 @@ public class Playbin : GLib.Object {
|
||||||
this._play_queue = new ListStore (typeof (Subsonic.Song));
|
this._play_queue = new ListStore (typeof (Subsonic.Song));
|
||||||
|
|
||||||
assert (this.mpv.initialize () >= 0);
|
assert (this.mpv.initialize () >= 0);
|
||||||
|
assert (this.mpv.set_property_string ("audio-client-name", "audrey") >= 0);
|
||||||
assert (this.mpv.set_property_string ("user-agent", Audrey.Const.user_agent) >= 0);
|
assert (this.mpv.set_property_string ("user-agent", Audrey.Const.user_agent) >= 0);
|
||||||
assert (this.mpv.set_property_string ("video", "no") >= 0);
|
assert (this.mpv.set_property_string ("video", "no") >= 0);
|
||||||
assert (this.mpv.set_property_string ("prefetch-playlist", "yes") >= 0);
|
assert (this.mpv.set_property_string ("prefetch-playlist", "yes") >= 0);
|
||||||
|
@ -362,6 +363,15 @@ public class Playbin : GLib.Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop () {
|
||||||
|
debug ("stopping playback");
|
||||||
|
// don't clear the playlist, just in case (less state changes to sync)
|
||||||
|
assert(this.mpv.command({"stop", "keep-playlist"}) >= 0);
|
||||||
|
this.state = PlaybinState.STOPPED;
|
||||||
|
this.play_queue_position = this._play_queue.get_n_items ();
|
||||||
|
this.stopped ();
|
||||||
|
}
|
||||||
|
|
||||||
~Playbin () {
|
~Playbin () {
|
||||||
debug ("destroying playbin");
|
debug ("destroying playbin");
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,6 +116,12 @@ class Ui.Window : Adw.ApplicationWindow {
|
||||||
return stack_child != "play-queue";
|
return stack_child != "play-queue";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override bool close_request () {
|
||||||
|
// stop playback on close
|
||||||
|
this.playbin.stop ();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
~Window () {
|
~Window () {
|
||||||
debug ("destroying main window");
|
debug ("destroying main window");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue