All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good
31 lines
930 B
Java
31 lines
930 B
Java
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();
|
|
}
|
|
|
|
}
|