Changes main package name and fixes files with weird names throwing errors
All checks were successful
KnarCraft/FFmpegConvert/master This commit looks good

Fixes conversion of files with a single quote or square brackets in the filename
Moves all files into the net.knarcraft.ffmpegconverter package
This commit is contained in:
2020-02-21 17:23:00 +01:00
parent c80193281d
commit 4e1cebd95d
13 changed files with 39 additions and 40 deletions

View File

@ -0,0 +1,65 @@
package net.knarcraft.ffmpegconverter.streams;
/**
* An object representation of a subtitle stream in a media file
*/
public class SubtitleStream extends StreamObject {
final private String language;
final private String title; //Title shown
final private boolean isFullSubtitle; //Songs and signs will be false
final private boolean isImageSubtitle;
public SubtitleStream(String codecName, int absoluteIndex, int relativeIndex, String language, String title) {
this.codecType = "subtitle";
this.codecName = codecName;
this.absoluteIndex = absoluteIndex;
this.language = language;
this.title = title;
this.isFullSubtitle = isFullSubtitle();
this.relativeIndex = relativeIndex;
this.isImageSubtitle = isImageSubtitle();
}
/**
* Checks whether a subtitle is image based (as opposed to text based)
* @return True if the subtitle is image based
*/
private boolean isImageSubtitle() {
return codecName != null && getCodecName().equals("hdmv_pgs_subtitle");
}
/**
* Checks whether translates everything (as opposed to just songs and signs)
* @return True if the subtitles translate everything
*/
private boolean isFullSubtitle() {
if (getTitle() == null) {
return false;
}
String titleLowercase = getTitle().toLowerCase();
return !(titleLowercase.contains("songs and signs") ||
titleLowercase.contains("signs and songs") ||
titleLowercase.contains("songs & signs") ||
titleLowercase.contains("signs & songs") ||
titleLowercase.contains("signs/song") ||
titleLowercase.contains("songs/sign") ||
titleLowercase.contains("[forced]") ||
titleLowercase.contains("(forced)"));
}
public String getLanguage() {
return this.language;
}
public String getTitle() {
return this.title;
}
public boolean getIsImageSubtitle() {
return this.isImageSubtitle;
}
public boolean getIsFullSubtitle() {
return this.isFullSubtitle;
}
}