Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 34b337aecd | |||
| 3155555d7a | |||
| 92c6de7426 | |||
| 252a6abab2 | |||
| 07b06455cf | |||
| c02ae50bff | |||
| bf132d7c72 | |||
| 9667a34a01 | |||
| efeae0de0b | |||
| 963dceb6bd | |||
| 695077a1d7 | |||
| 2de5728b3a | |||
| 6733bb6191 | |||
| 71178f21cd | |||
| a0a6a62dbe | |||
| 119a51c8e8 | |||
| 240110848a | |||
| 4f89f03b7f | |||
| 33daddb40e | |||
| 4203dc55a5 | |||
| 998eb06b69 | |||
| 71fa47b48f | |||
| 67bb8d21bd | |||
| d6542d0676 | |||
| 02b03c5c58 | |||
| eb9e9930e1 | |||
| dd82c0d906 | |||
| e184077f9d | |||
| a7a099ac0c | |||
| 3a1251777e | |||
| 8a3af38b0c | |||
| 3104588272 | |||
| 95ff0f0119 | |||
| c3bd8efbf9 | |||
| 09a3fb5ffe | |||
| ce06aacec9 | |||
| ec9c4dd45c | |||
| 0940c7ac38 | |||
| ca9f3248b7 | |||
| b91dac2c9d | |||
| c5a1a85a2a | |||
| 9ab81018dd | |||
| 6eec791933 | |||
| 74fac5636a |
@@ -13,3 +13,5 @@ testing.properties
|
|||||||
.project
|
.project
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/nbproject/
|
/nbproject/
|
||||||
|
.idea
|
||||||
|
*.iml
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.omertron</groupId>
|
<groupId>com.omertron</groupId>
|
||||||
<artifactId>themoviedbapi</artifactId>
|
<artifactId>themoviedbapi</artifactId>
|
||||||
<version>4.3</version>
|
<version>4.4-SNAPSHOT</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>API-The MovieDB</name>
|
<name>API-The MovieDB</name>
|
||||||
@@ -71,12 +71,14 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<distribution.format>zip</distribution.format>
|
<distribution.format>zip</distribution.format>
|
||||||
<version.jackson>2.7.1</version.jackson>
|
<version.jackson>2.10.0</version.jackson>
|
||||||
<version.slf4j>1.7.16</version.slf4j>
|
<version.slf4j>1.7.25</version.slf4j>
|
||||||
<maven.compiler.source>1.7</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.7</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<timestamp>${maven.build.timestamp}</timestamp>
|
<timestamp>${maven.build.timestamp}</timestamp>
|
||||||
<maven.build.timestamp.format>yyyy-MM-dd-HHmm</maven.build.timestamp.format>
|
<maven.build.timestamp.format>yyyy-MM-dd-HHmm</maven.build.timestamp.format>
|
||||||
|
<!--Turn off javadoc errors-->
|
||||||
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -84,7 +86,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.12</version>
|
<version>4.13.1</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!--JSON-->
|
<!--JSON-->
|
||||||
@@ -119,23 +121,32 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.yamj</groupId>
|
<groupId>org.yamj</groupId>
|
||||||
<artifactId>api-common</artifactId>
|
<artifactId>api-common</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- Apache Utils -->
|
<!-- Apache Utils -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
<version>3.4</version>
|
<version>3.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.6</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<profiles>
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>disable-java8-doclint</id>
|
||||||
|
<activation>
|
||||||
|
<jdk>[1.8,)</jdk>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<additionalparam>-Xdoclint:none</additionalparam>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
<profile>
|
<profile>
|
||||||
<id>release-sign-artifacts</id>
|
<id>release-sign-artifacts</id>
|
||||||
<activation>
|
<activation>
|
||||||
@@ -181,7 +192,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>2.6</version>
|
<version>3.1.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -191,7 +202,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.7.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
@@ -211,27 +222,27 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.6</version>
|
<version>3.0.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>3.0.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>3.5</version>
|
<version>3.7</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.19.1</version>
|
<version>2.21.0</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<groupId>pl.project13.maven</groupId>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
<version>2.2.0</version>
|
<version>2.2.4</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</pluginManagement>
|
</pluginManagement>
|
||||||
@@ -343,12 +354,12 @@
|
|||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>1.9.5</version>
|
||||||
</extension>
|
</extension>
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-manager-plexus</artifactId>
|
<artifactId>maven-scm-manager-plexus</artifactId>
|
||||||
<version>1.9.4</version>
|
<version>1.9.5</version>
|
||||||
</extension>
|
</extension>
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
|
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class AppendToResponseBuilder {
|
|||||||
/**
|
/**
|
||||||
* Construct the builder with the first method
|
* Construct the builder with the first method
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method method
|
||||||
*/
|
*/
|
||||||
public AppendToResponseBuilder(AppendToResponseMethod method) {
|
public AppendToResponseBuilder(AppendToResponseMethod method) {
|
||||||
response = new StringBuilder(method.getPropertyString());
|
response = new StringBuilder(method.getPropertyString());
|
||||||
@@ -42,7 +42,7 @@ public class AppendToResponseBuilder {
|
|||||||
/**
|
/**
|
||||||
* Generate the string
|
* Generate the string
|
||||||
*
|
*
|
||||||
* @return
|
* @return ATR string
|
||||||
*/
|
*/
|
||||||
public String build() {
|
public String build() {
|
||||||
return response.toString();
|
return response.toString();
|
||||||
@@ -51,8 +51,8 @@ public class AppendToResponseBuilder {
|
|||||||
/**
|
/**
|
||||||
* Add a method to the list
|
* Add a method to the list
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method method
|
||||||
* @return
|
* @return builder
|
||||||
*/
|
*/
|
||||||
public AppendToResponseBuilder add(AppendToResponseMethod method) {
|
public AppendToResponseBuilder add(AppendToResponseMethod method) {
|
||||||
response.append(",").append(method.getPropertyString());
|
response.append(",").append(method.getPropertyString());
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public class Compare {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the MovieDB object with a title & year
|
* Compare the MovieDB object with a title and year
|
||||||
*
|
*
|
||||||
* @param moviedb The moviedb object to compare too
|
* @param moviedb The moviedb object to compare too
|
||||||
* @param title The title of the movie to compare
|
* @param title The title of the movie to compare
|
||||||
@@ -51,7 +51,7 @@ public class Compare {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the MovieDB object with a title & year
|
* Compare the MovieDB object with a title and year
|
||||||
*
|
*
|
||||||
* @param moviedb The moviedb object to compare too
|
* @param moviedb The moviedb object to compare too
|
||||||
* @param title The title of the movie to compare
|
* @param title The title of the movie to compare
|
||||||
@@ -107,13 +107,13 @@ public class Compare {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compare the MovieDB object with a title & year, case sensitive
|
* Compare the MovieDB object with a title and year, case sensitive
|
||||||
*
|
*
|
||||||
* @param moviedb
|
* @param moviedb movieinfo
|
||||||
* @param title
|
* @param title title
|
||||||
* @param year
|
* @param year year
|
||||||
* @param maxDistance
|
* @param maxDistance maximum distance
|
||||||
* @return
|
* @return true if matched
|
||||||
*/
|
*/
|
||||||
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) {
|
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) {
|
||||||
return Compare.movies(moviedb, title, year, maxDistance, true);
|
return Compare.movies(moviedb, title, year, maxDistance, true);
|
||||||
@@ -122,9 +122,9 @@ public class Compare {
|
|||||||
/**
|
/**
|
||||||
* Compare the Levenshtein Distance between the two strings
|
* Compare the Levenshtein Distance between the two strings
|
||||||
*
|
*
|
||||||
* @param title1
|
* @param title1 title
|
||||||
* @param title2
|
* @param title2 title
|
||||||
* @param distance
|
* @param distance max distance
|
||||||
*/
|
*/
|
||||||
private static boolean compareDistance(final String title1, final String title2, int distance) {
|
private static boolean compareDistance(final String title1, final String title2, int distance) {
|
||||||
return StringUtils.getLevenshteinDistance(title1, title2) <= distance;
|
return StringUtils.getLevenshteinDistance(title1, title2) <= distance;
|
||||||
@@ -133,7 +133,7 @@ public class Compare {
|
|||||||
/**
|
/**
|
||||||
* Check the year is not blank or UNKNOWN
|
* Check the year is not blank or UNKNOWN
|
||||||
*
|
*
|
||||||
* @param year
|
* @param year year
|
||||||
*/
|
*/
|
||||||
private static boolean isValidYear(final String year) {
|
private static boolean isValidYear(final String year) {
|
||||||
return StringUtils.isNotBlank(year) && !"UNKNOWN".equals(year);
|
return StringUtils.isNotBlank(year) && !"UNKNOWN".equals(year);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -46,8 +46,8 @@ public enum ArtworkType {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param artworkType
|
* @param artworkType String to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
* @throws IllegalArgumentException If type is not recognised
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.enumeration;
|
package com.omertron.themoviedbapi.enumeration;
|
||||||
|
|
||||||
public enum Gender {
|
public enum Gender {
|
||||||
MALE(1),
|
MALE(2),
|
||||||
FEMALE(2),
|
FEMALE(1),
|
||||||
UNKNOWN(0);
|
UNKNOWN(0);
|
||||||
|
|
||||||
private final int type;
|
private final int type;
|
||||||
@@ -33,8 +33,8 @@ public enum Gender {
|
|||||||
/**
|
/**
|
||||||
* Get the gender from an integer type
|
* Get the gender from an integer type
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type Integer to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
*/
|
*/
|
||||||
public static Gender fromInteger(int type) {
|
public static Gender fromInteger(int type) {
|
||||||
for (Gender gender : Gender.values()) {
|
for (Gender gender : Gender.values()) {
|
||||||
|
|||||||
@@ -36,6 +36,10 @@ public enum MediaType {
|
|||||||
* TV Show media type
|
* TV Show media type
|
||||||
*/
|
*/
|
||||||
TV,
|
TV,
|
||||||
|
/**
|
||||||
|
* TV Season media type
|
||||||
|
*/
|
||||||
|
SEASON,
|
||||||
/**
|
/**
|
||||||
* TV Episode media type
|
* TV Episode media type
|
||||||
*/
|
*/
|
||||||
@@ -44,8 +48,8 @@ public enum MediaType {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param mediaType
|
* @param mediaType String to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
* @throws IllegalArgumentException If type is not recognised
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public enum MovieMethod implements AppendToResponseMethod {
|
|||||||
IMAGES,
|
IMAGES,
|
||||||
KEYWORDS,
|
KEYWORDS,
|
||||||
LISTS,
|
LISTS,
|
||||||
|
RECOMMENDATIONS,
|
||||||
RELEASES,
|
RELEASES,
|
||||||
REVIEWS,
|
REVIEWS,
|
||||||
SIMILAR,
|
SIMILAR,
|
||||||
@@ -44,7 +45,7 @@ public enum MovieMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Get the string to use in the URL
|
* Get the string to use in the URL
|
||||||
*
|
*
|
||||||
* @return
|
* @return the string representation of the enum
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getPropertyString() {
|
public String getPropertyString() {
|
||||||
@@ -54,8 +55,8 @@ public enum MovieMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method String to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
* @throws IllegalArgumentException If type is not recognised
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public enum PeopleMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Get the string to use in the URL
|
* Get the string to use in the URL
|
||||||
*
|
*
|
||||||
* @return
|
* @return the string representation of the enum
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getPropertyString() {
|
public String getPropertyString() {
|
||||||
@@ -50,8 +50,8 @@ public enum PeopleMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method String to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
* @throws IllegalArgumentException If type is not recognised
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ public enum ReleaseType {
|
|||||||
/**
|
/**
|
||||||
* Get the Release Type from an integer type
|
* Get the Release Type from an integer type
|
||||||
*
|
*
|
||||||
* @param type
|
* @param type Integer to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
*/
|
*/
|
||||||
public static ReleaseType fromInteger(int type) {
|
public static ReleaseType fromInteger(int type) {
|
||||||
for (ReleaseType rt : ReleaseType.values()) {
|
for (ReleaseType rt : ReleaseType.values()) {
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public enum TVEpisodeMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Get the string to use in the URL
|
* Get the string to use in the URL
|
||||||
*
|
*
|
||||||
* @return
|
* @return the string representation of the enum
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getPropertyString() {
|
public String getPropertyString() {
|
||||||
@@ -47,8 +47,8 @@ public enum TVEpisodeMethod implements AppendToResponseMethod {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param method
|
* @param method String to convert to enum
|
||||||
* @return
|
* @return enum version of param
|
||||||
* @throws IllegalArgumentException If type is not recognised
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ import com.omertron.themoviedbapi.tools.TmdbParameters;
|
|||||||
import com.omertron.themoviedbapi.results.WrapperChanges;
|
import com.omertron.themoviedbapi.results.WrapperChanges;
|
||||||
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -68,7 +69,7 @@ public class AbstractMethod {
|
|||||||
protected final HttpTools httpTools;
|
protected final HttpTools httpTools;
|
||||||
// Jackson JSON configuration
|
// Jackson JSON configuration
|
||||||
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<>();
|
private static final Map<Class<? extends Serializable>, TypeReference<? extends WrapperGenericList<? extends Serializable>>> TYPE_REFS = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
TYPE_REFS.put(MovieBasic.class, new TypeReference<WrapperGenericList<MovieBasic>>() {
|
TYPE_REFS.put(MovieBasic.class, new TypeReference<WrapperGenericList<MovieBasic>>() {
|
||||||
@@ -124,9 +125,9 @@ public class AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
protected static TypeReference getTypeReference(Class aClass) throws MovieDbException {
|
protected static <T> TypeReference<? extends WrapperGenericList<T>> getTypeReference(Class<T> aClass) throws MovieDbException {
|
||||||
if (TYPE_REFS.containsKey(aClass)) {
|
if (TYPE_REFS.containsKey(aClass)) {
|
||||||
return TYPE_REFS.get(aClass);
|
return (TypeReference<? extends WrapperGenericList<T>>) TYPE_REFS.get(aClass);
|
||||||
} else {
|
} else {
|
||||||
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
|
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
|
||||||
}
|
}
|
||||||
@@ -142,7 +143,7 @@ public class AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
protected <T> List<T> processWrapperList(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
protected <T> List<T> processWrapperList(TypeReference<? extends WrapperGenericList<T>> typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
||||||
WrapperGenericList<T> val = processWrapper(typeRef, url, errorMessageSuffix);
|
WrapperGenericList<T> val = processWrapper(typeRef, url, errorMessageSuffix);
|
||||||
return val.getResults();
|
return val.getResults();
|
||||||
}
|
}
|
||||||
@@ -157,7 +158,7 @@ public class AbstractMethod {
|
|||||||
* @return
|
* @return
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
protected <T> WrapperGenericList<T> processWrapper(TypeReference<? extends WrapperGenericList<T>> typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
||||||
String webpage = httpTools.getRequest(url);
|
String webpage = httpTools.getRequest(url);
|
||||||
try {
|
try {
|
||||||
// Due to type erasure, this doesn't work
|
// Due to type erasure, this doesn't work
|
||||||
|
|||||||
@@ -262,6 +262,24 @@ public class TmdbMovies extends AbstractMethod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The recommendations method will let you retrieve the movie recommendations for a particular movie.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getRecommendations(int movieId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RECOMMENDATIONS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "recommendations");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to retrieve all of the release and certification data we have for a specific movie.
|
* This method is used to retrieve all of the release and certification data we have for a specific movie.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ public class TmdbPeople extends AbstractMethod {
|
|||||||
String webpage = httpTools.getRequest(url);
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TypeReference tr = new TypeReference<PersonCreditList<CreditMovieBasic>>() {
|
TypeReference<PersonCreditList<CreditMovieBasic>> tr = new TypeReference<PersonCreditList<CreditMovieBasic>>() {
|
||||||
};
|
};
|
||||||
return MAPPER.readValue(webpage, tr);
|
return MAPPER.readValue(webpage, tr);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@@ -144,7 +144,7 @@ public class TmdbPeople extends AbstractMethod {
|
|||||||
String webpage = httpTools.getRequest(url);
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
TypeReference tr = new TypeReference<PersonCreditList<CreditTVBasic>>() {
|
TypeReference<PersonCreditList<CreditTVBasic>> tr = new TypeReference<PersonCreditList<CreditTVBasic>>() {
|
||||||
};
|
};
|
||||||
return MAPPER.readValue(webpage, tr);
|
return MAPPER.readValue(webpage, tr);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
@@ -177,7 +177,7 @@ public class TmdbPeople extends AbstractMethod {
|
|||||||
try {
|
try {
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
mapper.addMixIn(PersonCreditList.class, PersonCreditsMixIn.class);
|
mapper.addMixIn(PersonCreditList.class, PersonCreditsMixIn.class);
|
||||||
TypeReference tr = new TypeReference<PersonCreditList<CreditBasic>>() {
|
TypeReference<PersonCreditList<CreditBasic>> tr = new TypeReference<PersonCreditList<CreditBasic>>() {
|
||||||
};
|
};
|
||||||
return mapper.readValue(webpage, tr);
|
return mapper.readValue(webpage, tr);
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
|||||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||||
import com.omertron.themoviedbapi.model.company.Company;
|
import com.omertron.themoviedbapi.model.company.Company;
|
||||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
import com.omertron.themoviedbapi.model.list.UserList;
|
|
||||||
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
import com.omertron.themoviedbapi.model.person.PersonFind;
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
@@ -121,26 +120,6 @@ public class TmdbSearch extends AbstractMethod {
|
|||||||
return wrapper.getResultsList();
|
return wrapper.getResultsList();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Search for lists by name and description.
|
|
||||||
*
|
|
||||||
* @param query
|
|
||||||
* @param includeAdult
|
|
||||||
* @param page
|
|
||||||
* @return
|
|
||||||
* @throws MovieDbException
|
|
||||||
*/
|
|
||||||
public ResultList<UserList> searchList(String query, Integer page, Boolean includeAdult) throws MovieDbException {
|
|
||||||
TmdbParameters parameters = new TmdbParameters();
|
|
||||||
parameters.add(Param.QUERY, query);
|
|
||||||
parameters.add(Param.PAGE, page);
|
|
||||||
parameters.add(Param.INCLUDE_ADULT, includeAdult);
|
|
||||||
|
|
||||||
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.LIST).buildUrl(parameters);
|
|
||||||
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "list");
|
|
||||||
return wrapper.getResultsList();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Search Movies This is a good starting point to start finding movies on TMDb.
|
* Search Movies This is a good starting point to start finding movies on TMDb.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class Company extends AbstractJsonMapping implements Serializable, Identi
|
|||||||
private String logoPath = EMPTY;
|
private String logoPath = EMPTY;
|
||||||
@JsonProperty("parent_company")
|
@JsonProperty("parent_company")
|
||||||
private Company parentCompany = null;
|
private Company parentCompany = null;
|
||||||
|
@JsonProperty("origin_country")
|
||||||
|
private String originCountry;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -114,4 +116,13 @@ public class Company extends AbstractJsonMapping implements Serializable, Identi
|
|||||||
parent.setLogoPath(logoPath);
|
parent.setLogoPath(logoPath);
|
||||||
this.parentCompany = parent;
|
this.parentCompany = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOriginCountry() {
|
||||||
|
return originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginCountry(String originCountry) {
|
||||||
|
this.originCountry = originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ public class JobDepartment extends AbstractJsonMapping implements Serializable {
|
|||||||
// Properties
|
// Properties
|
||||||
@JsonProperty("department")
|
@JsonProperty("department")
|
||||||
private String department;
|
private String department;
|
||||||
@JsonProperty("job_list")
|
@JsonProperty("jobs")
|
||||||
private List<String> jobs;
|
private List<String> jobs;
|
||||||
|
|
||||||
public String getDepartment() {
|
public String getDepartment() {
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import com.omertron.themoviedbapi.enumeration.MediaType;
|
|||||||
import com.omertron.themoviedbapi.interfaces.Identification;
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
@@ -44,6 +45,20 @@ public class CreditBasic extends AbstractJsonMapping implements Serializable, Id
|
|||||||
private int id;
|
private int id;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String artworkPath;
|
private String artworkPath;
|
||||||
|
@JsonProperty("backdrop_path")
|
||||||
|
private String backdropPath;
|
||||||
|
@JsonProperty("genre_ids")
|
||||||
|
private List<Integer> genreIds;
|
||||||
|
@JsonProperty("original_language")
|
||||||
|
private String originalLanguage;
|
||||||
|
@JsonProperty("overview")
|
||||||
|
private String overview;
|
||||||
|
@JsonProperty("popularity")
|
||||||
|
private float popularity;
|
||||||
|
@JsonProperty("vote_average")
|
||||||
|
private float voteAverage;
|
||||||
|
@JsonProperty("vote_count")
|
||||||
|
private int voteCount;
|
||||||
|
|
||||||
//cast
|
//cast
|
||||||
@JsonProperty("character")
|
@JsonProperty("character")
|
||||||
@@ -71,7 +86,7 @@ public class CreditBasic extends AbstractJsonMapping implements Serializable, Id
|
|||||||
this.mediaType = MediaType.fromString(mediaType);
|
this.mediaType = MediaType.fromString(mediaType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setMediaType(MediaType mediaType) {
|
public final void setMediaType(MediaType mediaType) {
|
||||||
this.mediaType = mediaType;
|
this.mediaType = mediaType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,4 +143,60 @@ public class CreditBasic extends AbstractJsonMapping implements Serializable, Id
|
|||||||
setCreditType(CreditType.CREW);
|
setCreditType(CreditType.CREW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getBackdropPath() {
|
||||||
|
return backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackdropPath(String backdropPath) {
|
||||||
|
this.backdropPath = backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getGenreIds() {
|
||||||
|
return genreIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGenreIds(List<Integer> genreIds) {
|
||||||
|
this.genreIds = genreIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalLanguage() {
|
||||||
|
return originalLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalLanguage(String originalLanguage) {
|
||||||
|
this.originalLanguage = originalLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOverview() {
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverview(String overview) {
|
||||||
|
this.overview = overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getPopularity() {
|
||||||
|
return popularity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPopularity(float popularity) {
|
||||||
|
this.popularity = popularity;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getVoteAverage() {
|
||||||
|
return voteAverage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoteAverage(float voteAverage) {
|
||||||
|
this.voteAverage = voteAverage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVoteCount() {
|
||||||
|
return voteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoteCount(int voteCount) {
|
||||||
|
this.voteCount = voteCount;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ public class CreditMovieBasic extends CreditBasic implements Serializable {
|
|||||||
private String releaseDate;
|
private String releaseDate;
|
||||||
@JsonProperty("title")
|
@JsonProperty("title")
|
||||||
private String title;
|
private String title;
|
||||||
|
@JsonProperty("video")
|
||||||
|
private boolean video;
|
||||||
|
|
||||||
public CreditMovieBasic() {
|
public CreditMovieBasic() {
|
||||||
setMediaType(MediaType.MOVIE);
|
setMediaType(MediaType.MOVIE);
|
||||||
@@ -75,4 +77,12 @@ public class CreditMovieBasic extends CreditBasic implements Serializable {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isVideo() {
|
||||||
|
return video;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideo(boolean video) {
|
||||||
|
this.video = video;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ public class CreditTVBasic extends CreditBasic implements Serializable {
|
|||||||
private String name;
|
private String name;
|
||||||
@JsonProperty("original_name")
|
@JsonProperty("original_name")
|
||||||
private String originalName;
|
private String originalName;
|
||||||
|
@JsonProperty("origin_country")
|
||||||
|
private String originCountry;
|
||||||
|
|
||||||
public CreditTVBasic() {
|
public CreditTVBasic() {
|
||||||
setMediaType(MediaType.TV);
|
setMediaType(MediaType.TV);
|
||||||
@@ -75,4 +77,12 @@ public class CreditTVBasic extends CreditBasic implements Serializable {
|
|||||||
this.originalName = originalName;
|
this.originalName = originalName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOriginCountry() {
|
||||||
|
return originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginCountry(String originCountry) {
|
||||||
|
this.originCountry = originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ public class MediaCredit extends AbstractJsonMapping implements Serializable, Id
|
|||||||
private String artworkPath;
|
private String artworkPath;
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
@JsonProperty("gender")
|
||||||
|
private int gender;
|
||||||
|
|
||||||
public String getCreditId() {
|
public String getCreditId() {
|
||||||
return creditId;
|
return creditId;
|
||||||
@@ -75,4 +77,12 @@ public class MediaCredit extends AbstractJsonMapping implements Serializable, Id
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -137,6 +137,33 @@ public class Discover {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary minimum release to include.
|
||||||
|
* <p>
|
||||||
|
* Expected format is YYYY-MM-DD.
|
||||||
|
*
|
||||||
|
* @param primaryReleaseDateGte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover primaryReleaseDateGte(String primaryReleaseDateGte) {
|
||||||
|
params.add(Param.PRIMARY_RELEASE_DATE_GTE, primaryReleaseDateGte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary maximum release to include.
|
||||||
|
* <p>
|
||||||
|
* Expected format is YYYY-MM-DD.
|
||||||
|
*
|
||||||
|
* @param primaryReleaseDateLte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover primaryReleaseDateLte(String primaryReleaseDateLte) {
|
||||||
|
params.add(Param.PRIMARY_RELEASE_DATE_LTE, primaryReleaseDateLte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only include movies that are equal to, or have a vote count higher than this value
|
* Only include movies that are equal to, or have a vote count higher than this value
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ public class ListStatusCode extends StatusCode {
|
|||||||
|
|
||||||
@JsonProperty("list_id")
|
@JsonProperty("list_id")
|
||||||
private String listId;
|
private String listId;
|
||||||
|
@JsonProperty("success")
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
public String getListId() {
|
public String getListId() {
|
||||||
return listId;
|
return listId;
|
||||||
@@ -34,4 +36,13 @@ public class ListStatusCode extends StatusCode {
|
|||||||
public void setListId(String listId) {
|
public void setListId(String listId) {
|
||||||
this.listId = listId;
|
this.listId = listId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isSuccess() {
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSuccess(boolean success) {
|
||||||
|
this.success = success;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class AlternativeTitle implements Serializable {
|
|||||||
private String country;
|
private String country;
|
||||||
@JsonProperty("title")
|
@JsonProperty("title")
|
||||||
private String title;
|
private String title;
|
||||||
|
@JsonProperty("type")
|
||||||
|
private String type;
|
||||||
|
|
||||||
public String getCountry() {
|
public String getCountry() {
|
||||||
return country;
|
return country;
|
||||||
@@ -52,6 +54,14 @@ public class AlternativeTitle implements Serializable {
|
|||||||
this.title = title;
|
this.title = title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj instanceof AlternativeTitle) {
|
if (obj instanceof AlternativeTitle) {
|
||||||
@@ -59,6 +69,7 @@ public class AlternativeTitle implements Serializable {
|
|||||||
return new EqualsBuilder()
|
return new EqualsBuilder()
|
||||||
.append(country, other.country)
|
.append(country, other.country)
|
||||||
.append(title, other.title)
|
.append(title, other.title)
|
||||||
|
.append(type, other.type)
|
||||||
.isEquals();
|
.isEquals();
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
@@ -70,6 +81,7 @@ public class AlternativeTitle implements Serializable {
|
|||||||
return new HashCodeBuilder()
|
return new HashCodeBuilder()
|
||||||
.append(country)
|
.append(country)
|
||||||
.append(title)
|
.append(title)
|
||||||
|
.append(type)
|
||||||
.toHashCode();
|
.toHashCode();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,6 +94,7 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
|
|||||||
private List<Video> videos = Collections.emptyList();
|
private List<Video> videos = Collections.emptyList();
|
||||||
private List<Translation> translations = Collections.emptyList();
|
private List<Translation> translations = Collections.emptyList();
|
||||||
private List<MovieInfo> similarMovies = Collections.emptyList();
|
private List<MovieInfo> similarMovies = Collections.emptyList();
|
||||||
|
private List<MovieInfo> recommendations = Collections.emptyList();
|
||||||
private List<Review> reviews = Collections.emptyList();
|
private List<Review> reviews = Collections.emptyList();
|
||||||
private List<UserList> lists = Collections.emptyList();
|
private List<UserList> lists = Collections.emptyList();
|
||||||
private List<ChangeKeyItem> changes = Collections.emptyList();
|
private List<ChangeKeyItem> changes = Collections.emptyList();
|
||||||
@@ -295,6 +296,12 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
|
|||||||
addMethod(MovieMethod.LISTS);
|
addMethod(MovieMethod.LISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonSetter("recommendations")
|
||||||
|
public void seRecommendations(WrapperGenericList<MovieInfo> recommendations) {
|
||||||
|
this.recommendations = recommendations.getResults();
|
||||||
|
addMethod(MovieMethod.RECOMMENDATIONS);
|
||||||
|
}
|
||||||
|
|
||||||
@JsonSetter("reviews")
|
@JsonSetter("reviews")
|
||||||
public void setReviews(WrapperGenericList<Review> reviews) {
|
public void setReviews(WrapperGenericList<Review> reviews) {
|
||||||
this.reviews = reviews.getResults();
|
this.reviews = reviews.getResults();
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model.movie;
|
package com.omertron.themoviedbapi.model.movie;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
import com.omertron.themoviedbapi.model.AbstractIdName;
|
import com.omertron.themoviedbapi.model.AbstractIdName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -30,5 +31,25 @@ import java.io.Serializable;
|
|||||||
public class ProductionCompany extends AbstractIdName implements Serializable {
|
public class ProductionCompany extends AbstractIdName implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 100L;
|
private static final long serialVersionUID = 100L;
|
||||||
// Nothing to override from the base class.
|
@JsonProperty("logo_path")
|
||||||
|
private String logoPath;
|
||||||
|
@JsonProperty("origin_country")
|
||||||
|
private String originCountry;
|
||||||
|
|
||||||
|
public String getLogoPath() {
|
||||||
|
return logoPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogoPath(String logoPath) {
|
||||||
|
this.logoPath = logoPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginCountry() {
|
||||||
|
return originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginCountry(String originCountry) {
|
||||||
|
this.originCountry = originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model.network;
|
package com.omertron.themoviedbapi.model.network;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.omertron.themoviedbapi.interfaces.Identification;
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
import com.omertron.themoviedbapi.model.AbstractIdName;
|
import com.omertron.themoviedbapi.model.AbstractIdName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -30,5 +31,45 @@ public class Network extends AbstractIdName implements Serializable, Identificat
|
|||||||
|
|
||||||
private static final long serialVersionUID = 100L;
|
private static final long serialVersionUID = 100L;
|
||||||
// Nothing to add to base class
|
// Nothing to add to base class
|
||||||
|
@JsonProperty("headquarters")
|
||||||
|
private String headquarters;
|
||||||
|
@JsonProperty("homepage")
|
||||||
|
private String homepage;
|
||||||
|
@JsonProperty("origin_country")
|
||||||
|
private String originCountry;
|
||||||
|
@JsonProperty("logo_path")
|
||||||
|
private String logoPath;
|
||||||
|
|
||||||
|
public String getHeadquarters() {
|
||||||
|
return headquarters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeadquarters(String headquarters) {
|
||||||
|
this.headquarters = headquarters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHomepage() {
|
||||||
|
return homepage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHomepage(String homepage) {
|
||||||
|
this.homepage = homepage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginCountry() {
|
||||||
|
return originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginCountry(String originCountry) {
|
||||||
|
this.originCountry = originCountry;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLogoPath() {
|
||||||
|
return logoPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLogoPath(String logoPath) {
|
||||||
|
this.logoPath = logoPath;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public class ExternalID extends AbstractJsonMapping implements Serializable, Ide
|
|||||||
private String facebookId;
|
private String facebookId;
|
||||||
@JsonProperty("twitter_id")
|
@JsonProperty("twitter_id")
|
||||||
private String twitterId;
|
private String twitterId;
|
||||||
|
@JsonProperty("instagram_id")
|
||||||
|
private String instagramId;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -115,4 +117,12 @@ public class ExternalID extends AbstractJsonMapping implements Serializable, Ide
|
|||||||
this.twitterId = twitterId;
|
this.twitterId = twitterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getInstagramId() {
|
||||||
|
return instagramId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInstagramId(String instagramId) {
|
||||||
|
this.instagramId = instagramId;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,8 @@
|
|||||||
package com.omertron.themoviedbapi.model.person;
|
package com.omertron.themoviedbapi.model.person;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.Gender;
|
||||||
import com.omertron.themoviedbapi.model.AbstractIdName;
|
import com.omertron.themoviedbapi.model.AbstractIdName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@@ -32,6 +34,8 @@ public class PersonBasic extends AbstractIdName implements Serializable {
|
|||||||
|
|
||||||
@JsonProperty("profile_path")
|
@JsonProperty("profile_path")
|
||||||
private String profilePath;
|
private String profilePath;
|
||||||
|
@JsonProperty("gender")
|
||||||
|
private Gender gender;
|
||||||
|
|
||||||
public String getProfilePath() {
|
public String getProfilePath() {
|
||||||
return profilePath;
|
return profilePath;
|
||||||
@@ -40,4 +44,18 @@ public class PersonBasic extends AbstractIdName implements Serializable {
|
|||||||
public void setProfilePath(String profilePath) {
|
public void setProfilePath(String profilePath) {
|
||||||
this.profilePath = profilePath;
|
this.profilePath = profilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Gender getGender() {
|
||||||
|
return gender;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("gender")
|
||||||
|
public void setGender(int gender) {
|
||||||
|
this.gender = Gender.fromInteger(gender);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGender(Gender gender) {
|
||||||
|
this.gender = gender;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ public class PersonFind extends PersonBasic implements Serializable {
|
|||||||
@JsonProperty("popularity")
|
@JsonProperty("popularity")
|
||||||
private Float popularity;
|
private Float popularity;
|
||||||
private List<? extends MediaBasic> knownFor;
|
private List<? extends MediaBasic> knownFor;
|
||||||
|
@JsonProperty("known_for_department")
|
||||||
|
private String knownForDepartment;
|
||||||
|
|
||||||
public Boolean getAdult() {
|
public Boolean getAdult() {
|
||||||
return adult;
|
return adult;
|
||||||
@@ -70,8 +72,10 @@ public class PersonFind extends PersonBasic implements Serializable {
|
|||||||
defaultImpl = MediaBasic.class
|
defaultImpl = MediaBasic.class
|
||||||
)
|
)
|
||||||
@JsonSubTypes({
|
@JsonSubTypes({
|
||||||
@JsonSubTypes.Type(value = MovieBasic.class, name = "movie"),
|
@JsonSubTypes.Type(value = MovieBasic.class, name = "movie")
|
||||||
@JsonSubTypes.Type(value = TVBasic.class, name = "tv"),
|
,
|
||||||
|
@JsonSubTypes.Type(value = TVBasic.class, name = "tv")
|
||||||
|
,
|
||||||
@JsonSubTypes.Type(value = TVEpisodeBasic.class, name = "episode")
|
@JsonSubTypes.Type(value = TVEpisodeBasic.class, name = "episode")
|
||||||
})
|
})
|
||||||
@JsonSetter("known_for")
|
@JsonSetter("known_for")
|
||||||
@@ -79,4 +83,12 @@ public class PersonFind extends PersonBasic implements Serializable {
|
|||||||
this.knownFor = knownFor;
|
this.knownFor = knownFor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getKnownForDepartment() {
|
||||||
|
return knownForDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKnownForDepartment(String knownForDepartment) {
|
||||||
|
this.knownForDepartment = knownForDepartment;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ package com.omertron.themoviedbapi.model.person;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonSetter;
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
import com.omertron.themoviedbapi.enumeration.Gender;
|
|
||||||
import com.omertron.themoviedbapi.enumeration.PeopleMethod;
|
import com.omertron.themoviedbapi.enumeration.PeopleMethod;
|
||||||
import com.omertron.themoviedbapi.interfaces.AppendToResponse;
|
import com.omertron.themoviedbapi.interfaces.AppendToResponse;
|
||||||
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
@@ -63,7 +62,6 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
|
|||||||
private String placeOfBirth;
|
private String placeOfBirth;
|
||||||
@JsonProperty("popularity")
|
@JsonProperty("popularity")
|
||||||
private float popularity;
|
private float popularity;
|
||||||
private Gender gender;
|
|
||||||
// AppendToResponse
|
// AppendToResponse
|
||||||
private final Set<PeopleMethod> methods = EnumSet.noneOf(PeopleMethod.class);
|
private final Set<PeopleMethod> methods = EnumSet.noneOf(PeopleMethod.class);
|
||||||
// AppendToResponse Properties
|
// AppendToResponse Properties
|
||||||
@@ -152,15 +150,6 @@ public class PersonInfo extends PersonBasic implements Serializable, AppendToRes
|
|||||||
methods.add(method);
|
methods.add(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Gender getGender() {
|
|
||||||
return gender;
|
|
||||||
}
|
|
||||||
|
|
||||||
@JsonSetter("gender")
|
|
||||||
public void setGender(int gender) {
|
|
||||||
this.gender = Gender.fromInteger(gender);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasMethod(PeopleMethod method) {
|
public boolean hasMethod(PeopleMethod method) {
|
||||||
return methods.contains(method);
|
return methods.contains(method);
|
||||||
|
|||||||
@@ -75,10 +75,6 @@ public class TVInfo extends TVBasic implements Serializable, AppendToResponse<TV
|
|||||||
private int numberOfEpisodes;
|
private int numberOfEpisodes;
|
||||||
@JsonProperty("number_of_seasons")
|
@JsonProperty("number_of_seasons")
|
||||||
private int numberOfSeasons;
|
private int numberOfSeasons;
|
||||||
@JsonProperty("original_language")
|
|
||||||
private String originalLanguage;
|
|
||||||
@JsonProperty("overview")
|
|
||||||
private String overview;
|
|
||||||
@JsonProperty("production_companies")
|
@JsonProperty("production_companies")
|
||||||
private List<ProductionCompany> productionCompanies;
|
private List<ProductionCompany> productionCompanies;
|
||||||
@JsonProperty("seasons")
|
@JsonProperty("seasons")
|
||||||
@@ -182,22 +178,6 @@ public class TVInfo extends TVBasic implements Serializable, AppendToResponse<TV
|
|||||||
this.numberOfSeasons = numberOfSeasons;
|
this.numberOfSeasons = numberOfSeasons;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getOriginalLanguage() {
|
|
||||||
return originalLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalLanguage(String originalLanguage) {
|
|
||||||
this.originalLanguage = originalLanguage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOverview() {
|
|
||||||
return overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverview(String overview) {
|
|
||||||
this.overview = overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProductionCompany> getProductionCompanies() {
|
public List<ProductionCompany> getProductionCompanies() {
|
||||||
return productionCompanies;
|
return productionCompanies;
|
||||||
}
|
}
|
||||||
@@ -232,6 +212,7 @@ public class TVInfo extends TVBasic implements Serializable, AppendToResponse<TV
|
|||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
|
|
||||||
@JsonSetter("genre_ids")
|
@JsonSetter("genre_ids")
|
||||||
|
@Override
|
||||||
public void setGenreIds(List<Integer> ids) {
|
public void setGenreIds(List<Integer> ids) {
|
||||||
this.genres = new ArrayList<>();
|
this.genres = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public class TVSeasonBasic extends AbstractJsonMapping implements Serializable,
|
|||||||
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private int id = -1;
|
private int id = -1;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
@JsonProperty("air_date")
|
@JsonProperty("air_date")
|
||||||
private String airDate;
|
private String airDate;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
@@ -43,6 +45,8 @@ public class TVSeasonBasic extends AbstractJsonMapping implements Serializable,
|
|||||||
private int seasonNumber;
|
private int seasonNumber;
|
||||||
@JsonProperty("episode_count")
|
@JsonProperty("episode_count")
|
||||||
private int episodeCount = -1;
|
private int episodeCount = -1;
|
||||||
|
@JsonProperty("overview")
|
||||||
|
private String overview;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
@@ -86,4 +90,20 @@ public class TVSeasonBasic extends AbstractJsonMapping implements Serializable,
|
|||||||
this.episodeCount = episodeCount;
|
this.episodeCount = episodeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOverview() {
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOverview(String overview) {
|
||||||
|
this.overview = overview;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,10 +44,6 @@ public class TVSeasonInfo extends TVSeasonBasic implements Serializable, AppendT
|
|||||||
|
|
||||||
private static final long serialVersionUID = 100L;
|
private static final long serialVersionUID = 100L;
|
||||||
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("overview")
|
|
||||||
private String overview;
|
|
||||||
@JsonProperty("episodes")
|
@JsonProperty("episodes")
|
||||||
private List<TVEpisodeInfo> episodes;
|
private List<TVEpisodeInfo> episodes;
|
||||||
// AppendToResponse
|
// AppendToResponse
|
||||||
@@ -59,22 +55,6 @@ public class TVSeasonInfo extends TVSeasonBasic implements Serializable, AppendT
|
|||||||
private List<Video> videos = Collections.emptyList();
|
private List<Video> videos = Collections.emptyList();
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getters and Setters">
|
//<editor-fold defaultstate="collapsed" desc="Getters and Setters">
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOverview() {
|
|
||||||
return overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverview(String overview) {
|
|
||||||
this.overview = overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TVEpisodeInfo> getEpisodes() {
|
public List<TVEpisodeInfo> getEpisodes() {
|
||||||
return episodes;
|
return episodes;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,8 +60,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Constructor for the simple API URL method without a sub-method
|
* Constructor for the simple API URL method without a sub-method
|
||||||
*
|
*
|
||||||
* @param apiKey
|
* @param apiKey API Key
|
||||||
* @param method
|
* @param method Base method to create URL for
|
||||||
*/
|
*/
|
||||||
public ApiUrl(String apiKey, MethodBase method) {
|
public ApiUrl(String apiKey, MethodBase method) {
|
||||||
this.apiKey = apiKey;
|
this.apiKey = apiKey;
|
||||||
@@ -71,8 +71,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Add a sub-methods
|
* Add a sub-methods
|
||||||
*
|
*
|
||||||
* @param submethod
|
* @param submethod Sub-method of base method
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
public ApiUrl subMethod(MethodSub submethod) {
|
public ApiUrl subMethod(MethodSub submethod) {
|
||||||
if (submethod != MethodSub.NONE) {
|
if (submethod != MethodSub.NONE) {
|
||||||
@@ -84,7 +84,7 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Build the URL with the default parameters
|
* Build the URL with the default parameters
|
||||||
*
|
*
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
public URL buildUrl() {
|
public URL buildUrl() {
|
||||||
return buildUrl(new TmdbParameters());
|
return buildUrl(new TmdbParameters());
|
||||||
@@ -93,8 +93,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Build the URL from the pre-created parameters.
|
* Build the URL from the pre-created parameters.
|
||||||
*
|
*
|
||||||
* @param params
|
* @param params The parameters for the method
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
public URL buildUrl(final TmdbParameters params) {
|
public URL buildUrl(final TmdbParameters params) {
|
||||||
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
StringBuilder urlString = new StringBuilder(TMDB_API_BASE);
|
||||||
@@ -130,8 +130,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Create the query based URL portion
|
* Create the query based URL portion
|
||||||
*
|
*
|
||||||
* @param params
|
* @param params The parameters for the method
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
private StringBuilder queryProcessing(TmdbParameters params) {
|
private StringBuilder queryProcessing(TmdbParameters params) {
|
||||||
StringBuilder urlString = new StringBuilder();
|
StringBuilder urlString = new StringBuilder();
|
||||||
@@ -164,8 +164,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Create the ID based URL portion
|
* Create the ID based URL portion
|
||||||
*
|
*
|
||||||
* @param params
|
* @param params The parameters for the method
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
private StringBuilder idProcessing(final TmdbParameters params) {
|
private StringBuilder idProcessing(final TmdbParameters params) {
|
||||||
StringBuilder urlString = new StringBuilder();
|
StringBuilder urlString = new StringBuilder();
|
||||||
@@ -198,8 +198,8 @@ public class ApiUrl {
|
|||||||
/**
|
/**
|
||||||
* Create a string of the remaining parameters
|
* Create a string of the remaining parameters
|
||||||
*
|
*
|
||||||
* @param params
|
* @param params The parameters for the method
|
||||||
* @return
|
* @return Builder object
|
||||||
*/
|
*/
|
||||||
private StringBuilder otherProcessing(final TmdbParameters params) {
|
private StringBuilder otherProcessing(final TmdbParameters params) {
|
||||||
StringBuilder urlString = new StringBuilder();
|
StringBuilder urlString = new StringBuilder();
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public class HttpTools {
|
|||||||
*
|
*
|
||||||
* @param url URL to use in the request
|
* @param url URL to use in the request
|
||||||
* @return String content
|
* @return String content
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException exception
|
||||||
*/
|
*/
|
||||||
public String getRequest(final URL url) throws MovieDbException {
|
public String getRequest(final URL url) throws MovieDbException {
|
||||||
try {
|
try {
|
||||||
@@ -89,7 +89,7 @@ public class HttpTools {
|
|||||||
/**
|
/**
|
||||||
* Sleep for a period of time
|
* Sleep for a period of time
|
||||||
*
|
*
|
||||||
* @param multiplier
|
* @param multiplier number of seconds to use for delay
|
||||||
*/
|
*/
|
||||||
private void delay(long multiplier) {
|
private void delay(long multiplier) {
|
||||||
try {
|
try {
|
||||||
@@ -105,7 +105,7 @@ public class HttpTools {
|
|||||||
*
|
*
|
||||||
* @param url URL to use in the request
|
* @param url URL to use in the request
|
||||||
* @return String content
|
* @return String content
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException exception
|
||||||
*/
|
*/
|
||||||
public String deleteRequest(final URL url) throws MovieDbException {
|
public String deleteRequest(final URL url) throws MovieDbException {
|
||||||
try {
|
try {
|
||||||
@@ -122,7 +122,7 @@ public class HttpTools {
|
|||||||
* @param url URL to use in the request
|
* @param url URL to use in the request
|
||||||
* @param jsonBody Body to use in the request
|
* @param jsonBody Body to use in the request
|
||||||
* @return String content
|
* @return String content
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException exception
|
||||||
*/
|
*/
|
||||||
public String postRequest(final URL url, final String jsonBody) throws MovieDbException {
|
public String postRequest(final URL url, final String jsonBody) throws MovieDbException {
|
||||||
try {
|
try {
|
||||||
@@ -144,7 +144,7 @@ public class HttpTools {
|
|||||||
* @param response DigestedResponse to process
|
* @param response DigestedResponse to process
|
||||||
* @param url URL for notification purposes
|
* @param url URL for notification purposes
|
||||||
* @return String content
|
* @return String content
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException exception
|
||||||
*/
|
*/
|
||||||
private String validateResponse(final DigestedResponse response, final URL url) throws MovieDbException {
|
private String validateResponse(final DigestedResponse response, final URL url) throws MovieDbException {
|
||||||
if (response.getStatusCode() == 0) {
|
if (response.getStatusCode() == 0) {
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public enum MethodBase {
|
|||||||
/**
|
/**
|
||||||
* Get the URL parameter to use
|
* Get the URL parameter to use
|
||||||
*
|
*
|
||||||
* @return
|
* @return value
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
@@ -66,8 +66,8 @@ public enum MethodBase {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value the string representation of the enum
|
||||||
* @return
|
* @return matching enum
|
||||||
*/
|
*/
|
||||||
public static MethodBase fromString(String value) {
|
public static MethodBase fromString(String value) {
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ public enum MethodSub {
|
|||||||
RATED_MOVIES_GUEST("rated_movies"),
|
RATED_MOVIES_GUEST("rated_movies"),
|
||||||
RATED_TV("rated/tv"),
|
RATED_TV("rated/tv"),
|
||||||
RATING("rating"),
|
RATING("rating"),
|
||||||
|
RECOMMENDATIONS("recommendations"),
|
||||||
RELEASES("releases"),
|
RELEASES("releases"),
|
||||||
REMOVE_ITEM("remove_item"),
|
REMOVE_ITEM("remove_item"),
|
||||||
REVIEWS("reviews"),
|
REVIEWS("reviews"),
|
||||||
@@ -91,7 +92,7 @@ public enum MethodSub {
|
|||||||
/**
|
/**
|
||||||
* Get the URL parameter to use
|
* Get the URL parameter to use
|
||||||
*
|
*
|
||||||
* @return
|
* @return value
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
@@ -100,8 +101,8 @@ public enum MethodSub {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value the string representation of the enum
|
||||||
* @return
|
* @return matching enum
|
||||||
*/
|
*/
|
||||||
public static MethodSub fromString(String value) {
|
public static MethodSub fromString(String value) {
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
|||||||
@@ -56,6 +56,8 @@ public enum Param {
|
|||||||
PAGE("page="),
|
PAGE("page="),
|
||||||
PASSWORD("password="),
|
PASSWORD("password="),
|
||||||
PRIMARY_RELEASE_YEAR("primary_release_year="),
|
PRIMARY_RELEASE_YEAR("primary_release_year="),
|
||||||
|
PRIMARY_RELEASE_DATE_GTE("primary_release_date.gte="),
|
||||||
|
PRIMARY_RELEASE_DATE_LTE("primary_release_date.lte="),
|
||||||
QUERY("query="),
|
QUERY("query="),
|
||||||
RELEASE_DATE_GTE("release_date.gte="),
|
RELEASE_DATE_GTE("release_date.gte="),
|
||||||
RELEASE_DATE_LTE("release_date.lte="),
|
RELEASE_DATE_LTE("release_date.lte="),
|
||||||
@@ -91,7 +93,7 @@ public enum Param {
|
|||||||
/**
|
/**
|
||||||
* Get the URL parameter to use
|
* Get the URL parameter to use
|
||||||
*
|
*
|
||||||
* @return
|
* @return value
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
@@ -100,8 +102,8 @@ public enum Param {
|
|||||||
/**
|
/**
|
||||||
* Convert a string into an Enum type
|
* Convert a string into an Enum type
|
||||||
*
|
*
|
||||||
* @param value
|
* @param value the string representation of the enum
|
||||||
* @return
|
* @return matching enum
|
||||||
*/
|
*/
|
||||||
public static Param fromString(String value) {
|
public static Param fromString(String value) {
|
||||||
if (StringUtils.isNotBlank(value)) {
|
if (StringUtils.isNotBlank(value)) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public enum PostBody {
|
|||||||
/**
|
/**
|
||||||
* Get the URL parameter to use
|
* Get the URL parameter to use
|
||||||
*
|
*
|
||||||
* @return
|
* @return value
|
||||||
*/
|
*/
|
||||||
public String getValue() {
|
public String getValue() {
|
||||||
return this.value;
|
return this.value;
|
||||||
|
|||||||
@@ -61,9 +61,9 @@ public class PostTools {
|
|||||||
/**
|
/**
|
||||||
* Use Jackson to convert Map to JSON string.
|
* Use Jackson to convert Map to JSON string.
|
||||||
*
|
*
|
||||||
* @param map
|
* @param map Map to convert to json
|
||||||
* @return
|
* @return json string
|
||||||
* @throws MovieDbException
|
* @throws MovieDbException exception
|
||||||
*/
|
*/
|
||||||
private String convertToJson(Map<String, ?> map) throws MovieDbException {
|
private String convertToJson(Map<String, ?> map) throws MovieDbException {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class TmdbParameters {
|
|||||||
/**
|
/**
|
||||||
* Get the entry set of the parameters
|
* Get the entry set of the parameters
|
||||||
*
|
*
|
||||||
* @return
|
* @return map of parameters
|
||||||
*/
|
*/
|
||||||
public Set<Map.Entry<Param, String>> getEntries() {
|
public Set<Map.Entry<Param, String>> getEntries() {
|
||||||
return parameters.entrySet();
|
return parameters.entrySet();
|
||||||
@@ -79,7 +79,7 @@ public class TmdbParameters {
|
|||||||
* Add an integer parameter to the collection
|
* Add an integer parameter to the collection
|
||||||
*
|
*
|
||||||
* @param key Parameter to add
|
* @param key Parameter to add
|
||||||
* @param value The value to add (will be checked to ensure >0)
|
* @param value The value to add (will be checked to ensure greater than zero)
|
||||||
*/
|
*/
|
||||||
public void add(final Param key, final Integer value) {
|
public void add(final Param key, final Integer value) {
|
||||||
if (value != null && value > 0) {
|
if (value != null && value > 0) {
|
||||||
@@ -91,7 +91,7 @@ public class TmdbParameters {
|
|||||||
* Add a float parameter to the collection
|
* Add a float parameter to the collection
|
||||||
*
|
*
|
||||||
* @param key Parameter to add
|
* @param key Parameter to add
|
||||||
* @param value The value to add (will be checked to ensure >0)
|
* @param value The value to add (will be checked to ensure greater than zero)
|
||||||
*/
|
*/
|
||||||
public void add(final Param key, final Float value) {
|
public void add(final Param key, final Float value) {
|
||||||
if (value != null && value > 0f) {
|
if (value != null && value > 0f) {
|
||||||
@@ -103,7 +103,7 @@ public class TmdbParameters {
|
|||||||
* Add a boolean parameter to the collection
|
* Add a boolean parameter to the collection
|
||||||
*
|
*
|
||||||
* @param key Parameter to add
|
* @param key Parameter to add
|
||||||
* @param value The value to add (will be checked to ensure >0)
|
* @param value The value to add (will be checked to ensure greater than zero)
|
||||||
*/
|
*/
|
||||||
public void add(final Param key, final Boolean value) {
|
public void add(final Param key, final Boolean value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@@ -115,7 +115,7 @@ public class TmdbParameters {
|
|||||||
* Check to see if the collection has a certain parameter
|
* Check to see if the collection has a certain parameter
|
||||||
*
|
*
|
||||||
* @param key The Parameter to check
|
* @param key The Parameter to check
|
||||||
* @return
|
* @return true if parameter exists
|
||||||
*/
|
*/
|
||||||
public boolean has(final Param key) {
|
public boolean has(final Param key) {
|
||||||
return parameters.containsKey(key);
|
return parameters.containsKey(key);
|
||||||
@@ -125,7 +125,7 @@ public class TmdbParameters {
|
|||||||
* Get a parameter from the collection
|
* Get a parameter from the collection
|
||||||
*
|
*
|
||||||
* @param key The parameter to get
|
* @param key The parameter to get
|
||||||
* @return
|
* @return the parameter
|
||||||
*/
|
*/
|
||||||
public Object get(final Param key) {
|
public Object get(final Param key) {
|
||||||
return parameters.get(key);
|
return parameters.get(key);
|
||||||
@@ -134,7 +134,7 @@ public class TmdbParameters {
|
|||||||
/**
|
/**
|
||||||
* Remove a parameter from the collection
|
* Remove a parameter from the collection
|
||||||
*
|
*
|
||||||
* @param key
|
* @param key parameter to remove
|
||||||
*/
|
*/
|
||||||
public void remove(final Param key) {
|
public void remove(final Param key) {
|
||||||
parameters.remove(key);
|
parameters.remove(key);
|
||||||
@@ -143,7 +143,7 @@ public class TmdbParameters {
|
|||||||
/**
|
/**
|
||||||
* Check to see if the collection has no items
|
* Check to see if the collection has no items
|
||||||
*
|
*
|
||||||
* @return
|
* @return true if the parameters are empty
|
||||||
*/
|
*/
|
||||||
public boolean isEmpty() {
|
public boolean isEmpty() {
|
||||||
return parameters.isEmpty();
|
return parameters.isEmpty();
|
||||||
@@ -152,7 +152,7 @@ public class TmdbParameters {
|
|||||||
/**
|
/**
|
||||||
* Check to see if the collection has items
|
* Check to see if the collection has items
|
||||||
*
|
*
|
||||||
* @return
|
* @return true if there are parameters
|
||||||
*/
|
*/
|
||||||
public boolean isNotEmpty() {
|
public boolean isNotEmpty() {
|
||||||
return !isEmpty();
|
return !isEmpty();
|
||||||
@@ -161,8 +161,8 @@ public class TmdbParameters {
|
|||||||
/**
|
/**
|
||||||
* Append any optional parameters to the URL
|
* Append any optional parameters to the URL
|
||||||
*
|
*
|
||||||
* @param appendToResponse
|
* @param appendToResponse String array to convert to a comma list
|
||||||
* @return
|
* @return comma separated list
|
||||||
*/
|
*/
|
||||||
public String toList(final String[] appendToResponse) {
|
public String toList(final String[] appendToResponse) {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ public class TestSuite {
|
|||||||
assertTrue(message + MISSING_ID, test.getId() > 0);
|
assertTrue(message + MISSING_ID, test.getId() > 0);
|
||||||
assertTrue(message + MISSING_NAME, StringUtils.isNotBlank(test.getName()));
|
assertTrue(message + MISSING_NAME, StringUtils.isNotBlank(test.getName()));
|
||||||
assertTrue(message + ": Missing overview", StringUtils.isNotBlank(test.getOverview()));
|
assertTrue(message + ": Missing overview", StringUtils.isNotBlank(test.getOverview()));
|
||||||
assertTrue(message + ": Missing episodes", test.getEpisodes().size() > 0);
|
assertFalse(message + ": Missing episodes", test.getEpisodes().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void test(ExternalID test) {
|
public static void test(ExternalID test) {
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ public class TmdbCompaniesTest extends AbstractTests {
|
|||||||
LOG.info("getCompanyInfo");
|
LOG.info("getCompanyInfo");
|
||||||
Company company = instance.getCompanyInfo(ID_COMPANY);
|
Company company = instance.getCompanyInfo(ID_COMPANY);
|
||||||
assertTrue("No company information found", company.getId() > 0);
|
assertTrue("No company information found", company.getId() > 0);
|
||||||
assertNotNull("No parent company found", company.getParentCompany());
|
assertNotNull("No homepage founnd", company.getHomepage());
|
||||||
|
assertNotNull("No logo found", company.getLogoPath());
|
||||||
|
assertNotNull("No origin country", company.getOriginCountry());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -75,7 +75,8 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
testClear(listId);
|
testClear(listId);
|
||||||
|
|
||||||
// Delete the list
|
// Delete the list
|
||||||
testDeleteList(listId);
|
// API v4 ONLY
|
||||||
|
// testDeleteList(listId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,7 +86,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testGetList(String listId) throws MovieDbException {
|
private void testGetList(String listId) throws MovieDbException {
|
||||||
LOG.info("getList");
|
LOG.info("getList - List: {}", listId);
|
||||||
|
|
||||||
ListItem result = instance.getList(listId);
|
ListItem result = instance.getList(listId);
|
||||||
LOG.info("Found {} movies on list", result.getItems().size());
|
LOG.info("Found {} movies on list", result.getItems().size());
|
||||||
@@ -105,6 +106,8 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
String description = "This is random list number " + r + " used for testing purposes";
|
String description = "This is random list number " + r + " used for testing purposes";
|
||||||
String result = instance.createList(getSessionId(), name, description);
|
String result = instance.createList(getSessionId(), name, description);
|
||||||
assertTrue("No list ID returned", StringUtils.isNotBlank(result));
|
assertTrue("No list ID returned", StringUtils.isNotBlank(result));
|
||||||
|
|
||||||
|
LOG.info("List created: {}", result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +117,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testCheckItemStatus(String listId, int mediaId) throws MovieDbException {
|
private void testCheckItemStatus(String listId, int mediaId) throws MovieDbException {
|
||||||
LOG.info("checkItemStatus");
|
LOG.info("checkItemStatus - List: {}, Media: {}", listId, mediaId);
|
||||||
boolean expResult = true;
|
boolean expResult = true;
|
||||||
boolean result = instance.checkItemStatus(listId, mediaId);
|
boolean result = instance.checkItemStatus(listId, mediaId);
|
||||||
assertEquals("Item is not on list!", expResult, result);
|
assertEquals("Item is not on list!", expResult, result);
|
||||||
@@ -126,7 +129,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testDeleteList(String listId) throws MovieDbException {
|
private void testDeleteList(String listId) throws MovieDbException {
|
||||||
LOG.info("deleteList");
|
LOG.info("deleteList - List: {}", listId);
|
||||||
StatusCode result = instance.deleteList(getSessionId(), listId);
|
StatusCode result = instance.deleteList(getSessionId(), listId);
|
||||||
LOG.info(RESULT, result);
|
LOG.info(RESULT, result);
|
||||||
|
|
||||||
@@ -142,7 +145,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testAddItem(String listId, int mediaId) throws MovieDbException {
|
private void testAddItem(String listId, int mediaId) throws MovieDbException {
|
||||||
LOG.info("addItem");
|
LOG.info("addItem - List: {}, Media: {}", listId, mediaId);
|
||||||
StatusCode result = instance.addItem(getSessionId(), listId, mediaId);
|
StatusCode result = instance.addItem(getSessionId(), listId, mediaId);
|
||||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||||
}
|
}
|
||||||
@@ -153,7 +156,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testRemoveItem(String listId, int mediaId) throws MovieDbException {
|
private void testRemoveItem(String listId, int mediaId) throws MovieDbException {
|
||||||
LOG.info("removeItem");
|
LOG.info("removeItem - List: {}, Media: {}", listId, mediaId);
|
||||||
StatusCode result = instance.removeItem(getSessionId(), listId, mediaId);
|
StatusCode result = instance.removeItem(getSessionId(), listId, mediaId);
|
||||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_DEL, result.getCode());
|
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_DEL, result.getCode());
|
||||||
}
|
}
|
||||||
@@ -164,7 +167,7 @@ public class TmdbListsTest extends AbstractTests {
|
|||||||
* @throws com.omertron.themoviedbapi.MovieDbException
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
*/
|
*/
|
||||||
private void testClear(String listId) throws MovieDbException {
|
private void testClear(String listId) throws MovieDbException {
|
||||||
LOG.info("clear");
|
LOG.info("clear - List: {}", listId);
|
||||||
StatusCode result = instance.clear(getSessionId(), listId, true);
|
StatusCode result = instance.clear(getSessionId(), listId, true);
|
||||||
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
assertEquals(INVALID_RESPONSE + result.toString(), SC_SUCCESS_UPD, result.getCode());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -326,6 +326,23 @@ public class TmdbMoviesTest extends AbstractTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test of getRecommendations method, of class TmdbMovies.
|
||||||
|
*
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetRecommendations() throws MovieDbException {
|
||||||
|
LOG.info("getRecommendations");
|
||||||
|
|
||||||
|
String language = LANGUAGE_DEFAULT;
|
||||||
|
|
||||||
|
for (TestID test : FILM_IDS) {
|
||||||
|
ResultList<MovieInfo> result = instance.getRecommendations(test.getTmdb(), language);
|
||||||
|
TestSuite.test(result, "Recommendations");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test of getMovieReviews method, of class TmdbMovies.
|
* Test of getMovieReviews method, of class TmdbMovies.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ public class TmdbNetworksTest extends AbstractTests {
|
|||||||
public static void setUpClass() throws MovieDbException {
|
public static void setUpClass() throws MovieDbException {
|
||||||
doConfiguration();
|
doConfiguration();
|
||||||
instance = new TmdbNetworks(getApiKey(), getHttpTools());
|
instance = new TmdbNetworks(getApiKey(), getHttpTools());
|
||||||
TEST_IDS.add(new TestID("Fuji Television", "", 1));
|
TEST_IDS.add(new TestID("Fuji TV", "", 1));
|
||||||
TEST_IDS.add(new TestID("Sonshine Media Network International", "", 200));
|
TEST_IDS.add(new TestID("Sonshine Media Network International", "", 200));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ import com.omertron.themoviedbapi.enumeration.SearchType;
|
|||||||
import com.omertron.themoviedbapi.model.collection.Collection;
|
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||||
import com.omertron.themoviedbapi.model.company.Company;
|
import com.omertron.themoviedbapi.model.company.Company;
|
||||||
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
import com.omertron.themoviedbapi.model.list.UserList;
|
|
||||||
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||||
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
import com.omertron.themoviedbapi.model.person.PersonFind;
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
import com.omertron.themoviedbapi.results.ResultList;
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -91,21 +91,7 @@ public class TmdbSearchTest extends AbstractTests {
|
|||||||
int page = 0;
|
int page = 0;
|
||||||
ResultList<Keyword> result = instance.searchKeyword(query, page);
|
ResultList<Keyword> result = instance.searchKeyword(query, page);
|
||||||
TestSuite.test(result, "Keyword");
|
TestSuite.test(result, "Keyword");
|
||||||
TestSuite.testId(result, 207600, "Keyword");
|
TestSuite.testId(result, 210313, "Keyword");
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test of searchList method, of class TheMovieDbApi.
|
|
||||||
*
|
|
||||||
* @throws MovieDbException
|
|
||||||
*/
|
|
||||||
@Test
|
|
||||||
public void testSearchList() throws MovieDbException {
|
|
||||||
LOG.info("searchList");
|
|
||||||
String query = "watch";
|
|
||||||
int page = 0;
|
|
||||||
ResultList<UserList> result = instance.searchList(query, page, null);
|
|
||||||
TestSuite.test(result, "List");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,12 +106,12 @@ public class TmdbSearchTest extends AbstractTests {
|
|||||||
// Try a movie with less than 1 page of results
|
// Try a movie with less than 1 page of results
|
||||||
ResultList<MovieInfo> movieList = instance.searchMovie("Blade Runner", 0, "", null, 0, 0, SearchType.PHRASE);
|
ResultList<MovieInfo> movieList = instance.searchMovie("Blade Runner", 0, "", null, 0, 0, SearchType.PHRASE);
|
||||||
TestSuite.test(movieList, "Movie 1");
|
TestSuite.test(movieList, "Movie 1");
|
||||||
assertTrue("No movies found, should be at least 1", movieList.getResults().size() > 0);
|
assertFalse("No movies found, should be at least 1", movieList.getResults().isEmpty());
|
||||||
|
|
||||||
// Try a russian langugage movie
|
// Try a russian langugage movie
|
||||||
movieList = instance.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, null, 0, 0, SearchType.PHRASE);
|
movieList = instance.searchMovie("О чём говорят мужчины", 0, LANGUAGE_RUSSIAN, null, 0, 0, SearchType.PHRASE);
|
||||||
TestSuite.test(movieList, "Movie 2");
|
TestSuite.test(movieList, "Movie 2");
|
||||||
assertTrue("No 'RU' movies found, should be at least 1", movieList.getResults().size() > 0);
|
assertFalse("No 'RU' movies found, should be at least 1", movieList.getResults().isEmpty());
|
||||||
|
|
||||||
// Try a movie with more than 20 results
|
// Try a movie with more than 20 results
|
||||||
movieList = instance.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, null, 0, 0, SearchType.PHRASE);
|
movieList = instance.searchMovie("Star Wars", 0, LANGUAGE_ENGLISH, null, 0, 0, SearchType.PHRASE);
|
||||||
|
|||||||
@@ -154,6 +154,11 @@ public class TmdbTVTest extends AbstractTests {
|
|||||||
LOG.info("getTVAlternativeTitles");
|
LOG.info("getTVAlternativeTitles");
|
||||||
|
|
||||||
for (TestID test : TV_IDS) {
|
for (TestID test : TV_IDS) {
|
||||||
|
// Skip supernatural (no alternative titles)
|
||||||
|
if (test.getTmdb() == 1622) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ResultList<AlternativeTitle> result = instance.getTVAlternativeTitles(test.getTmdb());
|
ResultList<AlternativeTitle> result = instance.getTVAlternativeTitles(test.getTmdb());
|
||||||
TestSuite.test(result, "TV Alt Titles");
|
TestSuite.test(result, "TV Alt Titles");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user