Adds filtering for audio description tracks
All checks were successful
KnarCraft/FFmpegConvert/pipeline/head This commit looks good

This commit is contained in:
2024-05-05 03:50:07 +02:00
parent d46f12e690
commit dae93b9f81
6 changed files with 102 additions and 11 deletions

View File

@ -9,8 +9,8 @@ import java.util.Map;
*/
public class SubtitleStream extends AbstractStream implements StreamObject {
final private boolean isFullSubtitle;
final private boolean isImageSubtitle;
private final boolean isFullSubtitle;
private final boolean isImageSubtitle;
/**
* Instantiates a new subtitle stream
@ -21,7 +21,7 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
*/
public SubtitleStream(@NotNull Map<StreamTag, String> streamInfo, int inputIndex, int relativeIndex) {
super(streamInfo, inputIndex, relativeIndex);
this.isFullSubtitle = isFullSubtitle();
this.isFullSubtitle = checkIfIsFullSubtitle();
this.isImageSubtitle = codecName != null &&
(getCodecName().equals("hdmv_pgs_subtitle") || getCodecName().equals("dvd_subtitle"));
}
@ -31,7 +31,7 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
*
* @return <p>Whether the subtitles is an image subtitle.</p>
*/
public boolean getIsImageSubtitle() {
public boolean isImageSubtitle() {
return this.isImageSubtitle;
}
@ -40,7 +40,7 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
*
* @return <p>Whether the subtitle is a full subtitle.</p>
*/
public boolean getIsFullSubtitle() {
public boolean isFullSubtitle() {
return this.isFullSubtitle;
}
@ -49,7 +49,7 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
*
* @return <p>True if the subtitle translates everything.</p>
*/
private boolean isFullSubtitle() {
private boolean checkIfIsFullSubtitle() {
String titleLowercase = getTitle().toLowerCase().trim();
return !titleLowercase.matches(".*si(ng|gn)s?[ &/a-z]+songs?.*") &&
!titleLowercase.matches(".*songs?[ &/a-z]+si(gn|ng)s?.*") &&
@ -59,7 +59,8 @@ public class SubtitleStream extends AbstractStream implements StreamObject {
!titleLowercase.matches("songs?") &&
!titleLowercase.matches(".*signs only.*") &&
!titleLowercase.matches(".* signs .*") &&
!titleLowercase.matches("signs@.*");
!titleLowercase.matches("signs@.*") &&
!titleLowercase.matches("signs -.*");
}
@Override