Adjusts the Signs/Songs RegEx
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good

This commit is contained in:
Kristian Knarvik 2024-07-06 01:55:02 +02:00
parent da67b195de
commit c0249c3b3a
2 changed files with 3 additions and 1 deletions

View File

@ -21,7 +21,7 @@ public final class SubtitleHelper {
* @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?)?|" +
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();

View File

@ -27,6 +27,8 @@ public class SubtitleHelperTest {
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Forced"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Signs / Songs"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Songs / Signs"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Signs/Lyrics"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("English [Signs/Lyrics]"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Forced Subtitles"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Some Text Signs & Songs"));
assertTrue(SubtitleHelper.isSongsSignsSubtitle("Some Text Songs & Signs"));