Compare commits
No commits in common. "8ccf9cfccb0752d3a544114cebf913418eb79bad" and "d5d7ff882ea5d42439b6248bd3e338c44cc52fe3" have entirely different histories.
8ccf9cfccb
...
d5d7ff882e
2 changed files with 5 additions and 47 deletions
|
@ -6,7 +6,7 @@ use tracing::{event, Level};
|
|||
use zbus::object_server::{InterfaceRef, SignalEmitter};
|
||||
use zbus::zvariant::{ObjectPath, OwnedObjectPath, OwnedValue, Value};
|
||||
|
||||
pub const MICROSECONDS: f64 = 1e6; // in a second
|
||||
const MICROSECONDS: f64 = 1e6; // in a second
|
||||
|
||||
#[derive(Default)]
|
||||
pub struct MetadataMap {
|
||||
|
@ -222,18 +222,6 @@ impl Player {
|
|||
*/
|
||||
}
|
||||
|
||||
pub async fn on_playlist_count_changed(
|
||||
&self,
|
||||
emitter: &SignalEmitter<'_>,
|
||||
) -> Result<(), zbus::fdo::Error> {
|
||||
futures::try_join!(
|
||||
self.can_go_next_changed(emitter),
|
||||
self.can_go_previous_changed(emitter),
|
||||
self.can_play_changed(emitter),
|
||||
)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn window(&self) -> Window {
|
||||
self.window.upgrade().unwrap()
|
||||
}
|
||||
|
@ -299,7 +287,7 @@ impl Player {
|
|||
}
|
||||
|
||||
#[zbus(signal)]
|
||||
pub async fn seeked(emitter: &SignalEmitter<'_>, position: i64) -> zbus::Result<()>;
|
||||
async fn seeked(emitter: &SignalEmitter<'_>, position: i64) -> zbus::Result<()>;
|
||||
|
||||
#[zbus(property)]
|
||||
fn playback_status(&self) -> String {
|
||||
|
@ -382,17 +370,17 @@ impl Player {
|
|||
|
||||
#[zbus(property)]
|
||||
fn can_go_next(&self) -> bool {
|
||||
self.window().playlist_count() > 0
|
||||
true // TODO
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn can_go_previous(&self) -> bool {
|
||||
self.window().playlist_count() > 0
|
||||
true // TODO
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
fn can_play(&self) -> bool {
|
||||
self.window().playlist_count() > 0
|
||||
true // TODO
|
||||
}
|
||||
|
||||
#[zbus(property)]
|
||||
|
|
|
@ -597,18 +597,6 @@ mod imp {
|
|||
6 => {
|
||||
assert_eq!(event.name, "playlist-count");
|
||||
self.obj().notify("playlist-count");
|
||||
|
||||
// mpris can-go-next depends on this
|
||||
if let Some(iface_ref) = self.mpris_player() {
|
||||
glib::spawn_future_local(async move {
|
||||
iface_ref
|
||||
.get()
|
||||
.await
|
||||
.on_playlist_count_changed(iface_ref.signal_emitter())
|
||||
.await
|
||||
.unwrap();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
7 => {
|
||||
|
@ -819,24 +807,6 @@ mod imp {
|
|||
|
||||
self.obj().notify("time-pos");
|
||||
self.buffering_start();
|
||||
|
||||
let time_pos = self.obj().time_pos();
|
||||
if let Some(iface_ref) = self.mpris_player() {
|
||||
glib::spawn_future_local(async move {
|
||||
match mpris::Player::seeked(
|
||||
iface_ref.signal_emitter(),
|
||||
(time_pos * mpris::player::MICROSECONDS) as i64,
|
||||
)
|
||||
.await
|
||||
{
|
||||
Ok(()) => {}
|
||||
Err(err) => event!(
|
||||
Level::ERROR,
|
||||
"could not notify seek through mpris interface: {err}"
|
||||
),
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
fn on_playback_restart(&self) {
|
||||
|
|
Loading…
Reference in a new issue