* refactor static field names for scripting

This commit is contained in:
Reinhard Pointner 2014-04-13 19:39:46 +00:00
parent 6bd298d478
commit db86aa5153
5 changed files with 19 additions and 19 deletions

View File

@ -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;

View File

@ -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);

View File

@ -700,7 +700,7 @@ public class SubtitleUploadDialog extends JDialog {
Collection<Movie> 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);

View File

@ -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) {

View File

@ -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;
}