Skip to content

Commit bc97f48

Browse files
committed
Allow path separator in name templates
1 parent d5d68c6 commit bc97f48

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/download.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ impl Loader {
116116
println!("Skipping {}", output_path.to_string_lossy());
117117
return Ok(());
118118
}
119+
if let Some(parent) = output_path.parent() {
120+
create_dir_all(parent).await?;
121+
}
119122
println!("Downloading {}", output_path.to_string_lossy());
120123

121124
let backend = audio_backend::find(Some("pipe".to_owned()))

‎src/metadata.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ pub async fn get_file_name(
9494
.unwrap_or("".to_owned()),
9595
)
9696
.replace("%A", &get_artists_line(&artists))
97-
.replace("%t", &audio_item.name)
97+
.replace("%t", &legalize_name(&audio_item.name))
9898
.replace("%n", &format!("{:02}", track_number.unwrap_or(0)));
9999

100100
match extension {
@@ -107,7 +107,7 @@ pub async fn get_file_name(
107107

108108
let title = template
109109
.replace("%a", &show_name)
110-
.replace("%t", &audio_item.name)
110+
.replace("%t", &legalize_name(&audio_item.name))
111111
.replace("%n", &format!("{:02}", track_number.unwrap_or(0)));
112112

113113
match extension {
@@ -118,9 +118,9 @@ pub async fn get_file_name(
118118
};
119119

120120
if let Some(regex) = REGEX_FILTER.get() {
121-
legalize_name(&regex.replace_all(&name, "").into_owned())
121+
regex.replace_all(&name, "").into_owned()
122122
} else {
123-
legalize_name(&name)
123+
name
124124
}
125125
}
126126

0 commit comments

Comments
 (0)