Skip to content

Commit

Permalink
Correct filename template
Browse files Browse the repository at this point in the history
  • Loading branch information
Marekkon5 committed Feb 22, 2024
1 parent e005db3 commit de0710a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions crates/onetagger-autotag/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ impl AudioFileInfoImpl for AudioFileInfo {
if (title.is_none() || artists.is_none()) && filename_template.is_some() {
let filename = path.as_ref().file_name().ok_or(anyhow!("Missing filename!"))?.to_str().ok_or(anyhow!("Missing filename"))?;

if let Some(captures) = filename_template.unwrap().captures(filename) {
if let Some(captures) = filename_template.unwrap().captures(filename) {
// Title
if title.is_none() {
if let Some(m) = captures.name("title") {
Expand Down Expand Up @@ -492,7 +492,7 @@ impl AudioFileInfoImpl for AudioFileInfo {
// Extension
template = format!("{}\\.[a-zA-Z0-9]{{2,4}}$", template);
// Final regex
Regex::new(&template).ok()
Regex::new(template.trim()).ok()
}

// Recognize on Shazam
Expand Down

0 comments on commit de0710a

Please sign in to comment.