diff --git a/META-INF/MANIFEST.MF b/META-INF/MANIFEST.MF index 079a349..f062140 100644 --- a/META-INF/MANIFEST.MF +++ b/META-INF/MANIFEST.MF @@ -1,3 +1,3 @@ Manifest-Version: 1.0 -Main-Class: ffmpegconverter.Main +Main-Class: net.knarcraft.ffmpegconverter.Main diff --git a/pom.xml b/pom.xml index 4e8afd7..7c2391b 100644 --- a/pom.xml +++ b/pom.xml @@ -57,7 +57,7 @@ https://git.knarcraft.net default - https://git.knarcraft.net/KnarCraft/FFmpegConvert + https://jenkins.knarcraft.net/job/KnarCraft/job/FFmpegConvert/job/master/lastSuccessfulBuild/artifact/ @@ -71,7 +71,7 @@ true lib/ - ffmpegconverter.Main + net.knarcraft.ffmpegconverter.Main diff --git a/src/main/java/ffmpegconverter/Main.java b/src/main/java/net/knarcraft/ffmpegconverter/Main.java similarity index 96% rename from src/main/java/ffmpegconverter/Main.java rename to src/main/java/net/knarcraft/ffmpegconverter/Main.java index affbf96..eee4c49 100644 --- a/src/main/java/ffmpegconverter/Main.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/Main.java @@ -1,17 +1,16 @@ -package ffmpegconverter; +package net.knarcraft.ffmpegconverter; -import ffmpegconverter.converter.AnimeConverter; -import ffmpegconverter.converter.AudioConverter; -import ffmpegconverter.converter.Converter; -import ffmpegconverter.converter.VideoConverter; +import net.knarcraft.ffmpegconverter.converter.AnimeConverter; +import net.knarcraft.ffmpegconverter.converter.AudioConverter; +import net.knarcraft.ffmpegconverter.converter.Converter; +import net.knarcraft.ffmpegconverter.converter.VideoConverter; import java.io.*; -import java.util.ArrayList; import java.util.List; import java.util.Scanner; import java.util.function.Predicate; -import static ffmpegconverter.Parser.tokenize; +import static net.knarcraft.ffmpegconverter.Parser.tokenize; /** * Converts a files or files in a folder to a web playable mp4. diff --git a/src/main/java/ffmpegconverter/Parser.java b/src/main/java/net/knarcraft/ffmpegconverter/Parser.java similarity index 96% rename from src/main/java/ffmpegconverter/Parser.java rename to src/main/java/net/knarcraft/ffmpegconverter/Parser.java index 5ac7f09..2e6f5bc 100644 --- a/src/main/java/ffmpegconverter/Parser.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/Parser.java @@ -1,10 +1,8 @@ -package ffmpegconverter; +package net.knarcraft.ffmpegconverter; import java.util.ArrayList; import java.util.List; -import static ffmpegconverter.Main.listContains; - public class Parser { /** @@ -26,7 +24,7 @@ public class Parser { new Main.converterArgument("-outext", true, Main.converterArgumentValueType.SINGLE_VALUE) }; String type = tokens.get(0).toLowerCase(); - if (!listContains(types, s -> s.equals(type))) { + if (!Main.listContains(types, s -> s.equals(type))) { throw new IllegalArgumentException("Unknown converter type chosen."); } if (tokens.size() < 2) { diff --git a/src/main/java/ffmpegconverter/converter/AnimeConverter.java b/src/main/java/net/knarcraft/ffmpegconverter/converter/AnimeConverter.java similarity index 90% rename from src/main/java/ffmpegconverter/converter/AnimeConverter.java rename to src/main/java/net/knarcraft/ffmpegconverter/converter/AnimeConverter.java index 240196b..3e5ed87 100644 --- a/src/main/java/ffmpegconverter/converter/AnimeConverter.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/converter/AnimeConverter.java @@ -1,12 +1,13 @@ -package ffmpegconverter.converter; +package net.knarcraft.ffmpegconverter.converter; -import ffmpegconverter.streams.AudioStream; -import ffmpegconverter.streams.StreamObject; -import ffmpegconverter.streams.SubtitleStream; -import ffmpegconverter.streams.VideoStream; +import net.knarcraft.ffmpegconverter.streams.AudioStream; +import net.knarcraft.ffmpegconverter.streams.StreamObject; +import net.knarcraft.ffmpegconverter.streams.SubtitleStream; +import net.knarcraft.ffmpegconverter.streams.VideoStream; import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.List; public class AnimeConverter extends Converter { @@ -112,8 +113,9 @@ public class AnimeConverter extends Converter { command.add("-map"); command.add("0:" + videoStream.getAbsoluteIndex()); command.add("-vf"); - command.add("subtitles='" + fileName.replace("'", "\'") + "':si=" + - subtitleStream.getRelativeIndex()); + String safeFileName = fileName.replace("'", "\\\\\\'").replace("]", "\\]").replace("[", "\\["); + String subtitleCommand = String.format("subtitles=\"%s\"", safeFileName); + command.add(subtitleCommand); } else { command.add("-map"); command.add("0:" + videoStream.getAbsoluteIndex()); diff --git a/src/main/java/ffmpegconverter/converter/AudioConverter.java b/src/main/java/net/knarcraft/ffmpegconverter/converter/AudioConverter.java similarity index 93% rename from src/main/java/ffmpegconverter/converter/AudioConverter.java rename to src/main/java/net/knarcraft/ffmpegconverter/converter/AudioConverter.java index 3d74572..204187b 100644 --- a/src/main/java/ffmpegconverter/converter/AudioConverter.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/converter/AudioConverter.java @@ -1,7 +1,7 @@ -package ffmpegconverter.converter; +package net.knarcraft.ffmpegconverter.converter; -import ffmpegconverter.streams.AudioStream; -import ffmpegconverter.streams.StreamObject; +import net.knarcraft.ffmpegconverter.streams.AudioStream; +import net.knarcraft.ffmpegconverter.streams.StreamObject; import java.io.File; import java.io.IOException; diff --git a/src/main/java/ffmpegconverter/converter/Converter.java b/src/main/java/net/knarcraft/ffmpegconverter/converter/Converter.java similarity index 97% rename from src/main/java/ffmpegconverter/converter/Converter.java rename to src/main/java/net/knarcraft/ffmpegconverter/converter/Converter.java index 917b326..16f8fa2 100644 --- a/src/main/java/ffmpegconverter/converter/Converter.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/converter/Converter.java @@ -1,9 +1,9 @@ -package ffmpegconverter.converter; +package net.knarcraft.ffmpegconverter.converter; -import ffmpegconverter.streams.AudioStream; -import ffmpegconverter.streams.StreamObject; -import ffmpegconverter.streams.SubtitleStream; -import ffmpegconverter.streams.VideoStream; +import net.knarcraft.ffmpegconverter.streams.AudioStream; +import net.knarcraft.ffmpegconverter.streams.StreamObject; +import net.knarcraft.ffmpegconverter.streams.SubtitleStream; +import net.knarcraft.ffmpegconverter.streams.VideoStream; import java.io.BufferedReader; import java.io.BufferedWriter; @@ -309,7 +309,7 @@ public abstract class Converter { * @return A list containing just subtitles of chosen languages, sorted in order of languages */ static List filterSubtitleStreams(List subtitleStreams, String[] subtitleLanguages, - boolean preventSignsAndSongs) { + boolean preventSignsAndSongs) { List filtered = new ArrayList<>(); //Go through languages. Select all subtitles of the language for (String language : subtitleLanguages) { diff --git a/src/main/java/ffmpegconverter/converter/VideoConverter.java b/src/main/java/net/knarcraft/ffmpegconverter/converter/VideoConverter.java similarity index 95% rename from src/main/java/ffmpegconverter/converter/VideoConverter.java rename to src/main/java/net/knarcraft/ffmpegconverter/converter/VideoConverter.java index 9ef6fb2..39a70b4 100644 --- a/src/main/java/ffmpegconverter/converter/VideoConverter.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/converter/VideoConverter.java @@ -1,8 +1,8 @@ -package ffmpegconverter.converter; +package net.knarcraft.ffmpegconverter.converter; -import ffmpegconverter.streams.AudioStream; -import ffmpegconverter.streams.StreamObject; -import ffmpegconverter.streams.VideoStream; +import net.knarcraft.ffmpegconverter.streams.AudioStream; +import net.knarcraft.ffmpegconverter.streams.StreamObject; +import net.knarcraft.ffmpegconverter.streams.VideoStream; import java.io.File; import java.io.IOException; diff --git a/src/main/java/ffmpegconverter/streams/AudioStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java similarity index 94% rename from src/main/java/ffmpegconverter/streams/AudioStream.java rename to src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java index ec93a7e..afa4808 100644 --- a/src/main/java/ffmpegconverter/streams/AudioStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/AudioStream.java @@ -1,4 +1,4 @@ -package ffmpegconverter.streams; +package net.knarcraft.ffmpegconverter.streams; public class AudioStream extends StreamObject { private String language; //The audio language diff --git a/src/main/java/ffmpegconverter/streams/StreamObject.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java similarity index 94% rename from src/main/java/ffmpegconverter/streams/StreamObject.java rename to src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java index c031617..6415042 100644 --- a/src/main/java/ffmpegconverter/streams/StreamObject.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/StreamObject.java @@ -1,4 +1,4 @@ -package ffmpegconverter.streams; +package net.knarcraft.ffmpegconverter.streams; /** * An object representation of a stream in a media file diff --git a/src/main/java/ffmpegconverter/streams/SubtitleStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java similarity index 97% rename from src/main/java/ffmpegconverter/streams/SubtitleStream.java rename to src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java index 22a9e9d..06fedc7 100644 --- a/src/main/java/ffmpegconverter/streams/SubtitleStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/SubtitleStream.java @@ -1,4 +1,4 @@ -package ffmpegconverter.streams; +package net.knarcraft.ffmpegconverter.streams; /** * An object representation of a subtitle stream in a media file diff --git a/src/main/java/ffmpegconverter/streams/VideoStream.java b/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java similarity index 88% rename from src/main/java/ffmpegconverter/streams/VideoStream.java rename to src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java index 00224e3..847ed70 100644 --- a/src/main/java/ffmpegconverter/streams/VideoStream.java +++ b/src/main/java/net/knarcraft/ffmpegconverter/streams/VideoStream.java @@ -1,4 +1,4 @@ -package ffmpegconverter.streams; +package net.knarcraft.ffmpegconverter.streams; /** * An object representation of a video stream in a media file diff --git a/src/test/java/ffmpegconverter/AnimeConverterTest.java b/src/test/java/net/knarcraft/ffmpegconverter/AnimeConverterTest.java similarity index 80% rename from src/test/java/ffmpegconverter/AnimeConverterTest.java rename to src/test/java/net/knarcraft/ffmpegconverter/AnimeConverterTest.java index a97a4c4..4e97dee 100644 --- a/src/test/java/ffmpegconverter/AnimeConverterTest.java +++ b/src/test/java/net/knarcraft/ffmpegconverter/AnimeConverterTest.java @@ -1,6 +1,6 @@ -package ffmpegconverter; +package net.knarcraft.ffmpegconverter; -import ffmpegconverter.converter.AnimeConverter; +import net.knarcraft.ffmpegconverter.converter.AnimeConverter; import org.junit.Before; import org.junit.Test;