change to make playing players have priority always
This commit is contained in:
parent
809e51ae0f
commit
4f32cfd5ca
|
|
@ -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.
|
/// It updates the active player, updates the output strings based on this, and finally formats and outputs these strings to stdout.
|
||||||
///
|
///
|
||||||
/// input:
|
/// input:
|
||||||
|
|
|
||||||
|
|
@ -38,14 +38,14 @@ pub fn update_players(pf: &PlayerFinder, cfg: &Config, data: &mut Data) {
|
||||||
data.current_player = None;
|
data.current_player = None;
|
||||||
debug!("update_players: no players found!")
|
debug!("update_players: no players found!")
|
||||||
} else {
|
} else {
|
||||||
let mut trees = vec![BTreeMap::new(), BTreeMap::new()];
|
let mut trees = vec![BTreeMap::new(), BTreeMap::new(), BTreeMap::new()];
|
||||||
for player in players {
|
for player in players {
|
||||||
if let Ok(status) = player.get_playback_status() {
|
if let Ok(status) = player.get_playback_status() {
|
||||||
let idx = cfg.find_player_priorities_idx(player.identity());
|
let idx = cfg.find_player_priorities_idx(player.identity());
|
||||||
match status {
|
match status {
|
||||||
mpris::PlaybackStatus::Playing => trees[0].insert(idx, player),
|
mpris::PlaybackStatus::Playing => trees[0].insert(idx, player),
|
||||||
mpris::PlaybackStatus::Paused => trees[0].insert(idx, player),
|
mpris::PlaybackStatus::Paused => trees[1].insert(idx, player),
|
||||||
mpris::PlaybackStatus::Stopped => trees[1].insert(idx, player),
|
mpris::PlaybackStatus::Stopped => trees[2].insert(idx, player),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue