* improved predefined media info bindings
This commit is contained in:
parent
a0ff7fbcf1
commit
d71a70316a
|
@ -71,36 +71,44 @@ public class EpisodeBindingBean {
|
||||||
|
|
||||||
@Define("vc")
|
@Define("vc")
|
||||||
public String getVideoCodec() {
|
public String getVideoCodec() {
|
||||||
return getMediaInfo(StreamKind.Video, 0, "Encoded_Library/Name", "CodecID/Hint", "Codec/String");
|
// e.g. XviD, x264, DivX 5, MPEG-4 Visual, AVC, etc.
|
||||||
|
String codec = getMediaInfo(StreamKind.Video, 0, "Encoded_Library/Name", "CodecID/Hint", "Format");
|
||||||
|
|
||||||
|
// get first token (e.g. DivX 5 => DivX)
|
||||||
|
return new Scanner(codec).next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("ac")
|
@Define("ac")
|
||||||
public String getAudioCodec() {
|
public String getAudioCodec() {
|
||||||
return getMediaInfo(StreamKind.Audio, 0, "CodecID/Hint", "Codec/String");
|
// e.g. AC-3, DTS, AAC, Vorbis, MP3, etc.
|
||||||
|
String codec = getMediaInfo(StreamKind.Audio, 0, "CodecID/Hint", "Format");
|
||||||
|
|
||||||
|
// remove punctuation (e.g. AC-3 => AC3)
|
||||||
|
return codec.replaceAll("\\p{Punct}", "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("cf")
|
@Define("cf")
|
||||||
public String getContainerFormat() {
|
public String getContainerFormat() {
|
||||||
// container format extension
|
// container format extensions (e.g. avi, mkv mka mks, OGG, etc.)
|
||||||
String extensions = getMediaInfo(StreamKind.General, 0, "Codec/Extensions");
|
String extensions = getMediaInfo(StreamKind.General, 0, "Codec/Extensions", "Format");
|
||||||
|
|
||||||
// get first token
|
// get first extension
|
||||||
return new Scanner(extensions).next();
|
return new Scanner(extensions).next().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("hi")
|
@Define("vf")
|
||||||
public String getHeightAndInterlacement() {
|
public String getVideoFormat() {
|
||||||
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
||||||
String interlacement = getMediaInfo(StreamKind.Video, 0, "Interlacement");
|
String scanType = getMediaInfo(StreamKind.Video, 0, "ScanType");
|
||||||
|
|
||||||
if (height == null || interlacement == null)
|
if (height == null || scanType == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// e.g. 720p
|
// e.g. 720p
|
||||||
return height + Character.toLowerCase(interlacement.charAt(0));
|
return height + Character.toLowerCase(scanType.charAt(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ expr[a5]: episode
|
||||||
expr[b1]: vc
|
expr[b1]: vc
|
||||||
expr[b2]: ac
|
expr[b2]: ac
|
||||||
expr[b3]: cf
|
expr[b3]: cf
|
||||||
expr[b4]: hi
|
expr[b4]: vf
|
||||||
expr[b5]: resolution
|
expr[b5]: resolution
|
||||||
|
|
||||||
# file expressions
|
# file expressions
|
||||||
|
|
Loading…
Reference in New Issue