diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index a8a72908..c2189466 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -14,6 +14,7 @@ import static net.sourceforge.tuned.StringUtilities.*; import java.io.File; import java.io.IOException; +import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; @@ -232,33 +233,40 @@ public class MediaBindingBean { @Define("resolution") public String getVideoResolution() { - String width = getMediaInfo(StreamKind.Video, 0, "Width"); - String height = getMediaInfo(StreamKind.Video, 0, "Height"); + List dim = getDimension(); - if (width == null || height == null) + if (dim.contains(null)) return null; // e.g. 1280x720 - return width + 'x' + height; + return join(dim, "x"); } @Define("ws") public String getWidescreen() { - float width = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Width")); - float height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height")); + List dim = getDimension(); // 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") public String getVideoDefinitionCategory() { - String height = getMediaInfo(StreamKind.Video, 0, "Height"); + List dim = getDimension(); // 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 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); } diff --git a/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties b/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties index f00c6d7e..f012c456 100644 --- a/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties +++ b/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties @@ -2,4 +2,4 @@ parameter.exclude: ^StreamKind|Count$ # 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 diff --git a/source/net/sourceforge/filebot/ui/rename/FormatDialog.java b/source/net/sourceforge/filebot/ui/rename/FormatDialog.java index ccbe6c3e..8311ca8e 100644 --- a/source/net/sourceforge/filebot/ui/rename/FormatDialog.java +++ b/source/net/sourceforge/filebot/ui/rename/FormatDialog.java @@ -207,7 +207,7 @@ class FormatDialog extends JDialog { // initialize window properties setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); - setSize(520, 400); + setSize(540, 380); }