From 861d557e9228d73e54b53bac9b6e6162f1c89121 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 8 Jul 2012 12:38:34 +0000 Subject: [PATCH] * make {vf} only evaluate to standard tags like 1080p, 720p, 480p * the old {vf} binding is now {hpi} --- .../filebot/format/MediaBindingBean.java | 20 +++++++++++++++++++ .../ui/rename/BindingDialog.properties | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 491a21c4..a8a72908 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -187,6 +187,26 @@ public class MediaBindingBean { @Define("vf") public String getVideoFormat() { + // {def h = video.height as int; h > 720 ? 1080 : h > 480 ? 720 : 480}p + int height = Integer.parseInt(getMediaInfo(StreamKind.Video, 0, "Height")); + String vf = ""; + + if (height > 720) + vf += 1080; + else if (height > 480) + vf += 720; + else if (height > 360) + vf += 480; + else + return null; // video too small + + // e.g. 720p + return vf + 'p'; // nobody actually wants files to be tagged as interlaced, e.g. 720i + } + + + @Define("hpi") + public String getExactVideoFormat() { String height = getMediaInfo(StreamKind.Video, 0, "Height"); String scanType = getMediaInfo(StreamKind.Video, 0, "ScanType"); diff --git a/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties b/source/net/sourceforge/filebot/ui/rename/BindingDialog.properties index cba1855a..f00c6d7e 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,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,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