From c7f5fe93644348bb2be69f9fd6e2c623d83ab18a Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Mon, 31 Oct 2016 07:58:27 +0800 Subject: [PATCH] Experimental support for episode level extended info (only supported with TheTVDB data) --- source/net/filebot/format/ExpressionFormatMethods.java | 10 ++++++++++ source/net/filebot/format/MediaBindingBean.java | 5 ++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/source/net/filebot/format/ExpressionFormatMethods.java b/source/net/filebot/format/ExpressionFormatMethods.java index e2b9bd84..e7907a7a 100644 --- a/source/net/filebot/format/ExpressionFormatMethods.java +++ b/source/net/filebot/format/ExpressionFormatMethods.java @@ -2,6 +2,7 @@ package net.filebot.format; import static java.util.Arrays.*; import static java.util.regex.Pattern.*; +import static java.util.stream.Collectors.*; import static net.filebot.MediaTypes.*; import static net.filebot.WebServices.*; import static net.filebot.format.ExpressionFormatFunctions.*; @@ -36,6 +37,8 @@ import net.filebot.similarity.Normalization; import net.filebot.util.FileUtilities; import net.filebot.web.Episode; import net.filebot.web.EpisodeInfo; +import net.filebot.web.Person; +import net.filebot.web.SeriesInfo; import net.filebot.web.SimpleDate; public class ExpressionFormatMethods { @@ -511,4 +514,11 @@ public class ExpressionFormatMethods { return null; } + public static List getActors(SeriesInfo self) throws Exception { + if (TheTVDB.getIdentifier().equals(self.getDatabase())) + return TheTVDBv2.getActors(self.getId(), Locale.ENGLISH).stream().map(Person::getName).collect(toList()); + + return null; + } + } diff --git a/source/net/filebot/format/MediaBindingBean.java b/source/net/filebot/format/MediaBindingBean.java index fd69b9ee..e9fac780 100644 --- a/source/net/filebot/format/MediaBindingBean.java +++ b/source/net/filebot/format/MediaBindingBean.java @@ -62,7 +62,6 @@ import net.filebot.web.EpisodeFormat; import net.filebot.web.Movie; import net.filebot.web.MoviePart; import net.filebot.web.MultiEpisode; -import net.filebot.web.Person; import net.filebot.web.SeriesInfo; import net.filebot.web.SimpleDate; import net.filebot.web.SortOrder; @@ -580,7 +579,7 @@ public class MediaBindingBean { if (infoObject instanceof Movie) return getMovieInfo().getActors(); if (infoObject instanceof Episode) - return TheTVDBv2.getActors(getSeriesInfo().getId(), Locale.ENGLISH).stream().map(Person::getName).collect(toList()); // use TheTVDB API v2 to retrieve actors info + return ExpressionFormatMethods.getActors(getSeriesInfo()); // use TheTVDB API v2 to retrieve actors info return null; } @@ -605,7 +604,7 @@ public class MediaBindingBean { if (infoObject instanceof Movie) return getMovieInfo().getDirector(); if (infoObject instanceof Episode) - return getInfo(getEpisode()).getDirectors().iterator().next(); + return ExpressionFormatMethods.getInfo(getEpisode()).getDirectors().iterator().next(); // use TheTVDB API v2 to retrieve extended episode info return null; }