From 618e566e3faafb63eaf94c3a146c66c9fce1da1c Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sat, 29 Dec 2012 17:41:07 +0000 Subject: [PATCH] * make imdb binding return tt1234567 pattern values * support {tmdbid} binding --- .../filebot/format/MediaBindingBean.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 7b188efe..25476e0e 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -172,6 +172,23 @@ public class MediaBindingBean { } + @Define("tmdbid") + public String getTmdbId() throws Exception { + int tmdbid = getMovie().getTmdbId(); + + if (tmdbid <= 0) { + if (getMovie().getImdbId() <= 0) { + return null; + } + + // lookup IMDbID for TMDbID + tmdbid = WebServices.TMDb.getMovieInfo(getMovie(), null).getId(); + } + + return String.valueOf(tmdbid); + } + + @Define("imdbid") public String getImdbId() throws Exception { int imdbid = getMovie().getImdbId(); @@ -185,7 +202,7 @@ public class MediaBindingBean { imdbid = WebServices.TMDb.getMovieInfo(getMovie(), null).getImdbId(); } - return String.format("%07d", imdbid); + return String.format("tt%07d", imdbid); }