From 32372905f38d70a43c4242d84e5d993d7edbd216 Mon Sep 17 00:00:00 2001 From: haruInDisguise Date: Thu, 19 Sep 2024 23:08:02 +0200 Subject: [PATCH] MPRIS: Renamed MprisCommands to be more resonable I've added a clippy exception so it does not complain to us about enum variants starting with the same prefix. --- src/mpris.rs | 13 +++++++------ src/spotify.rs | 6 +++--- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/mpris.rs b/src/mpris.rs index 44cbaf5c8..29fde7d6f 100644 --- a/src/mpris.rs +++ b/src/mpris.rs @@ -464,13 +464,14 @@ impl MprisPlayer { /// Commands to control the [MprisManager] worker thread. #[derive(Debug)] +#[allow(clippy::enum_variant_names)] pub enum MprisCommand { /// Emit playback status - Playback, + EmitPlaybackStatus, /// Emit volume - Volume, + EmitVolumeStatus, /// Emit metadata - Metadata, + EmitMetadataStatus, } /// An MPRIS server that internally manager a thread which can be sent commands. This is internally @@ -528,14 +529,14 @@ impl MprisManager { loop { let ctx = player_iface_ref.signal_context(); match rx.next().await { - Some(MprisCommand::Playback) => { + Some(MprisCommand::EmitPlaybackStatus) => { player_iface.playback_status_changed(ctx).await?; } - Some(MprisCommand::Volume) => { + Some(MprisCommand::EmitVolumeStatus) => { info!("sending MPRIS volume update signal"); player_iface.volume_changed(ctx).await?; } - Some(MprisCommand::Metadata) => { + Some(MprisCommand::EmitMetadataStatus) => { player_iface.metadata_changed(ctx).await?; } None => break, diff --git a/src/spotify.rs b/src/spotify.rs index aeaf1770f..41273b16c 100644 --- a/src/spotify.rs +++ b/src/spotify.rs @@ -317,7 +317,7 @@ impl Spotify { )); #[cfg(feature = "mpris")] - self.send_mpris(MprisCommand::Metadata); + self.send_mpris(MprisCommand::EmitMetadataStatus); } /// Update the cached status of the [Player]. This makes sure the status @@ -343,7 +343,7 @@ impl Spotify { *status = new_status; #[cfg(feature = "mpris")] - self.send_mpris(MprisCommand::Playback); + self.send_mpris(MprisCommand::EmitPlaybackStatus); } /// Reset the time tracking stats for the current song. This should be called when a new song is @@ -435,7 +435,7 @@ impl Spotify { // MPRIS implementation. if notify { #[cfg(feature = "mpris")] - self.send_mpris(MprisCommand::Volume) + self.send_mpris(MprisCommand::EmitVolumeStatus) } }