some mpris work
This commit is contained in:
parent
1757e64961
commit
932471218a
1 changed files with 21 additions and 10 deletions
|
@ -242,35 +242,46 @@ impl Player {
|
||||||
#[zbus::interface(name = "org.mpris.MediaPlayer2.Player")]
|
#[zbus::interface(name = "org.mpris.MediaPlayer2.Player")]
|
||||||
impl Player {
|
impl Player {
|
||||||
fn next(&self) -> zbus::fdo::Result<()> {
|
fn next(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().playlist_next();
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn previous(&self) -> zbus::fdo::Result<()> {
|
fn previous(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().playlist_prev();
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pause(&self) -> zbus::fdo::Result<()> {
|
fn pause(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().set_pause(true);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn play_pause(&self) -> zbus::fdo::Result<()> {
|
fn play_pause(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().set_pause(!self.window().pause());
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stop(&self) -> zbus::fdo::Result<()> {
|
fn stop(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().set_pause(true);
|
||||||
|
self.window().set_time_pos(0.0);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn play(&self) -> zbus::fdo::Result<()> {
|
fn play(&self) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().set_pause(false);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn seek(&self, _offset: i64) -> zbus::fdo::Result<()> {
|
fn seek(&self, offset: i64) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
self.window().seek(offset as f64 / MICROSECONDS);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn set_position(&self, _track_id: ObjectPath<'_>, _position: i64) -> zbus::fdo::Result<()> {
|
fn set_position(&self, track_id: ObjectPath<'_>, position: i64) -> zbus::fdo::Result<()> {
|
||||||
Err(zbus::fdo::Error::NotSupported("not implemented".into()))
|
if Some(track_id) == self.metadata.track_id.as_ref().map(|x| x.as_ref()) {
|
||||||
|
self.window().set_time_pos(position as f64 / MICROSECONDS);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn open_uri(&self, _s: String) -> zbus::fdo::Result<()> {
|
fn open_uri(&self, _s: String) -> zbus::fdo::Result<()> {
|
||||||
|
|
Loading…
Reference in a new issue