Formatting

This commit is contained in:
Connor Johnstone
2026-03-18 15:36:54 -04:00
parent 4400cbc1cb
commit 5957d69e7d
7 changed files with 107 additions and 75 deletions
+2 -8
View File
@@ -30,9 +30,7 @@ pub fn build_query(track: &track::Model) -> Option<(String, String)> {
/// Parse "Artist - Title" from a filename, stripping extension and path.
pub fn parse_filename(file_path: &str) -> Option<(String, String)> {
let filename = std::path::Path::new(file_path)
.file_stem()?
.to_str()?;
let filename = std::path::Path::new(file_path).file_stem()?.to_str()?;
// Try common "Artist - Title" pattern
if let Some((artist, title)) = filename.split_once(" - ") {
@@ -55,11 +53,7 @@ pub fn parse_filename(file_path: &str) -> Option<(String, String)> {
/// Score a candidate recording against the track's known metadata.
/// Returns a confidence value from 0.0 to 1.0.
pub fn score_match(track: &track::Model, candidate: &RecordingMatch) -> f64 {
let track_title = track
.title
.as_deref()
.map(normalize)
.unwrap_or_default();
let track_title = track.title.as_deref().map(normalize).unwrap_or_default();
let candidate_title = normalize(&candidate.title);
let track_artist = track