Skip to content

Commit

Permalink
chore: other small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hrkfdn committed Feb 17, 2025
1 parent 48e5aea commit 0cd44e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/model/playlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl Playlist {
}

pub fn has_track(&self, track_id: &str) -> bool {
self.tracks.as_ref().map_or(false, |tracks| {
self.tracks.as_ref().is_some_and(|tracks| {
tracks
.iter()
.any(|track| track.id() == Some(track_id.to_string()))
Expand Down
6 changes: 3 additions & 3 deletions src/mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ impl MprisPlayer {
}

#[zbus(property)]
fn set_volume(&self, mut volume: f64) {
fn set_volume(&self, volume: f64) {
log::info!("set volume: {volume}");
volume = volume.clamp(0.0, 1.0);
let vol = (VOLUME_PERCENT as f64) * volume * 100.0;
let clamped = volume.clamp(0.0, 1.0);
let vol = (VOLUME_PERCENT as f64) * clamped * 100.0;
self.spotify.set_volume(vol as u16, false);
self.event.trigger();
}
Expand Down

0 comments on commit 0cd44e3

Please sign in to comment.