Added {cy} collection years binding and {movie.collection} extension method

This commit is contained in:
Reinhard Pointner 2019-05-15 10:04:23 +07:00
parent 8bdb76b914
commit 015314e5f5
3 changed files with 18 additions and 4 deletions

View File

@ -649,6 +649,13 @@ public class ExpressionFormatMethods {
return null;
}
public static List<Movie> getCollection(Movie self) throws Exception {
if (self.getTmdbId() > 0) {
return TheMovieDB.getCollection(self.getTmdbId(), Locale.US);
}
return null;
}
/**
* DSL utilities
*/

View File

@ -715,10 +715,17 @@ public class MediaBindingBean {
@Define("ci")
public Integer getCollectionIndex() throws Exception {
if (infoObject instanceof Movie && getMovie().getTmdbId() > 0)
return TheMovieDB.getCollection(getMovie().getTmdbId(), Locale.US).indexOf(getMovie()) + 1;
return ExpressionFormatMethods.getCollection(getMovie()).indexOf(getMovie()) + 1;
}
return null;
@Define("cy")
public List<Integer> getCollectionYears() throws Exception {
List<Integer> years = ExpressionFormatMethods.getCollection(getMovie()).stream().map(Movie::getYear).sorted().distinct().collect(toList());
if (years.size() > 1) {
return asList(years.get(0), years.get(years.size() - 1));
} else {
return years;
}
}
@Define("info")

View File

@ -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, series, primaryTitle, alias, movie, 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, 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, series, primaryTitle, alias, movie, 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