change to make playing players have priority always

This commit is contained in:
Djairo Hougee 2025-05-01 01:09:24 +02:00
parent 809e51ae0f
commit 4f32cfd5ca
2 changed files with 4 additions and 4 deletions

View File

@ -37,7 +37,7 @@ fn handle_signal(data: &Data) {
}
}
/// This function contains the default maim loop body of the program.
/// This function contains the default main loop body of the program.
/// It updates the active player, updates the output strings based on this, and finally formats and outputs these strings to stdout.
///
/// input:

View File

@ -38,14 +38,14 @@ pub fn update_players(pf: &PlayerFinder, cfg: &Config, data: &mut Data) {
data.current_player = None;
debug!("update_players: no players found!")
} else {
let mut trees = vec![BTreeMap::new(), BTreeMap::new()];
let mut trees = vec![BTreeMap::new(), BTreeMap::new(), BTreeMap::new()];
for player in players {
if let Ok(status) = player.get_playback_status() {
let idx = cfg.find_player_priorities_idx(player.identity());
match status {
mpris::PlaybackStatus::Playing => trees[0].insert(idx, player),
mpris::PlaybackStatus::Paused => trees[0].insert(idx, player),
mpris::PlaybackStatus::Stopped => trees[1].insert(idx, player),
mpris::PlaybackStatus::Paused => trees[1].insert(idx, player),
mpris::PlaybackStatus::Stopped => trees[2].insert(idx, player),
};
}
}