-Dnet.filebot.WebServices.TheMovieDB.adult=true
This commit is contained in:
parent
9a5ece76c6
commit
46562be17d
|
@ -18,6 +18,7 @@ import java.util.logging.Level;
|
||||||
|
|
||||||
import net.filebot.media.XattrMetaInfoProvider;
|
import net.filebot.media.XattrMetaInfoProvider;
|
||||||
import net.filebot.similarity.MetricAvg;
|
import net.filebot.similarity.MetricAvg;
|
||||||
|
import net.filebot.util.SystemProperty;
|
||||||
import net.filebot.web.AcoustIDClient;
|
import net.filebot.web.AcoustIDClient;
|
||||||
import net.filebot.web.AnidbClient;
|
import net.filebot.web.AnidbClient;
|
||||||
import net.filebot.web.Datasource;
|
import net.filebot.web.Datasource;
|
||||||
|
@ -48,7 +49,7 @@ public final class WebServices {
|
||||||
|
|
||||||
// movie sources
|
// movie sources
|
||||||
public static final OMDbClient OMDb = new OMDbClient();
|
public static final OMDbClient OMDb = new OMDbClient();
|
||||||
public static final TMDbClient TheMovieDB = new TMDbClient(getApiKey("themoviedb"));
|
public static final TMDbClient TheMovieDB = new TMDbClient(getApiKey("themoviedb"), SystemProperty.of("net.filebot.WebServices.TheMovieDB.adult", Boolean::parseBoolean, false).get());
|
||||||
|
|
||||||
// episode sources
|
// episode sources
|
||||||
public static final TVMazeClient TVmaze = new TVMazeClient();
|
public static final TVMazeClient TVmaze = new TVMazeClient();
|
||||||
|
|
|
@ -41,16 +41,18 @@ import net.filebot.ResourceManager;
|
||||||
|
|
||||||
public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
|
public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
|
||||||
|
|
||||||
private static final String host = "api.themoviedb.org";
|
|
||||||
private static final String version = "3";
|
|
||||||
|
|
||||||
// X-RateLimit: 40 requests per 10 seconds => https://developers.themoviedb.org/3/getting-started/request-rate-limiting
|
// X-RateLimit: 40 requests per 10 seconds => https://developers.themoviedb.org/3/getting-started/request-rate-limiting
|
||||||
private static final FloodLimit REQUEST_LIMIT = new FloodLimit(35, 10, TimeUnit.SECONDS);
|
private static final FloodLimit REQUEST_LIMIT = new FloodLimit(35, 10, TimeUnit.SECONDS);
|
||||||
|
|
||||||
private final String apikey;
|
private final String host = "api.themoviedb.org";
|
||||||
|
private final String version = "3";
|
||||||
|
|
||||||
public TMDbClient(String apikey) {
|
private String apikey;
|
||||||
|
private boolean adult;
|
||||||
|
|
||||||
|
public TMDbClient(String apikey, boolean adult) {
|
||||||
this.apikey = apikey;
|
this.apikey = apikey;
|
||||||
|
this.adult = adult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,6 +91,9 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
|
||||||
if (movieYear > 0) {
|
if (movieYear > 0) {
|
||||||
query.put("year", movieYear);
|
query.put("year", movieYear);
|
||||||
}
|
}
|
||||||
|
if (adult) {
|
||||||
|
query.put("include_adult", adult);
|
||||||
|
}
|
||||||
|
|
||||||
Object response = request("search/movie", query, locale);
|
Object response = request("search/movie", query, locale);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ import net.filebot.web.TMDbClient.MovieInfo;
|
||||||
|
|
||||||
public class TMDbClientTest {
|
public class TMDbClientTest {
|
||||||
|
|
||||||
static TMDbClient db = new TMDbClient("66308fb6e3fd850dde4c7d21df2e8306");
|
static TMDbClient db = new TMDbClient("66308fb6e3fd850dde4c7d21df2e8306", false);
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchByName() throws Exception {
|
public void searchByName() throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue