Fall back to just matching song title if album can't be matched

Fixes most cases where a song couldn't be found on the media server
This commit is contained in:
jude
2024-05-25 14:27:48 +01:00
parent b0f9764fcf
commit eb30bc11d9
4 changed files with 25 additions and 8 deletions

View File

@ -95,10 +95,22 @@ async fn update_playlist(
tracks.push(track.id);
}
None => {
error!(
"Couldn't find matching track for {} - {}",
recording.track_name, recording.artist_name
)
let filtered = search_results
.iter()
.find(|s| alpha_compare(&s.title, &recording.track_name))
.cloned();
match filtered {
Some(track) => {
tracks.push(track.id);
}
None => {
error!(
"Couldn't find matching track for {} - {}",
recording.track_name, recording.artist_name
)
}
}
}
}
}