Skip to content

Commit

Permalink
add missing genre mapping and clippy lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Esgrove committed Jan 26, 2025
1 parent bdd4715 commit 4775ce7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
3 changes: 2 additions & 1 deletion src/genre.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ pub static GENRE_MAPPINGS: LazyLock<HashMap<&'static str, &'static str>> = LazyL
("POP 1", "Pop"),
("POP 80s SYNTH", "Pop 80s"),
("POP 80s", "Pop 80s"),
("POP 90s EURODANCE", "House Eurodance"),
("POP 90s", "Pop 90s"),
("POP CHILL 1", "Pop"),
("POP CHILL HITAAT", "Pop"),
Expand Down Expand Up @@ -327,7 +328,7 @@ static REGEX_SUBSTITUTES: LazyLock<[(Regex, &'static str); 5]> = LazyLock::new(|
// Replace various opening bracket types with "("
(Regex::new(r"[\[{]+").unwrap(), "("),
// Replace various closing bracket types with ")"
(Regex::new(r"[\]}]+").unwrap(), ")"),
(Regex::new(r"[]}]+").unwrap(), ")"),
// Collapse multiple consecutive opening parentheses into one
(Regex::new(r"\(\s*\){2,}").unwrap(), "("),
// Collapse multiple consecutive closing parentheses into one
Expand Down
11 changes: 4 additions & 7 deletions src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,10 @@ impl State {

fn read_state() -> DashMap<PathBuf, TrackMetadata> {
Self::get_state_path().map_or_else(DashMap::new, |file_path| match fs::read_to_string(file_path) {
Ok(contents) => match serde_json::from_str(&contents) {
Ok(map) => map,
Err(err) => {
eprintln!("Failed to parse state file: {err}");
DashMap::new()
}
},
Ok(contents) => serde_json::from_str(&contents).unwrap_or_else(|err| {
eprintln!("Failed to parse state file: {err}");
DashMap::new()
}),
Err(err) => {
eprintln!("Failed to read state file: {err}");
DashMap::new()
Expand Down
2 changes: 1 addition & 1 deletion src/track_renamer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ impl TrackRenamer {
}

/// Insert processed tracks and save state.
fn update_state(&self) -> anyhow::Result<()> {
fn update_state(&self) -> Result<()> {
let (added_count, updated_count) = self
.tracks
.par_iter()
Expand Down

0 comments on commit 4775ce7

Please sign in to comment.