mirror of
https://github.com/mitb-archive/filebot
synced 2024-11-17 23:05:03 -05:00
* new binding {dim} to easily get video dimensions as int[]
This commit is contained in:
parent
24ea7ab334
commit
1dd86ad2b0
@ -14,6 +14,7 @@ import static net.sourceforge.tuned.StringUtilities.*;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
@ -232,33 +233,40 @@ public class MediaBindingBean {
|
|||||||
|
|
||||||
@Define("resolution")
|
@Define("resolution")
|
||||||
public String getVideoResolution() {
|
public String getVideoResolution() {
|
||||||
String width = getMediaInfo(StreamKind.Video, 0, "Width");
|
List<Integer> dim = getDimension();
|
||||||
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
|
||||||
|
|
||||||
if (width == null || height == null)
|
if (dim.contains(null))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
// e.g. 1280x720
|
// e.g. 1280x720
|
||||||
return width + 'x' + height;
|
return join(dim, "x");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("ws")
|
@Define("ws")
|
||||||
public String getWidescreen() {
|
public String getWidescreen() {
|
||||||
float width = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Width"));
|
List<Integer> dim = getDimension();
|
||||||
float height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height"));
|
|
||||||
|
|
||||||
// width-to-height aspect ratio greater than 1.37:1
|
// width-to-height aspect ratio greater than 1.37:1
|
||||||
return width / height > 1.37 ? "ws" : null;
|
return (float) dim.get(0) / dim.get(1) > 1.37f ? "ws" : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Define("sdhd")
|
@Define("sdhd")
|
||||||
public String getVideoDefinitionCategory() {
|
public String getVideoDefinitionCategory() {
|
||||||
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
List<Integer> dim = getDimension();
|
||||||
|
|
||||||
// SD (less than 720 lines) or HD (more than 720 lines)
|
// SD (less than 720 lines) or HD (more than 720 lines)
|
||||||
return Integer.parseInt(height) < 720 ? "SD" : "HD";
|
return dim.get(0) >= 1280 || dim.get(1) >= 720 ? "HD" : "SD";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Define("dim")
|
||||||
|
public List<Integer> getDimension() {
|
||||||
|
String width = getMediaInfo(StreamKind.Video, 0, "Width");
|
||||||
|
String height = getMediaInfo(StreamKind.Video, 0, "Height");
|
||||||
|
|
||||||
|
return Arrays.asList(width != null ? Integer.parseInt(width) : null, height != null ? Integer.parseInt(height) : null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
parameter.exclude: ^StreamKind|Count$
|
parameter.exclude: ^StreamKind|Count$
|
||||||
|
|
||||||
# preview expressions (keys are tagged so they can be sorted alphabetically)
|
# preview expressions (keys are tagged so they can be sorted alphabetically)
|
||||||
expressions: n,y,s,e,t,airdate,startdate,absolute,special,imdb,episode,sxe,s00e00,movie,vc,ac,cf,vf,af,resolution,hpi,ws,sdhd,source,group,crc32,fn,ext,file,pi,pn,lang,actors,director,genres,certification,rating,info.runtime,info.status,media.title,media.durationString,media.overallBitRateString,video.codecID,video.frameRate,video.displayAspectRatioString,video.height,video.scanType,audio.format,audio.bitRateString,audio.language,text.codecInfo,text.language
|
expressions: n,y,s,e,t,airdate,startdate,absolute,special,imdb,episode,sxe,s00e00,movie,vc,ac,cf,vf,af,resolution,hpi,ws,sdhd,source,group,crc32,fn,ext,file,pi,pn,lang,actors,director,genres,certification,rating,dim,info.runtime,info.status,media.title,media.durationString,media.overallBitRateString,video.codecID,video.frameRate,video.displayAspectRatioString,video.height,video.scanType,audio.format,audio.bitRateString,audio.language,text.codecInfo,text.language
|
||||||
|
@ -207,7 +207,7 @@ class FormatDialog extends JDialog {
|
|||||||
|
|
||||||
// initialize window properties
|
// initialize window properties
|
||||||
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
|
||||||
setSize(520, 400);
|
setSize(540, 380);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user