Skip to content

Commit

Permalink
MPRIS: implemented most clippy suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
haruInDisguise committed Sep 11, 2024
1 parent 87cd0a2 commit b3fb787
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::{authentication, ui, utils};
use crate::{command, queue, spotify};

#[cfg(feature = "mpris")]
use crate::mpris::{self, MprisCommand, MprisManager};
use crate::mpris::{self, MprisManager};

#[cfg(unix)]
use crate::ipc::{self, IpcSocket};
Expand Down
12 changes: 6 additions & 6 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,10 +466,10 @@ impl MprisPlayer {
#[derive(Debug)]
pub enum MprisCommand {
/// Notify about playback status and metadata updates.
NotifyPlaybackUpdate,
PlaybackUpdate,
/// Notify about volume updates.
NotifyVolumeUpdate,
NotifyMetadataUpdate,
VolumeUpdate,
MetadataUpdate,
}

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

use crate::config::{Config, PlaybackState};
use crate::config::{Config};
use crate::library::Library;
use crate::model::playable::Playable;
use crate::mpris::MprisCommand;
use crate::spotify::PlayerEvent;
use crate::spotify::Spotify;

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::NotifyMetadataUpdate);
self.send_mpris(MprisCommand::MetadataUpdate);
}

/// 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::NotifyPlaybackUpdate);
self.send_mpris(MprisCommand::PlaybackUpdate);
}

/// 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::NotifyVolumeUpdate)
self.send_mpris(MprisCommand::VolumeUpdate)
}
}

Expand Down

0 comments on commit b3fb787

Please sign in to comment.