From ca757a7f3f1533a859a2c7209117d75ef558075a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Tue, 26 Jan 2016 18:41:47 +0000 Subject: [PATCH] Added {channels} binding for values like 5.1 --- source/net/filebot/format/MediaBindingBean.java | 9 +++++++++ source/net/filebot/ui/rename/BindingDialog.properties | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index e926caa9..2c08c8dd 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -15,6 +15,7 @@ import static net.filebot.web.EpisodeFormat.*; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.math.BigDecimal; import java.util.ArrayList; import java.util.Date; import java.util.HashSet; @@ -354,6 +355,14 @@ public class MediaBindingBean { return SPACE.splitAsStream(channels).findFirst().get() + "ch"; } + @Define("channels") + public String getAudioChannelPositions() { + String[] channels = getMediaInfo(StreamKind.Audio, 0, "ChannelPositions/String2").split("/"); + + // e.g. 5.1 + return stream(channels).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + } + @Define("resolution") public String getVideoResolution() { List dim = getDimension(); diff --git a/source/net/filebot/ui/rename/BindingDialog.properties b/source/net/filebot/ui/rename/BindingDialog.properties index 713cb139..ceb85044 100644 --- a/source/net/filebot/ui/rename/BindingDialog.properties +++ b/source/net/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,es,sxe,s00e00,t,d,startdate,absolute,special,episode,series,primaryTitle,alias,movie,tmdbid,imdbid,az,music,artist,albumArtist,album,pi,pn,lang,actors,director,collection,genre,genres,certification,rating,vc,ac,cf,vf,hpi,af,resolution,dim,ws,sdhd,source,tags,s3d,group,original,fn,ext,mediaType,file,file.name,folder,folder.name,gigabytes,crc32,info,info.runtime,info.status,omdb.rating,omdb.votes,localize.German.title,age,duration,seconds,minutes,media,media.title,media.overallBitRateString,video,video.codecID,video.frameRate,video.displayAspectRatioString,video.scanType,audio,audio.bitRateString,audio.language,audios,audios.language,text,text.codecInfo,text.language,texts,texts.language +expressions: n,y,s,e,es,sxe,s00e00,t,d,startdate,absolute,special,episode,series,primaryTitle,alias,movie,tmdbid,imdbid,az,music,artist,albumArtist,album,pi,pn,lang,actors,director,collection,genre,genres,certification,rating,vc,ac,cf,vf,hpi,af,channels,resolution,dim,ws,sdhd,source,tags,s3d,group,original,fn,ext,mediaType,file,file.name,folder,folder.name,gigabytes,crc32,info,info.runtime,info.status,omdb.rating,omdb.votes,localize.German.title,age,duration,seconds,minutes,media,media.title,media.overallBitRateString,video,video.codecID,video.frameRate,video.displayAspectRatioString,video.scanType,audio,audio.bitRateString,audio.language,audios,audios.language,text,text.codecInfo,text.language,texts,texts.language