* improved clean-up of path separators in series name and episode title
This commit is contained in:
parent
911cc24ba5
commit
d9027b06ad
|
@ -64,7 +64,7 @@ class EpisodeExpressionFormatter implements MatchFormatter {
|
|||
|
||||
// if the binding value is a String, remove illegal characters
|
||||
if (value instanceof CharSequence) {
|
||||
return removePathSeparators(value.toString()).trim();
|
||||
return replacePathSeparators(value.toString()).trim();
|
||||
}
|
||||
|
||||
// if the binding value is an Object, just leave it
|
||||
|
|
|
@ -35,6 +35,6 @@ class MovieFormatter implements MatchFormatter {
|
|||
name.format(" CD%d", video.getPartIndex() + 1);
|
||||
|
||||
// remove path separators if the name contains any / or \
|
||||
return removePathSeparators(name.out().toString());
|
||||
return replacePathSeparators(name.out().toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class RenameModel extends MatchModel<Object, File> {
|
|||
@Override
|
||||
public String format(Match<?, ?> match) {
|
||||
// clean up path separators like / or \
|
||||
return removePathSeparators(String.valueOf(match.getValue()).trim());
|
||||
return replacePathSeparators(String.valueOf(match.getValue()).trim());
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -183,7 +183,6 @@ public final class FileUtilities {
|
|||
* Invalid file name characters: \, /, :, *, ?, ", <, >, |, \r and \n
|
||||
*/
|
||||
public static final Pattern ILLEGAL_CHARACTERS = Pattern.compile("[\\\\/:*?\"<>|\\r\\n]");
|
||||
public static final Pattern PATH_SEPARATORS = Pattern.compile("[\\\\/]");
|
||||
|
||||
|
||||
/**
|
||||
|
@ -240,8 +239,8 @@ public final class FileUtilities {
|
|||
}
|
||||
|
||||
|
||||
public static String removePathSeparators(CharSequence path) {
|
||||
return PATH_SEPARATORS.matcher(path).replaceAll("");
|
||||
public static String replacePathSeparators(CharSequence path) {
|
||||
return Pattern.compile("\\s*[\\\\/]+\\s*").matcher(path).replaceAll(" ");
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue