Skip to content

Commit

Permalink
MPRIS: Renamed MprisCommands to be more resonable
Browse files Browse the repository at this point in the history
I've added a clippy exception so it does not complain to us about enum
variants starting with the same prefix.
  • Loading branch information
haruInDisguise committed Sep 19, 2024
1 parent 29474eb commit 3237290
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
13 changes: 7 additions & 6 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/spotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -435,7 +435,7 @@ impl Spotify {
// MPRIS implementation.
if notify {
#[cfg(feature = "mpris")]
self.send_mpris(MprisCommand::Volume)
self.send_mpris(MprisCommand::EmitVolumeStatus)
}
}

Expand Down

0 comments on commit 3237290

Please sign in to comment.