Directories named after albums are sanitized first
This commit is contained in:
parent
4207a4f186
commit
1efac50834
@ -264,7 +264,9 @@ public abstract class AbstractRipper
|
|||||||
if (!path.endsWith(File.separator)) {
|
if (!path.endsWith(File.separator)) {
|
||||||
path += File.separator;
|
path += File.separator;
|
||||||
}
|
}
|
||||||
path += getAlbumTitle(this.url) + File.separator;
|
String title = getAlbumTitle(this.url);
|
||||||
|
title = Utils.filesystemSafe(title);
|
||||||
|
path += title + File.separator;
|
||||||
this.workingDir = new File(path);
|
this.workingDir = new File(path);
|
||||||
if (!this.workingDir.exists()) {
|
if (!this.workingDir.exists()) {
|
||||||
logger.info("[+] Creating directory: " + Utils.removeCWD(this.workingDir));
|
logger.info("[+] Creating directory: " + Utils.removeCWD(this.workingDir));
|
||||||
|
@ -241,4 +241,10 @@ public class Utils {
|
|||||||
+ "..."
|
+ "..."
|
||||||
+ path.substring(path.length() - SHORTENED_PATH_LENGTH);
|
+ path.substring(path.length() - SHORTENED_PATH_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String filesystemSafe(String text) {
|
||||||
|
return text.replaceAll("[^a-zA-Z0-9.-]", "_")
|
||||||
|
.replaceAll("__", "_")
|
||||||
|
.replaceAll("_+$", "");
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user