From 2f4c3d8e8016c4cd35492edb141c72183213b233 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 10 Jun 2019 03:55:58 +0700 Subject: [PATCH] Added {seasonize} binding --- source/net/filebot/format/MediaBindingBean.java | 15 +++++++++++++++ .../filebot/ui/rename/BindingDialog.properties | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index 1332d6d6..5d490e54 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -788,6 +788,21 @@ public class MediaBindingBean { }); } + @Define("seasonize") + public AssociativeScriptObject getSeasonizeObject() throws Exception { + Episode e = getEpisode(); + + if (e.getSeason() != null) { + return createBindingObject(e); // do nothing + } + + if (AniDB.getIdentifier().equals(e.getSeriesInfo().getDatabase())) { + return AnimeLists.AniDB.map(e, AnimeLists.TheTVDB).map(this::createBindingObject).orElse(null); // map AniDB to TheTVDB bindings + } + + return createBindingObject(fetchEpisode(e, SortOrder.Airdate, null)); + } + @Define("az") public String getSortInitial() { try { diff --git a/source/net/filebot/ui/rename/BindingDialog.properties b/source/net/filebot/ui/rename/BindingDialog.properties index d951380b..db6c7c68 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, ny, es, sy, sc, di, dc, age, special, episode, episode.info, series, series.actors, primaryTitle, alias, movie, movie.alternativeTitles, movie.collection, id, tmdbid, imdbid, pi, pn, lang, subt, plex, plex.name, kodi, kodi.name, az, type, anime, regular, music, album, artist, albumArtist, actors, director, collection, ci, cy, genre, genres, languages, runtime, certification, rating, votes, vc, ac, cf, vf, hpi, aco, af, channels, resolution, dim, width, height, bitdepth, hdr, bitrate, kbps, mbps, fps, khz, ws, hd, source, tags, s3d, group, original, info, info.network, info.status, info.productionCompanies, info.productionCountries, info.certifications, info.certifications.AU, info.certifications.DE, omdb.rating, omdb.votes, localize.deu.n, localize.deu.t, localize.zho.n, localize.zho.t, order.airdate.sxe, order.dvd.sxe, fn, ext, f, f.name, folder, folder.name, mediaPath, mime, mediaTitle, audioLanguages, textLanguages, duration, seconds, minutes, hours, bytes, megabytes, gigabytes, crc32, media.title, media.collection, media.season, media.part, media.partID, media.genre, media.contentType, media.description, media.lyrics, video[0].codecID, video[0].frameRate, video[0].displayAspectRatioString, video[0].scanType, audio.language, audio[0].bitRateString, audio[0].language, text.language, text[0].language, text[0].codecInfo, camera, camera.maker, camera.model, location, location.country +expressions: n, y, s, e, sxe, s00e00, t, d, startdate, absolute, ny, es, sy, sc, di, dc, age, special, episode, episode.info, series, series.actors, primaryTitle, alias, movie, movie.alternativeTitles, movie.collection, id, tmdbid, imdbid, pi, pn, lang, subt, plex, plex.name, kodi, kodi.name, az, type, anime, regular, music, album, artist, albumArtist, actors, director, collection, ci, cy, genre, genres, languages, runtime, certification, rating, votes, vc, ac, cf, vf, hpi, aco, af, channels, resolution, dim, width, height, bitdepth, hdr, bitrate, kbps, mbps, fps, khz, ws, hd, source, tags, s3d, group, original, info, info.network, info.status, info.productionCompanies, info.productionCountries, info.certifications, info.certifications.AU, info.certifications.DE, omdb.rating, omdb.votes, localize.deu.n, localize.deu.t, localize.zho.n, localize.zho.t, order.airdate.sxe, order.dvd.sxe, seasonize.episode, fn, ext, f, f.name, folder, folder.name, mediaPath, mime, mediaTitle, audioLanguages, textLanguages, duration, seconds, minutes, hours, bytes, megabytes, gigabytes, crc32, media.title, media.collection, media.season, media.part, media.partID, media.genre, media.contentType, media.description, media.lyrics, video[0].codecID, video[0].frameRate, video[0].displayAspectRatioString, video[0].scanType, audio.language, audio[0].bitRateString, audio[0].language, text.language, text[0].language, text[0].codecInfo, camera, camera.maker, camera.model, location, location.country