Fixes conversion of files containing semicolons
All checks were successful
KnarCraft/FFmpegConvert/master This commit looks good
All checks were successful
KnarCraft/FFmpegConvert/master This commit looks good
This commit is contained in:
parent
4e1cebd95d
commit
80a62cad23
@ -113,7 +113,7 @@ public class AnimeConverter extends Converter {
|
|||||||
command.add("-map");
|
command.add("-map");
|
||||||
command.add("0:" + videoStream.getAbsoluteIndex());
|
command.add("0:" + videoStream.getAbsoluteIndex());
|
||||||
command.add("-vf");
|
command.add("-vf");
|
||||||
String safeFileName = fileName.replace("'", "\\\\\\'").replace("]", "\\]").replace("[", "\\[");
|
String safeFileName = escapeSpecialCharactersInFileName(fileName);
|
||||||
String subtitleCommand = String.format("subtitles=\"%s\"", safeFileName);
|
String subtitleCommand = String.format("subtitles=\"%s\"", safeFileName);
|
||||||
command.add(subtitleCommand);
|
command.add(subtitleCommand);
|
||||||
} else {
|
} else {
|
||||||
|
@ -424,6 +424,14 @@ public abstract class Converter {
|
|||||||
return new SubtitleStream(codecName, absoluteIndex, relativeIndex, language, title);
|
return new SubtitleStream(codecName, absoluteIndex, relativeIndex, language, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static String escapeSpecialCharactersInFileName(String fileName) {
|
||||||
|
return fileName.replace("'", "\\\\\\'")
|
||||||
|
.replace(",", "\\\\\\,")
|
||||||
|
.replace(";", "\\\\\\;")
|
||||||
|
.replace("]", "\\]")
|
||||||
|
.replace("[", "\\[");
|
||||||
|
}
|
||||||
|
|
||||||
static void print(String input) throws IOException {
|
static void print(String input) throws IOException {
|
||||||
if (!input.equals("")) {
|
if (!input.equals("")) {
|
||||||
writer.write(input);
|
writer.write(input);
|
||||||
|
Loading…
Reference in New Issue
Block a user