Formatting
This commit is contained in:
+2
-8
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user