Skip to content

Commit

Permalink
Fix: applied clippy suggestions + format
Browse files Browse the repository at this point in the history
  • Loading branch information
haruInDisguise committed Sep 16, 2024
1 parent 2cc6adc commit 75c2aa8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
17 changes: 9 additions & 8 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,12 @@ impl MprisPlayer {
/// Commands to control the [MprisManager] worker thread.
#[derive(Debug)]
pub enum MprisCommand {
/// Notify about playback status and metadata updates.
PlaybackUpdate,
/// Notify about volume updates.
VolumeUpdate,
MetadataUpdate,
/// Emit playback status
Playback,
/// Emit volume
Volume,
/// Emit metadata
Metadata,
}

/// An MPRIS server that internally manager a thread which can be sent commands. This is internally
Expand Down Expand Up @@ -527,14 +528,14 @@ impl MprisManager {
loop {
let ctx = player_iface_ref.signal_context();
match rx.next().await {
Some(MprisCommand::PlaybackUpdate) => {
Some(MprisCommand::Playback) => {
player_iface.playback_status_changed(ctx).await?;
}
Some(MprisCommand::VolumeUpdate) => {
Some(MprisCommand::Volume) => {
info!("sending MPRIS volume update signal");
player_iface.volume_changed(ctx).await?;
}
Some(MprisCommand::MetadataUpdate) => {
Some(MprisCommand::Metadata) => {
player_iface.metadata_changed(ctx).await?;
}
None => break,
Expand Down
2 changes: 1 addition & 1 deletion src/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use notify_rust::Notification;
use rand::prelude::*;
use strum_macros::Display;

use crate::config::{Config};
use crate::config::Config;
use crate::library::Library;
use crate::model::playable::Playable;
use crate::spotify::PlayerEvent;
Expand Down
10 changes: 5 additions & 5 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::MetadataUpdate);
self.send_mpris(MprisCommand::Metadata);
}

/// Update the cached status of the [Player]. This makes sure the status
Expand All @@ -342,8 +342,8 @@ impl Spotify {
let mut status = self.status.write().unwrap();
*status = new_status;

#[cfg(feature ="mpris")]
self.send_mpris(MprisCommand::PlaybackUpdate);
#[cfg(feature = "mpris")]
self.send_mpris(MprisCommand::Playback);
}

/// Reset the time tracking stats for the current song. This should be called when a new song is
Expand All @@ -369,7 +369,7 @@ impl Spotify {
}

/// Send an [MprisCommand] to the mpris thread.
#[cfg(feature ="mpris")]
#[cfg(feature = "mpris")]
fn send_mpris(&self, cmd: MprisCommand) {
debug!("Sending mpris command: {:?}", cmd);
if let Some(mpris_manager) = self.mpris.lock().unwrap().as_ref() {
Expand Down Expand Up @@ -435,7 +435,7 @@ impl Spotify {
// MPRIS implementation.
if notify {
#[cfg(feature = "mpris")]
self.send_mpris(MprisCommand::VolumeUpdate)
self.send_mpris(MprisCommand::Volume)
}
}

Expand Down

0 comments on commit 75c2aa8

Please sign in to comment.