1
0
mirror of https://github.com/mitb-archive/filebot synced 2025-03-09 13:59:49 -04:00

Add MediaCharacteristics.getSubtitleLanguage()

This commit is contained in:
Reinhard Pointner 2019-03-17 12:39:14 +07:00
parent 504bb1132d
commit fd982ab790
3 changed files with 17 additions and 5 deletions

View File

@ -69,6 +69,11 @@ public class FFProbe implements MediaCharacteristics {
return getString("subtitle", "codec_name"); return getString("subtitle", "codec_name");
} }
@Override
public String getSubtitleLanguage() {
return getString("subtitle", "tags", "language");
}
@Override @Override
public Duration getDuration() { public Duration getDuration() {
long d = (long) Double.parseDouble(getFormat().get("duration").toString()) * 1000; long d = (long) Double.parseDouble(getFormat().get("duration").toString()) * 1000;
@ -133,7 +138,7 @@ public class FFProbe implements MediaCharacteristics {
} }
protected String getString(String streamKind, String objectKey, String valueKey) { protected String getString(String streamKind, String objectKey, String valueKey) {
return stream(streamKind, objectKey).map(t -> ((Map) t).get(valueKey)).map(Objects::toString).collect(joining(" ")); return stream(streamKind, objectKey).map(t -> ((Map) t).get(valueKey)).map(Objects::toString).collect(joining(" / "));
} }
protected Stream<Object> stream(String streamKind, String property) { protected Stream<Object> stream(String streamKind, String property) {

View File

@ -13,6 +13,8 @@ public interface MediaCharacteristics extends AutoCloseable {
String getSubtitleCodec(); String getSubtitleCodec();
String getSubtitleLanguage();
Duration getDuration(); Duration getDuration();
Integer getWidth(); Integer getWidth();

View File

@ -144,22 +144,27 @@ public class MediaInfo implements MediaCharacteristics {
@Override @Override
public String getVideoCodec() { public String getVideoCodec() {
return get(StreamKind.Video, 0, "CodecID"); return get(StreamKind.General, 0, "Video_Codec_List");
} }
@Override @Override
public String getAudioCodec() { public String getAudioCodec() {
return get(StreamKind.Audio, 0, "CodecID"); return get(StreamKind.General, 0, "Audio_Codec_List");
} }
@Override @Override
public String getAudioLanguage() { public String getAudioLanguage() {
return get(StreamKind.General, 0, "AudioLanguageList"); return get(StreamKind.General, 0, "Audio_Language_List");
} }
@Override @Override
public String getSubtitleCodec() { public String getSubtitleCodec() {
return get(StreamKind.General, 0, "TextCodecList"); return get(StreamKind.General, 0, "Text_Codec_List");
}
@Override
public String getSubtitleLanguage() {
return get(StreamKind.General, 0, "Text_Language_List");
} }
@Override @Override