made break_character optional
This commit is contained in:
parent
bdfdfa61cd
commit
f709f23b57
|
|
@ -38,9 +38,9 @@ impl Rating {
|
||||||
|
|
||||||
impl Default for Rating {
|
impl Default for Rating {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
nil: '-',
|
nil: '-',
|
||||||
half: '/',
|
half: '/',
|
||||||
full: '+'
|
full: '+'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -53,8 +53,8 @@ pub struct Config {
|
||||||
pub array_separator: char,
|
pub array_separator: char,
|
||||||
pub hide_output: bool,
|
pub hide_output: bool,
|
||||||
pub render_prefix: bool,
|
pub render_prefix: bool,
|
||||||
pub break_character: char,
|
pub break_character: Option<char>,
|
||||||
pub player_priorities: Vec<String>,
|
pub player_priorities: Vec<String>,
|
||||||
pub rating_icons: Rating,
|
pub rating_icons: Rating,
|
||||||
pub metadata_fields: Vec<Field>,
|
pub metadata_fields: Vec<Field>,
|
||||||
pub player_prefixes: HashMap<String, char>,
|
pub player_prefixes: HashMap<String, char>,
|
||||||
|
|
@ -72,18 +72,14 @@ impl Default for Config {
|
||||||
render_prefix: true,
|
render_prefix: true,
|
||||||
metadata_fields: vec![Field::constructor("xesam:title", 40), Field::constructor("xesam:artist", 20)],
|
metadata_fields: vec![Field::constructor("xesam:title", 40), Field::constructor("xesam:artist", 20)],
|
||||||
rating_icons: Rating::default(),
|
rating_icons: Rating::default(),
|
||||||
player_priorities: vec![ms("clementine"), ms("spotify"), ms("deadbeef"), ms("mpv"), ms("vlc"), ms("firefox"), ms("chromium")],
|
player_priorities: vec![ms("Clementine"), ms("Spotify"), ms("mpv"), ms("VLC Media Player"), ms("Firefox"), ms("Chromium")],
|
||||||
break_character: '-',
|
break_character: Some('-'),
|
||||||
player_prefixes: default_player_prefixes(),
|
player_prefixes: default_player_prefixes(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Config {
|
impl Config {
|
||||||
pub fn priorities_to_lower(&mut self) {
|
|
||||||
self.player_priorities = self.player_priorities.iter().map(|i| i.to_lowercase()).collect();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn find_player_priorities_idx(&self, name: &str) -> i32 {
|
pub fn find_player_priorities_idx(&self, name: &str) -> i32 {
|
||||||
match self.player_priorities.iter()
|
match self.player_priorities.iter()
|
||||||
.position(|x| x.eq(&name)) {
|
.position(|x| x.eq(&name)) {
|
||||||
|
|
@ -97,14 +93,12 @@ fn ms(str: &str) -> String {
|
||||||
str.to_string()
|
str.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
// FIXME: changed some functions to use case-sensitive matching instead, breaking this
|
|
||||||
// and also all my existing config files. Whoops
|
|
||||||
fn default_player_prefixes() -> HashMap<String, char> {
|
fn default_player_prefixes() -> HashMap<String, char> {
|
||||||
let mut out: HashMap<String, char> = HashMap::new();
|
let mut out: HashMap<String, char> = HashMap::new();
|
||||||
|
|
||||||
out.insert("clementine".to_owned(), 'c');
|
out.insert("Clementine".to_owned(), 'c');
|
||||||
out.insert("firefox".to_owned(), 'f');
|
out.insert("Firefox".to_owned(), 'f');
|
||||||
out.insert("spotify".to_owned(), 's');
|
out.insert("Spotify".to_owned(), 's');
|
||||||
out.insert("default".to_owned(), '>');
|
out.insert("default".to_owned(), '>');
|
||||||
|
|
||||||
out
|
out
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue