From c6971a30c3d8f642ff887257a435ba56fc9439c7 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Fri, 22 Jul 2016 22:12:53 +0800 Subject: [PATCH] Added season count binding {sc} --- source/net/filebot/format/MediaBindingBean.java | 5 +++++ source/net/filebot/ui/rename/BindingDialog.properties | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 65532581..ab76a966 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -707,6 +707,11 @@ public class MediaBindingBean { return getEpisodeList().stream().filter(e -> getSeasonNumber().equals(e.getSeason()) && e.getAirdate() != null).map(e -> e.getAirdate().getYear()).sorted().distinct().collect(toList()); } + @Define("sc") + public Integer getSeasonCount() throws Exception { + return getEpisodeList().stream().map(Episode::getSeason).filter(Objects::nonNull).max(Integer::compare).get(); + } + @Define("localize") public Object getLocalizedInfoObject() throws Exception { return new DynamicBindings(key -> { diff --git a/source/net/filebot/ui/rename/BindingDialog.properties b/source/net/filebot/ui/rename/BindingDialog.properties index ede098d3..f5882b4c 100644 --- a/source/net/filebot/ui/rename/BindingDialog.properties +++ b/source/net/filebot/ui/rename/BindingDialog.properties @@ -2,4 +2,4 @@ parameter.exclude: ^StreamKind|^UniqueID|^StreamOrder|^ID|Count$ # preview expressions (keys are tagged so they can be sorted alphabetically) -expressions: n, y, s, e, sxe, s00e00, t, d, startdate, absolute, es, sy, special, episode, series, primaryTitle, alias, movie, tmdbid, imdbid, pi, pn, lang, subt, plex, az, type, anime, regular, music, album, artist, albumArtist, actors, director, collection, genre, genres, languages, certification, rating, vc, ac, cf, vf, hpi, af, channels, resolution, dim, bitdepth, 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, mediaTitle, age, duration, seconds, minutes, media, media.overallBitRateString, video[0], video[0].codecID, video[0].frameRate, video[0].displayAspectRatioString, video[0].scanType, audio[0], audio[0].bitRateString, audio[0].language, audio, audio.language, text[0], text[0].codecInfo, text[0].language, text, text.language +expressions: n, y, s, e, sxe, s00e00, t, d, startdate, absolute, es, sy, sc, special, episode, series, primaryTitle, alias, movie, tmdbid, imdbid, pi, pn, lang, subt, plex, az, type, anime, regular, music, album, artist, albumArtist, actors, director, collection, genre, genres, languages, certification, rating, vc, ac, cf, vf, hpi, af, channels, resolution, dim, bitdepth, 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, mediaTitle, age, duration, seconds, minutes, media, media.overallBitRateString, video[0], video[0].codecID, video[0].frameRate, video[0].displayAspectRatioString, video[0].scanType, audio[0], audio[0].bitRateString, audio[0].language, audio, audio.language, text[0], text[0].codecInfo, text[0].language, text, text.language