Skip to content

Commit

Permalink
mpris: simplify play_request_id matching code
Browse files Browse the repository at this point in the history
  • Loading branch information
eladyn committed Jan 5, 2025
1 parent 88e0b19 commit 59e8ef0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/dbus_mpris.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,11 +216,7 @@ impl CurrentStateInner {
let mut changed = DbusMap::new();
let mut seeked = false;

if let PlayerEvent::PlayRequestIdChanged { play_request_id } = event {
self.play_request_id = Some(play_request_id);
return (changed, seeked);
}

// note that get_play_request_id is None on PlayRequestIdChanged
if Option::zip(self.play_request_id, event.get_play_request_id())
.is_some_and(|(cur_id, event_id)| cur_id != event_id)
{
Expand Down Expand Up @@ -289,12 +285,14 @@ impl CurrentStateInner {
self.repeat.to_mpris().to_string(),
)
}
PlayerEvent::PlayRequestIdChanged { play_request_id } => {
self.play_request_id = Some(play_request_id);
}
PlayerEvent::Preloading { .. }
| PlayerEvent::Loading { .. }
| PlayerEvent::TimeToPreloadNextTrack { .. }
| PlayerEvent::EndOfTrack { .. }
| PlayerEvent::Unavailable { .. }
| PlayerEvent::PlayRequestIdChanged { .. }
| PlayerEvent::AutoPlayChanged { .. }
| PlayerEvent::FilterExplicitContentChanged { .. }
| PlayerEvent::SessionConnected { .. }
Expand Down

0 comments on commit 59e8ef0

Please sign in to comment.