mirror of
https://github.com/talwat/lowfi
synced 2025-03-12 16:12:22 +00:00
fix(mpris): fix initial playback status when there's a new track
This commit is contained in:
parent
0096eda4db
commit
083d6c473c
@ -249,11 +249,14 @@ impl Player {
|
|||||||
|
|
||||||
/// Shorthand to emit a `PropertiesChanged` signal, like when pausing/unpausing.
|
/// Shorthand to emit a `PropertiesChanged` signal, like when pausing/unpausing.
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
async fn mpris_changed(&self, property: mpris_server::Property) -> eyre::Result<()> {
|
async fn mpris_changed(
|
||||||
|
&self,
|
||||||
|
properties: impl IntoIterator<Item = mpris_server::Property>,
|
||||||
|
) -> eyre::Result<()> {
|
||||||
self.mpris
|
self.mpris
|
||||||
.get()
|
.get()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.properties_changed(vec![property])
|
.properties_changed(properties)
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -374,9 +377,9 @@ impl Player {
|
|||||||
|
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
player
|
player
|
||||||
.mpris_changed(mpris_server::Property::PlaybackStatus(
|
.mpris_changed(vec![mpris_server::Property::PlaybackStatus(
|
||||||
mpris_server::PlaybackStatus::Playing,
|
mpris_server::PlaybackStatus::Playing,
|
||||||
))
|
)])
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
Messages::Pause => {
|
Messages::Pause => {
|
||||||
@ -384,9 +387,9 @@ impl Player {
|
|||||||
|
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
player
|
player
|
||||||
.mpris_changed(mpris_server::Property::PlaybackStatus(
|
.mpris_changed(vec![mpris_server::Property::PlaybackStatus(
|
||||||
mpris_server::PlaybackStatus::Paused,
|
mpris_server::PlaybackStatus::Paused,
|
||||||
))
|
)])
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
Messages::PlayPause => {
|
Messages::PlayPause => {
|
||||||
@ -398,9 +401,9 @@ impl Player {
|
|||||||
|
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
player
|
player
|
||||||
.mpris_changed(mpris_server::Property::PlaybackStatus(
|
.mpris_changed(vec![mpris_server::Property::PlaybackStatus(
|
||||||
player.mpris_innner().playback_status().await?,
|
player.mpris_innner().playback_status().await?,
|
||||||
))
|
)])
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
Messages::ChangeVolume(change) => {
|
Messages::ChangeVolume(change) => {
|
||||||
@ -408,7 +411,9 @@ impl Player {
|
|||||||
|
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
player
|
player
|
||||||
.mpris_changed(mpris_server::Property::Volume(player.sink.volume().into()))
|
.mpris_changed(vec![mpris_server::Property::Volume(
|
||||||
|
player.sink.volume().into(),
|
||||||
|
)])
|
||||||
.await?;
|
.await?;
|
||||||
}
|
}
|
||||||
// This basically just continues, but more importantly, it'll re-evaluate
|
// This basically just continues, but more importantly, it'll re-evaluate
|
||||||
@ -421,9 +426,14 @@ impl Player {
|
|||||||
|
|
||||||
#[cfg(feature = "mpris")]
|
#[cfg(feature = "mpris")]
|
||||||
player
|
player
|
||||||
.mpris_changed(mpris_server::Property::Metadata(
|
.mpris_changed(vec![
|
||||||
player.mpris_innner().metadata().await?,
|
mpris_server::Property::Metadata(
|
||||||
))
|
player.mpris_innner().metadata().await?,
|
||||||
|
),
|
||||||
|
mpris_server::Property::PlaybackStatus(
|
||||||
|
mpris_server::PlaybackStatus::Playing,
|
||||||
|
),
|
||||||
|
])
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user