Various smaller improvements
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good

Improves Signs & Songs subtitle RegEx
Adds tests for the Signs & Songs subtitle RegEx
Automatically changes "enm" language to English
Makes the downscale converter select HEVC if the input is HEVC
This commit is contained in:
2024-06-07 15:46:51 +02:00
parent 1dc489a6f8
commit 1ceb378757
6 changed files with 93 additions and 4 deletions

View File

@ -0,0 +1,30 @@
package net.knarcraft.ffmpegconverter.utility;
import org.jetbrains.annotations.NotNull;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* A helper class for subtitle-related tasks
*/
public final class SubtitleHelper {
private SubtitleHelper() {
}
/**
* Checks whether the given subtitle is a songs & signs subtitle
*
* @param subtitleTitle <p>The subtitle to check</p>
* @return <p>True if the subtitle is a songs and signs, not a full subtitle</p>
*/
public static boolean isSongsSignsSubtitle(@NotNull String subtitleTitle) {
Pattern pattern = Pattern.compile("(^| |\\(|\\[\\{)si(ng|gn)s?($|[ &/+-@])+(titles)?[ &/+-@]?(songs?)?|" +
"(^| |\\(|\\[\\{)songs?($|[ &/+-@])+(si(gn|ng)s?)?|.*forced.*|.*s&s.*");
Matcher matcher = pattern.matcher(subtitleTitle.toLowerCase().trim());
return matcher.find();
}
}