has better chance to find to correct song again

This commit is contained in:
vandechat96
2022-12-23 17:04:22 +01:00
parent 90fbb7dbd6
commit ac57da4880

View File

@@ -12,7 +12,7 @@ use regex::Regex;
use thiserror::Error;
lazy_static! {
static ref RE: Regex = Regex::new(r"[-()\[\];']").unwrap();
static ref RE: Regex = Regex::new(r"[()\[\];']").unwrap();
}
const SALT_SIZE: usize = 36;
@@ -222,7 +222,7 @@ impl Client {
let artist = &track.artist;
let album = &track.album;
let mut title = format!("{name} {artist} {album}");
title = RE.replace_all(&title,"").to_string();
// title = RE.replace_all(&title,"").to_string();
let mut found = self.search_track(title).await?;
@@ -236,12 +236,9 @@ impl Client {
}
}
found = found
.into_iter()
.filter(|x| {
found.retain(|x| {
x.title == *name && x.album == *album && x.get_artists().contains(&artist.as_str())
})
.collect();
});
debug!("Found {:?}", found);