Permalink
Browse files

Remove RottenTomatoes code

  • Loading branch information...
1 parent 87b0f8a commit c838d0ecc0ea761fa9e2db83b79068e4241937b2 @Omertron Omertron committed Nov 20, 2016
@@ -31,9 +31,6 @@ API_KEY_Allocine_Secret=29d185d98c984a359e6e6f26a0474269
# Temporary key
API_KEY_Allocine=aXBhZC12MQ
-# API Key for RottenTomatoes.com
-API_KEY_RottenTomatoes=rnt8xak564a8sxkts5xkqj5z
-
# API Key for SubBaba.com
API_KEY_SubBaba=9f0942674ca1387875c0e4cad608871d
@@ -212,15 +212,9 @@ mjb.dirHash=false
# filename = The base filename
mjb.sortTitle=title
-# Replace the ratings for movies with ones from RottenTomatoes
-mjb.enableRottenTomatoes=false
-
-# Comma separated list of the scores/ratings to use. The first one found will be used.
-mjb.rottentomatoes.priority=critics_score,audience_score,critics_rating,audience_rating
-
# Where should the main rating be from? Average will provide the average of all available ratings, or specify a source list of sites
-# Example: mjb.rating.source=imdb,rottentomatoes,average
-# This will search imdb, then rottentomatoes for a rating, if they aren't found use the average of any other ratings.
+# Example: mjb.rating.source=imdb,average
+# This will search imdb, if no ratings are found use the average of any other ratings.
# use the MovieDb setting from http://code.google.com/p/moviejukebox/wiki/Plugins
mjb.rating.source=average
Oops, something went wrong.
View
@@ -186,12 +186,6 @@
</dependency>
<dependency>
<groupId>com.omertron</groupId>
- <artifactId>rottentomatoesapi</artifactId>
- <version>1.6-SNAPSHOT</version>
- <type>jar</type>
- </dependency>
- <dependency>
- <groupId>com.omertron</groupId>
<artifactId>traileraddictapi</artifactId>
<version>1.6-SNAPSHOT</version>
<type>jar</type>
View
@@ -58,11 +58,6 @@
<dependency>
<groupId>com.omertron</groupId>
- <artifactId>rottentomatoesapi</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.omertron</groupId>
<artifactId>traileraddictapi</artifactId>
</dependency>
@@ -112,7 +112,6 @@
private static boolean bannerDownload;
private static boolean photoDownload;
private static boolean backdropDownload;
- private static boolean enableRottenTomatoes;
private final boolean setIndexFanart;
private static boolean skipIndexGeneration = Boolean.FALSE;
private static boolean skipHtmlGeneration = Boolean.FALSE;
@@ -734,7 +733,6 @@ private void generateLibrary() throws Throwable {
private final MovieImagePlugin backgroundPlugin = MovieJukebox.getBackgroundPlugin(getProperty("mjb.background.plugin", "com.moviejukebox.plugin.DefaultBackgroundPlugin"));
private final MediaInfoScanner miScanner = new MediaInfoScanner();
private final OpenSubtitlesPlugin subtitlePlugin = new OpenSubtitlesPlugin();
- private final RottenTomatoesPlugin rtPlugin = new RottenTomatoesPlugin();
private final TrailerScanner trailerScanner = new TrailerScanner();
// FANART.TV TV Artwork Scanners
private final ArtworkScanner clearArtScanner = new FanartTvScanner(ArtworkType.CLEARART);
@@ -765,7 +763,6 @@ protected ToolSet initialValue() {
videoimageDownload = PropertiesUtil.getBooleanProperty("mjb.includeVideoImages", Boolean.FALSE);
bannerDownload = PropertiesUtil.getBooleanProperty("mjb.includeWideBanners", Boolean.FALSE);
- enableRottenTomatoes = PropertiesUtil.getBooleanProperty("mjb.enableRottenTomatoes", Boolean.FALSE);
photoDownload = PropertiesUtil.getBooleanProperty("mjb.includePhoto", Boolean.FALSE);
backdropDownload = PropertiesUtil.getBooleanProperty("mjb.includeBackdrop", Boolean.FALSE);
boolean processExtras = PropertiesUtil.getBooleanProperty("filename.extras.process", Boolean.TRUE);
@@ -975,11 +972,6 @@ public Void call() throws FileNotFoundException, XMLStreamException {
// Get subtitle
tools.subtitlePlugin.generate(movie);
- // RottenTomatoes Ratings
- if (!movie.isTVShow() && enableRottenTomatoes) {
- tools.rtPlugin.scan(movie);
- }
-
// Get Trailers
if (trailersScannerEnable) {
tools.trailerScanner.getTrailers(movie);
@@ -587,28 +587,6 @@ private boolean updateKinopoiskMediaInfo(Movie movie, String kinopoiskId) {
LOG.error(SITE_DESIGN, "IMDB rating");
}
}
-
- valueFounded = false;
- for (String critics : HTMLTools.extractTags(xml, ">Рейтинг кинокритиков<", ">о рейтинге критиков<", "class=\"star\"><s></s", "</div")) {
- int plus = 0;
- int minus = 0;
- int kinopoiskCritics = StringTools.parseRating(critics);
-
- for (String tmp : HTMLTools.extractTags(xml, ">Рейтинг кинокритиков<", ">о рейтинге критиков<", "class=\"el1\"", "</span")) {
- plus = NumberUtils.toInt(tmp, 0);
- break;
- }
- for (String tmp : HTMLTools.extractTags(xml, ">Рейтинг кинокритиков<", ">о рейтинге критиков<", "class=\"el2\"", "</span")) {
- minus = NumberUtils.toInt(tmp, 0);
- break;
- }
- movie.addRating("rottentomatoes:" + plus + ":" + minus, kinopoiskCritics);
- valueFounded = true;
- break;
- }
- if (!valueFounded && etalonFlag) {
- LOG.error(SITE_DESIGN, "Critics rating");
- }
}
// Top250
@@ -1,145 +0,0 @@
-/*
- * Copyright (c) 2004-2016 YAMJ Members
- * https://github.com/orgs/YAMJ/people
- *
- * This file is part of the Yet Another Movie Jukebox (YAMJ) project.
- *
- * YAMJ is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * any later version.
- *
- * YAMJ is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with YAMJ. If not, see <http://www.gnu.org/licenses/>.
- *
- * Web: https://github.com/YAMJ/yamj-v2
- *
- */
-package com.moviejukebox.plugin;
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.math.NumberUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.moviejukebox.model.Movie;
-import com.moviejukebox.model.enumerations.DirtyFlag;
-import com.moviejukebox.tools.PropertiesUtil;
-import com.moviejukebox.tools.YamjHttpClientBuilder;
-import com.omertron.rottentomatoesapi.RottenTomatoesApi;
-import com.omertron.rottentomatoesapi.RottenTomatoesException;
-import com.omertron.rottentomatoesapi.model.RTMovie;
-
-/**
- * API for getting the ratings from RottenTomatoes.com
- *
- * @author stuart.boston
- *
- */
-public class RottenTomatoesPlugin {
-
- private static final Logger LOG = LoggerFactory.getLogger(RottenTomatoesPlugin.class);
- public static final String ROTTENTOMATOES_PLUGIN_ID = "rottentomatoes";
- private static final String API_KEY = PropertiesUtil.getProperty("API_KEY_RottenTomatoes");
- private static final String[] PRIORITY_LIST = PropertiesUtil.getProperty("mjb.rottentomatoes.priority", "critics_score,audience_score,critics_rating,audience_rating").split(",");
- private RottenTomatoesApi rt = null;
-
- public RottenTomatoesPlugin() {
- try {
- rt = new RottenTomatoesApi(API_KEY, YamjHttpClientBuilder.getHttpClient());
- } catch (RottenTomatoesException ex) {
- LOG.error("Failed to get RottenTomatoes API: {}", ex.getMessage(), ex);
- }
- }
-
- public boolean scan(Movie movie) {
- if (rt == null) {
- LOG.trace("Unable to initialise RT Plugin, no information retrieved.");
- return Boolean.FALSE;
- }
-
- if (!movie.isScrapeLibrary()) {
- return Boolean.FALSE;
- }
-
- if (movie.isTVShow()) {
- LOG.debug("{} is a TV Show, skipping.", movie.getBaseName());
- return Boolean.FALSE;
- }
-
- // If we have a rating already, skip unless we are rechecking.
- if (movie.getRating(ROTTENTOMATOES_PLUGIN_ID) >= 0 && !movie.isDirty(DirtyFlag.RECHECK)) {
- LOG.debug("{} already has a rating", movie.getBaseName());
- return Boolean.TRUE;
- }
-
- // We seem to have a valid movie, so let's scan
- return doScan(movie);
- }
-
- /**
- * Perform the scan through the RottenTomatoes API.
- *
- * @param movie
- * @return
- */
- private boolean doScan(Movie movie) {
- RTMovie rtMovie = null;
- int rtId = NumberUtils.toInt(movie.getId(ROTTENTOMATOES_PLUGIN_ID), 0);
-
- if (rtId == 0) {
- List<RTMovie> rtMovies;
- try {
- rtMovies = rt.getMoviesSearch(movie.getTitle());
- for (RTMovie tmpMovie : rtMovies) {
- if (movie.getTitle().equalsIgnoreCase(tmpMovie.getTitle()) && (movie.getYear().equals("" + tmpMovie.getYear()))) {
- rtId = tmpMovie.getId();
- rtMovie = tmpMovie;
- movie.setId(ROTTENTOMATOES_PLUGIN_ID, rtId);
- break;
- }
- }
- } catch (RottenTomatoesException ex) {
- LOG.warn("Failed to get RottenTomatoes information: {}", ex.getMessage());
- }
- } else {
- try {
- rtMovie = rt.getDetailedInfo(rtId);
- } catch (RottenTomatoesException ex) {
- LOG.warn("Failed to get RottenTomatoes information: {}", ex.getMessage());
- }
- }
-
- int ratingFound = 0;
-
- if (rtMovie != null) {
- Map<String, String> ratings = rtMovie.getRatings();
-
- for (String type : PRIORITY_LIST) {
- if (ratings.containsKey(type)) {
- if (StringUtils.isNumeric(ratings.get(type))) {
- ratingFound = Integer.parseInt(ratings.get(type));
- }
-
- if (ratingFound > 0) {
- LOG.debug("{} - {} found: {}", movie.getBaseName(), type, ratingFound);
- movie.addRating(ROTTENTOMATOES_PLUGIN_ID, ratingFound);
- break;
- }
- }
- }
-
- return Boolean.TRUE;
- }
- LOG.debug("No RottenTomatoes information found for {}", movie.getBaseName());
- return Boolean.FALSE;
- }
-}
@@ -150,7 +150,6 @@ public static boolean validateInstallation() {
jarsToCheck.put("allocine-api", new ArrayList<String>());
jarsToCheck.put("fanarttvapi", new ArrayList<String>());
jarsToCheck.put("mjbsqldb", new ArrayList<String>());
- jarsToCheck.put("rottentomatoesapi", new ArrayList<String>());
jarsToCheck.put("subbabaapi", new ArrayList<String>());
jarsToCheck.put("themoviedbapi", new ArrayList<String>());
jarsToCheck.put("thetvdbapi", new ArrayList<String>());

0 comments on commit c838d0e

Please sign in to comment.