Changes main package name and fixes files with weird names throwing errors
All checks were successful
KnarCraft/FFmpegConvert/master This commit looks good
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:
@@ -0,0 +1,29 @@
|
||||
package net.knarcraft.ffmpegconverter.streams;
|
||||
|
||||
public class AudioStream extends StreamObject {
|
||||
private String language; //The audio language
|
||||
private int channels; //Whether mono, stereo, etc
|
||||
private String title; //Titles exist
|
||||
|
||||
public AudioStream(String codec, int absoluteIndex, int relativeIndex, String language, String title, int channels) {
|
||||
this.codecType = "audio";
|
||||
this.codecName = codec;
|
||||
this.absoluteIndex = absoluteIndex;
|
||||
this.language = language;
|
||||
this.title = title;
|
||||
this.relativeIndex = relativeIndex;
|
||||
this.channels = channels;
|
||||
}
|
||||
|
||||
public String getLanguage() {
|
||||
return this.language;
|
||||
}
|
||||
|
||||
public int getChannels() {
|
||||
return this.channels;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return this.title;
|
||||
}
|
||||
}
|
@@ -0,0 +1,43 @@
|
||||
package net.knarcraft.ffmpegconverter.streams;
|
||||
|
||||
/**
|
||||
* An object representation of a stream in a media file
|
||||
*/
|
||||
public abstract class StreamObject {
|
||||
int absoluteIndex;
|
||||
int relativeIndex;
|
||||
String codecName;
|
||||
String codecType;
|
||||
|
||||
/**
|
||||
* Gets the type of the stream codec (video/audio/subtitle)
|
||||
* @return codec type
|
||||
*/
|
||||
public String getCodecType() {
|
||||
return this.codecType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name of the stream codec
|
||||
* @return codec name
|
||||
*/
|
||||
public String getCodecName() {
|
||||
return this.codecName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the absolute index of a stream object
|
||||
* @return absolute index
|
||||
*/
|
||||
public int getAbsoluteIndex() {
|
||||
return this.absoluteIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the relative index of a stream object (kth element of codec type)
|
||||
* @return relative index
|
||||
*/
|
||||
public int getRelativeIndex() {
|
||||
return this.relativeIndex;
|
||||
}
|
||||
}
|
@@ -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;
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package net.knarcraft.ffmpegconverter.streams;
|
||||
|
||||
/**
|
||||
* An object representation of a video stream in a media file
|
||||
*/
|
||||
public class VideoStream extends StreamObject {
|
||||
public VideoStream(String codec, int absoluteIndex, int relativeIndex) {
|
||||
this.codecType = "video";
|
||||
this.codecName = codec;
|
||||
this.absoluteIndex = absoluteIndex;
|
||||
this.relativeIndex = relativeIndex;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user