From db86aa5153a61c2c39d0318806bfb0082ca4462d Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 13 Apr 2014 19:39:46 +0000 Subject: [PATCH] * refactor static field names for scripting --- source/net/sourceforge/filebot/WebServices.java | 14 +++++++------- .../filebot/format/MediaBindingBean.java | 10 +++++----- .../filebot/ui/subtitle/SubtitleUploadDialog.java | 2 +- .../web/{AcoustID.java => AcoustIDClient.java} | 6 +++--- .../web/{FanartTV.java => FanartTVClient.java} | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) rename source/net/sourceforge/filebot/web/{AcoustID.java => AcoustIDClient.java} (97%) rename source/net/sourceforge/filebot/web/{FanartTV.java => FanartTVClient.java} (96%) diff --git a/source/net/sourceforge/filebot/WebServices.java b/source/net/sourceforge/filebot/WebServices.java index 45ef4147..7b984fc9 100644 --- a/source/net/sourceforge/filebot/WebServices.java +++ b/source/net/sourceforge/filebot/WebServices.java @@ -18,12 +18,12 @@ import java.util.concurrent.Future; import java.util.logging.Level; import java.util.logging.Logger; -import net.sourceforge.filebot.web.AcoustID; +import net.sourceforge.filebot.web.AcoustIDClient; import net.sourceforge.filebot.web.AnidbClient; import net.sourceforge.filebot.web.AnidbSearchResult; import net.sourceforge.filebot.web.AudioTrack; import net.sourceforge.filebot.web.EpisodeListProvider; -import net.sourceforge.filebot.web.FanartTV; +import net.sourceforge.filebot.web.FanartTVClient; import net.sourceforge.filebot.web.ID3Lookup; import net.sourceforge.filebot.web.IMDbClient; import net.sourceforge.filebot.web.LocalSearch; @@ -56,21 +56,21 @@ public final class WebServices { // movie dbs public static final IMDbClient IMDb = new IMDbClient(); - public static final TMDbClient TMDb = new TMDbClient(getApplicationProperty("themoviedb.apikey")); + public static final TMDbClient TheMovieDB = new TMDbClient(getApplicationProperty("themoviedb.apikey")); // subtitle dbs public static final OpenSubtitlesClient OpenSubtitles = new OpenSubtitlesClient(String.format("%s %s", getApplicationName(), getApplicationVersion())); // misc - public static final FanartTV FanartTV = new FanartTV(Settings.getApplicationProperty("fanart.tv.apikey")); - public static final AcoustID AcoustID = new AcoustID(Settings.getApplicationProperty("acoustid.apikey")); + public static final FanartTVClient FanartTV = new FanartTVClient(Settings.getApplicationProperty("fanart.tv.apikey")); + public static final AcoustIDClient AcoustID = new AcoustIDClient(Settings.getApplicationProperty("acoustid.apikey")); public static EpisodeListProvider[] getEpisodeListProviders() { return new EpisodeListProvider[] { TheTVDB, AniDB, TVRage, Serienjunkies }; } public static MovieIdentificationService[] getMovieIdentificationServices() { - return new MovieIdentificationService[] { TMDb, IMDb, OpenSubtitles }; + return new MovieIdentificationService[] { TheMovieDB, IMDb, OpenSubtitles }; } public static SubtitleProvider[] getSubtitleProviders() { @@ -120,7 +120,7 @@ public final class WebServices { if (r instanceof TVRageSearchResult) return WebServices.TVRage; if (r instanceof Movie) - return WebServices.TMDb; + return WebServices.TheMovieDB; if (r instanceof AudioTrack) return WebServices.AcoustID; diff --git a/source/net/sourceforge/filebot/format/MediaBindingBean.java b/source/net/sourceforge/filebot/format/MediaBindingBean.java index 26423ca8..991bb85b 100644 --- a/source/net/sourceforge/filebot/format/MediaBindingBean.java +++ b/source/net/sourceforge/filebot/format/MediaBindingBean.java @@ -202,7 +202,7 @@ public class MediaBindingBean { @Define("primaryTitle") public String getPrimaryTitle() throws Exception { if (infoObject instanceof Movie) { - return WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getName(); + return WebServices.TheMovieDB.getMovieInfo(getMovie(), Locale.ENGLISH, false).getName(); } if (infoObject instanceof Episode) { @@ -228,7 +228,7 @@ public class MediaBindingBean { } // lookup IMDbID for TMDbID - tmdbid = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getId(); + tmdbid = WebServices.TheMovieDB.getMovieInfo(getMovie(), Locale.ENGLISH, false).getId(); } return String.valueOf(tmdbid); @@ -244,7 +244,7 @@ public class MediaBindingBean { } // lookup IMDbID for TMDbID - imdbid = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId(); + imdbid = WebServices.TheMovieDB.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId(); } return String.format("tt%07d", imdbid); @@ -515,7 +515,7 @@ public class MediaBindingBean { if (infoObject instanceof Episode) metaInfo = WebServices.TheTVDB.getSeriesInfoByName(((Episode) infoObject).getSeriesName(), Locale.ENGLISH); if (infoObject instanceof Movie) - metaInfo = WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, true); + metaInfo = WebServices.TheMovieDB.getMovieInfo(getMovie(), Locale.ENGLISH, true); } catch (Exception e) { throw new RuntimeException("Failed to retrieve metadata: " + infoObject, e); } @@ -534,7 +534,7 @@ public class MediaBindingBean { } if (infoObject instanceof Movie) { Movie m = getMovie(); - data = WebServices.IMDb.getImdbApiMovieInfo(m.getImdbId() > 0 ? m : new Movie(null, -1, WebServices.TMDb.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId(), -1)); + data = WebServices.IMDb.getImdbApiMovieInfo(m.getImdbId() > 0 ? m : new Movie(null, -1, WebServices.TheMovieDB.getMovieInfo(getMovie(), Locale.ENGLISH, false).getImdbId(), -1)); } } catch (Exception e) { throw new RuntimeException("Failed to retrieve metadata: " + infoObject, e); diff --git a/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java b/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java index 9b678679..0d879426 100644 --- a/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java +++ b/source/net/sourceforge/filebot/ui/subtitle/SubtitleUploadDialog.java @@ -700,7 +700,7 @@ public class SubtitleUploadDialog extends JDialog { Collection identity = MediaDetection.detectMovie(mapping.getVideo(), database, database, Locale.ENGLISH, true); for (Movie it : identity) { if (it.getImdbId() <= 0 && it.getTmdbId() > 0) { - it = WebServices.TMDb.getMovieDescriptor(it.getTmdbId(), Locale.ENGLISH, false); + it = WebServices.TheMovieDB.getMovieDescriptor(it.getTmdbId(), Locale.ENGLISH, false); } if (it != null && it.getImdbId() > 0) { mapping.setIdentity(it); diff --git a/source/net/sourceforge/filebot/web/AcoustID.java b/source/net/sourceforge/filebot/web/AcoustIDClient.java similarity index 97% rename from source/net/sourceforge/filebot/web/AcoustID.java rename to source/net/sourceforge/filebot/web/AcoustIDClient.java index 45c498ea..62e1b3a5 100644 --- a/source/net/sourceforge/filebot/web/AcoustID.java +++ b/source/net/sourceforge/filebot/web/AcoustIDClient.java @@ -28,13 +28,13 @@ import net.sourceforge.filebot.ResourceManager; import org.json.simple.parser.JSONParser; import org.json.simple.parser.ParseException; -public class AcoustID implements MusicIdentificationService { +public class AcoustIDClient implements MusicIdentificationService { private static final FloodLimit REQUEST_LIMIT = new FloodLimit(3, 1, TimeUnit.SECONDS); private String apikey; - public AcoustID(String apikey) { + public AcoustIDClient(String apikey) { this.apikey = apikey; } @@ -173,7 +173,7 @@ public class AcoustID implements MusicIdentificationService { try { processBuilder.redirectError(Redirect.INHERIT); } catch (Throwable e) { - Logger.getLogger(AcoustID.class.getName()).log(Level.WARNING, "Unable to inherit IO: " + e.getMessage()); + Logger.getLogger(AcoustIDClient.class.getName()).log(Level.WARNING, "Unable to inherit IO: " + e.getMessage()); } process = processBuilder.start(); } catch (Exception e) { diff --git a/source/net/sourceforge/filebot/web/FanartTV.java b/source/net/sourceforge/filebot/web/FanartTVClient.java similarity index 96% rename from source/net/sourceforge/filebot/web/FanartTV.java rename to source/net/sourceforge/filebot/web/FanartTVClient.java index f969ff6e..9a3f2d38 100644 --- a/source/net/sourceforge/filebot/web/FanartTV.java +++ b/source/net/sourceforge/filebot/web/FanartTVClient.java @@ -18,16 +18,16 @@ import java.util.Map; import net.sf.ehcache.Cache; import net.sf.ehcache.CacheManager; -import net.sourceforge.filebot.web.FanartTV.FanartDescriptor.FanartProperty; +import net.sourceforge.filebot.web.FanartTVClient.FanartDescriptor.FanartProperty; import org.w3c.dom.Document; import org.w3c.dom.Node; -public class FanartTV { +public class FanartTVClient { private String apikey; - public FanartTV(String apikey) { + public FanartTVClient(String apikey) { this.apikey = apikey; }