114 Commits

Author SHA1 Message Date
Stuart Boston 34b337aecd Merge pull request #50 from Omertron/dependabot/maven/junit-junit-4.13.1
Bump junit from 4.12 to 4.13.1
2020-11-11 13:30:49 +00:00
dependabot[bot] 3155555d7a Bump junit from 4.12 to 4.13.1
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-13 08:04:27 +00:00
Stuart Boston 92c6de7426 Merge pull request #48 from denyskonakhevych/fix-generics
fix compilation problems
2020-01-30 17:54:46 +00:00
denys.konakhevych 252a6abab2 fix compilation problems 2020-01-22 13:48:09 +02:00
Stuart Boston 07b06455cf Merge pull request #47 from Omertron/dependabot/maven/version.jackson-2.10.0
Bump version.jackson from 2.8.11 to 2.10.0
2019-11-05 13:42:37 +00:00
dependabot[bot] c02ae50bff Bump version.jackson from 2.8.11 to 2.10.0
Bumps `version.jackson` from 2.8.11 to 2.10.0.

Updates `jackson-core` from 2.8.11 to 2.10.0
- [Release notes](https://github.com/FasterXML/jackson-core/releases)
- [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.8.11...jackson-core-2.10.0)

Updates `jackson-annotations` from 2.8.11 to 2.10.0
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Updates `jackson-databind` from 2.8.11 to 2.10.0
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2019-11-04 21:25:14 +00:00
Stuart Boston bf132d7c72 Merge pull request #46 from Kaferusha/primary_release
added methods to Discover
2018-07-26 15:06:23 +01:00
Anastasiya Zhukova 9667a34a01 added methods to Discover 2018-07-11 11:40:54 +07:00
Stuart Boston efeae0de0b Rollback Jackson version 2018-04-03 21:50:41 +01:00
Stuart Boston 963dceb6bd Fix Networks Test 2018-04-03 21:47:38 +01:00
Stuart Boston 695077a1d7 Update POM versions 2018-04-03 21:24:06 +01:00
Stuart Boston 2de5728b3a Add javadoc 2018-04-03 20:53:15 +01:00
Stuart Boston 6733bb6191 Update credit methods
CreditBasic
CreditMovieBasic
CreditTVBasic
2018-04-03 20:35:25 +01:00
Stuart Boston 71178f21cd Update TVSeasonBasic
Add Name and Overview
2018-04-03 20:09:27 +01:00
Stuart Boston a0a6a62dbe Update PersonFind
add KnownForDepartment
2018-04-03 20:03:08 +01:00
Stuart Boston 119a51c8e8 Update person models 2018-04-03 19:45:03 +01:00
Stuart Boston 240110848a Update Network 2018-04-03 19:41:10 +01:00
Stuart Boston 4f89f03b7f Update JobDepartment list
renamed job_list to jobs
2018-04-03 19:38:53 +01:00
Stuart Boston 33daddb40e Update Network model 2018-04-03 18:49:57 +01:00
Stuart Boston 4203dc55a5 Update Alternative Titles 2018-04-02 21:41:55 +01:00
Stuart Boston 998eb06b69 Update Company Information 2018-04-02 21:15:57 +01:00
Stuart Boston 71fa47b48f Merge pull request #44 from aviemzur/get-movie-recommendations
Get movie recommendations method
2018-01-25 15:22:22 +00:00
Stuart Boston 67bb8d21bd Merge pull request #43 from aviemzur/add-intellij-idea-files-to-gitignore
Add IntelliJ IDEA files to .gitignore
2018-01-25 15:22:06 +00:00
Aviem Zur d6542d0676 Get movie recommendations method 2018-01-15 07:31:23 +02:00
Aviem Zur 02b03c5c58 Add IntelliJ IDEA files to .gitignore 2018-01-15 07:24:36 +02:00
Stuart Boston eb9e9930e1 More javadoc fixes 2017-07-07 13:58:52 +01:00
Stuart Boston dd82c0d906 More javadoc 2017-07-07 11:58:50 +01:00
Stuart Boston e184077f9d Add more javadoc 2017-07-07 11:49:08 +01:00
Stuart Boston a7a099ac0c remove un-extended methods
Use the base methods instead
2017-07-07 11:32:55 +01:00
Stuart Boston 3a1251777e Use isEmpty in tests 2017-07-07 11:23:54 +01:00
Stuart Boston 8a3af38b0c Add javadoc to ApiUrl 2017-07-07 10:45:46 +01:00
Stuart Boston 3104588272 Add gender to MediaCreditCrew object 2017-07-07 10:28:54 +01:00
Stuart Boston 95ff0f0119 Merge pull request #41 from stigrv/master
Add missing media type
2017-07-07 09:01:48 +01:00
Stuart Boston c3bd8efbf9 Merge pull request #42 from stigrv/gender
Correct gender assignment
2017-07-07 09:01:20 +01:00
Stig Runar Vangen 09a3fb5ffe Correct gender assignment 2017-07-07 08:55:34 +02:00
Stig Runar Vangen ce06aacec9 Correct gender assignment 2017-07-07 08:47:30 +02:00
Stig Runar Vangen ec9c4dd45c Add missing media type 2017-07-07 08:31:39 +02:00
Stuart Boston 0940c7ac38 Update List test 2017-04-20 21:21:42 +01:00
Stuart Boston ca9f3248b7 Skip invalid show in test
Supernatural doesnt have alt titles
2017-04-20 20:03:40 +01:00
Stuart Boston b91dac2c9d Remove unsupported SearchList function 2017-04-20 19:25:02 +01:00
Stuart Boston c5a1a85a2a Add gender to MediaCreditCast 2017-04-20 18:22:51 +01:00
Stuart Boston 9ab81018dd Add additional fields to methods 2017-03-17 10:40:16 +00:00
Stuart Boston 6eec791933 Update POM versions 2017-03-17 09:22:46 +00:00
Omertron 74fac5636a [maven-release-plugin] prepare for next development iteration 2016-05-01 15:31:54 +00:00
Omertron 3f1c359a9f [maven-release-plugin] prepare release themoviedbapi-4.3 2016-05-01 15:31:43 +00:00
Stuart Boston 0c455accb5 Rename ReleaseDate field
A field should not duplicate the name of its containing class
2016-03-24 20:54:39 +00:00
Stuart Boston ca4fc59a80 Rename language field
A field should not duplicate the name of its containing class
2016-03-24 20:53:16 +00:00
Stuart Boston 799d6d6fd5 Add ReleaseDates method
fixes #36
2016-03-20 10:28:21 +00:00
Stuart Boston 39465e1ba2 Fix NowPlaying call 2016-03-20 08:18:41 +00:00
Stuart Boston c208b62384 update from method 2016-03-19 20:33:03 +00:00
Stuart Boston e83d947dfe Add gender to Person 2016-03-19 19:33:27 +00:00
Stuart Boston bab9c80781 Add facebook and twitter IDs 2016-03-19 19:33:14 +00:00
Stuart Boston 45515869c6 Add missing country to Video 2016-03-19 17:37:20 +00:00
Stuart Boston 11f18ce3d8 Correct use of iso code names 2016-03-19 16:02:03 +00:00
Stuart Boston a9e22f4d75 fix java doc 2016-03-19 15:33:34 +00:00
Stuart Boston 1d977f9d7b Add missing language to translation 2016-03-19 15:31:31 +00:00
Stuart Boston 96aa13bd70 Merge pull request #34 from DevFactory/release/consective-appends-should-reuse-fix-1
Consecutive Appends Should Reuse
2016-03-04 13:44:18 +00:00
Zeeshan Asghar 84e08a93e2 pmd:ConsecutiveAppendsShouldReuse Consecutive Appends Should Reuse 2016-03-04 13:38:09 +05:00
Stuart Boston 2dc61738c8 Add empty test for debugging 2016-02-26 13:07:51 +00:00
Omertron b0c998b984 [maven-release-plugin] prepare for next development iteration 2016-02-26 09:17:57 +00:00
Omertron f506be70ea [maven-release-plugin] prepare release themoviedbapi-4.2 2016-02-26 09:17:46 +00:00
Stuart Boston 42ff59d4ba Reduce complexity of test 2016-02-25 15:11:10 +00:00
Stuart Boston 302e47b496 Remove unused methods 2016-02-25 15:10:44 +00:00
Stuart Boston f0499bba01 Fix crew credit test 2016-02-25 13:27:09 +00:00
Stuart Boston 95a0613cb0 Remove incorrect exception 2016-02-25 13:07:39 +00:00
Stuart Boston eb396be02e Remove unused constructors 2016-02-25 11:31:00 +00:00
Stuart Boston 80177ff9c7 Sonar: method naming 2016-02-25 10:55:10 +00:00
Stuart Boston 66de073677 Sonar fixes 2016-02-25 10:51:07 +00:00
Stuart Boston cf667fa69e minor sonar issues 2016-02-25 09:03:28 +00:00
Stuart Boston 525657e6f6 Add new TVBasic attribs 2016-02-25 08:41:27 +00:00
Stuart Boston f0faafe702 Add new collection attribs 2016-02-25 08:41:13 +00:00
Stuart Boston c7b37121ca Update copyright date 2016-02-25 07:59:40 +00:00
Stuart Boston 2c7095908b Update POM versions 2016-02-24 19:24:08 +00:00
Omertron 012d694d78 [maven-release-plugin] prepare for next development iteration 2016-01-08 10:50:06 +00:00
Omertron cbc2121a87 [maven-release-plugin] prepare release themoviedbapi-4.1 2016-01-08 10:49:54 +00:00
Stuart Boston d1e1454134 Catch connection issues
Fixes #28
2015-11-08 19:42:53 +00:00
Stuart Boston 80414b7c2a Update main API 2015-11-08 19:06:24 +00:00
Stuart Boston 3bfbc1c0a7 Revert version of surefire
v2.19 does not allow individual tests to be run
2015-11-08 19:04:59 +00:00
Stuart Boston 463032bc05 Updated TV methods
Changed some methods for TVInfo
2015-11-08 19:04:15 +00:00
Stuart Boston c04f330d54 Add setter for genre ids
Used in the similar TV ATR
2015-11-08 16:43:46 +00:00
Stuart Boston e95b76c44a Replace tabs with spaces 2015-11-05 20:43:56 +00:00
Stuart Boston d8e56616e8 Update api-common version 2015-11-05 20:33:38 +00:00
Stuart Boston a47c55ee7e Update POM versions 2015-11-04 22:04:13 +00:00
Stuart Boston 4134594de5 Revert "Add more information to CollectionInfo"
This reverts commit b5b84cc962.
2015-08-29 21:23:08 +01:00
Stuart Boston 64ca72c182 Update POM versions 2015-08-25 20:53:38 +01:00
Stuart Boston d21bf07f1d Check for null AppendToResponse
Fix #26
2015-08-25 15:06:39 +01:00
Stuart Boston b5b84cc962 Add more information to CollectionInfo 2015-08-25 14:47:15 +01:00
Stuart Boston 2837424c09 Fix long conversion issue 2015-06-01 15:59:26 +01:00
Stuart Boston c8310935aa More diamond interfaces 2015-06-01 12:53:48 +01:00
Stuart Boston 50171a7da5 Remove unused method 2015-06-01 11:52:46 +01:00
Stuart Boston f512fc0754 Sonar fixes 2015-06-01 11:51:27 +01:00
Stuart Boston 06da84c2ac Use Diamond interface 2015-06-01 11:38:36 +01:00
Stuart Boston c3569f0140 Revert "Use diamond interface"
This reverts commit 4f9d74c9f7.
2015-06-01 11:38:11 +01:00
Stuart Boston 4f9d74c9f7 Use diamond interface 2015-06-01 11:37:54 +01:00
Stuart Boston 0aab56a044 Code tidy up 2015-05-31 17:18:28 +01:00
Stuart Boston 87f973955e Combined Credits Fix
Swap combined credits for tv & movie credits
2015-05-31 17:16:57 +01:00
Stuart Boston 64e88fa9f3 Added ID to ListItemStatus 2015-05-30 19:10:09 +01:00
Stuart Boston fb0e14cd21 Updated Tests 2015-05-30 19:09:53 +01:00
Stuart Boston 8451a4630b Serializable account 2015-05-30 19:09:36 +01:00
Stuart Boston e00d9357e2 Add check for rate limit
Delay and retry if code 429 encountered
2015-05-30 19:01:17 +01:00
Stuart Boston 212143b18d Update model with missing fields 2015-05-30 16:34:03 +01:00
Stuart Boston c9f85bab6d Remove gitter chat 2015-05-26 22:05:26 +01:00
Stuart Boston 4ec54425f3 Update badges and build status 2015-05-26 22:00:15 +01:00
Stuart Boston 00b538efb1 Updated People Test 2015-05-12 11:19:57 +01:00
Stuart Boston b16d452114 Correct return types for people methods 2015-04-27 14:24:52 +01:00
Stuart Boston a83c75070d Merge pull request #24 from gitter-badger/gitter-badge
Add a Gitter chat badge to README.md
2015-04-17 15:09:05 +01:00
The Gitter Badger 178b49c413 Added Gitter badge 2015-04-17 14:08:25 +00:00
Stuart Boston 55601a0698 Add commons-lang3 dependency 2015-04-16 15:02:56 +01:00
Stuart Boston a874297106 Use diamond interface 2015-04-09 21:42:43 +01:00
Stuart Boston eff654fd61 Update build procedure 2015-04-08 16:02:02 +01:00
Stuart Boston 63afef71a4 Update dependancy versions 2015-04-08 09:54:01 +01:00
Stuart Boston 1b180f9e28 Set source version to 1.7 2015-03-28 10:48:56 +00:00
Stuart Boston cfc215cd74 Fix AppendToResponseBuilder 2015-03-27 11:36:03 +00:00
Omertron 5fefa68352 [maven-release-plugin] prepare for next development iteration 2015-03-17 12:40:10 +00:00
177 changed files with 2467 additions and 1793 deletions
+5 -5
View File
@@ -10,13 +10,13 @@
*.dbproj merge=union *.dbproj merge=union
# Standard to msysgit # Standard to msysgit
*.doc diff=astextplain *.doc diff=astextplain
*.DOC diff=astextplain *.DOC diff=astextplain
*.docx diff=astextplain *.docx diff=astextplain
*.DOCX diff=astextplain *.DOCX diff=astextplain
*.dot diff=astextplain *.dot diff=astextplain
*.DOT diff=astextplain *.DOT diff=astextplain
*.pdf diff=astextplain *.pdf diff=astextplain
*.PDF diff=astextplain *.PDF diff=astextplain
*.rtf diff=astextplain *.rtf diff=astextplain
*.RTF diff=astextplain *.RTF diff=astextplain
+4 -1
View File
@@ -11,4 +11,7 @@ testing.properties
.settings .settings
.classpath .classpath
.project .project
.DS_Store .DS_Store
/nbproject/
.idea
*.iml
+2 -1
View File
@@ -8,5 +8,6 @@ import java.lang.annotation.Target;
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER}) @Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface JsonProperty { public @interface JsonProperty {
String value() default "";
String value() default "";
} }
+1 -1
View File
@@ -8,5 +8,5 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface JsonRootName { public @interface JsonRootName {
String value() default ""; String value() default "";
} }
+51 -54
View File
@@ -11,59 +11,56 @@ import org.json.JSONObject;
public class ObjectMapper { public class ObjectMapper {
/** /**
* This takes a JSON string and creates (and populates) an object of the given class * This takes a JSON string and creates (and populates) an object of the
* with the data from that JSON string. It mimics the method signature of the jackson * given class with the data from that JSON string. It mimics the method
* JSON API, so that we don't have to import the jackson library into this application. * signature of the jackson JSON API, so that we don't have to import the
* * jackson library into this application.
* @param jsonString The JSON string to parse. *
* @param objClass The class of object we want to create. * @param jsonString The JSON string to parse.
* @return The instantiation of that class, populated with data from the JSON object. * @param objClass The class of object we want to create.
* @throws IOException If there was any kind of issue. * @return The instantiation of that class, populated with data from the
*/ * JSON object.
public <T> T readValue(String jsonString, Class<T> objClass) throws IOException { * @throws IOException If there was any kind of issue.
try { */
return readValue(new JSONObject(jsonString), objClass); public <T> T readValue(String jsonString, Class<T> objClass) throws IOException {
} try {
catch (IOException ioe) { return readValue(new JSONObject(jsonString), objClass);
throw ioe; } catch (IOException ioe) {
} throw ioe;
catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
throw new IOException(e); throw new IOException(e);
} }
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException { public <T, R> T readValue(JSONObject json, Class<T> objClass) throws IOException {
try { try {
//TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones. //TODO Iterate through json object values and call the JsonAnySetter method on the unknown ones.
T obj = objClass.newInstance(); T obj = objClass.newInstance();
for (Field f : objClass.getFields()) { for (Field f : objClass.getFields()) {
Annotation a = f.getAnnotation(JsonProperty.class); Annotation a = f.getAnnotation(JsonProperty.class);
if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list. if (List.class.equals(f.getType()) && (json.optJSONArray(((JsonProperty) a).value()) != null)) { // It's a list.
JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value()); JSONArray jsonArray = json.optJSONArray(((JsonProperty) a).value());
ParameterizedType listType = (ParameterizedType) f.getGenericType(); ParameterizedType listType = (ParameterizedType) f.getGenericType();
Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0]; Class<?> subObj = (Class<?>) listType.getActualTypeArguments()[0];
List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance(); List<R> subObjList = ((Class<List<R>>) f.getType()).newInstance();
for (int i = 0; i < jsonArray.length(); i++) { for (int i = 0; i < jsonArray.length(); i++) {
subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj)); subObjList.add((R) readValue(jsonArray.getJSONObject(i), subObj));
} }
f.set(obj, subObjList); f.set(obj, subObjList);
} } else if (a != null) {
else if (a != null) { f.set(obj, json.opt(((JsonProperty) a).value()));
f.set(obj, json.opt(((JsonProperty) a).value())); }
} }
} return obj;
return obj; } catch (IOException ioe) {
} throw ioe;
catch (IOException ioe) { } catch (Exception e) {
throw ioe; e.printStackTrace();
} throw new IOException(e);
catch (Exception e) { }
e.printStackTrace(); }
throw new IOException(e);
}
}
} }
+2 -5
View File
@@ -5,13 +5,10 @@ Author: Stuart Boston (Omertron AT Gmail DOT com)
This API uses the [TheMovieDB.org API](http://api.themoviedb.org/) This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/) Originally written for use by YetAnotherMovieJukebox ([YAMJv2](https://github.com/YAMJ/yamj-v2) & [YAMJv3](https://github.com/YAMJ/yamj-v3)), but anyone can feel free to use it for other projects as well.
But anyone can use it for other projects as well. [![Build Status](http://jenkins.omertron.com/job/API-TheMovieDb/badge/icon)](http://jenkins.omertron.com/job/API-TheMovieDb)
[![Flattr this git repo](http://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=Omertron&url=https://github.com/Omertron/api-themoviedb&title=TheMovieDB API&language=&tags=github&category=software)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/Omertron/api-themoviedb/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
*** ***
TMDB TV Support TMDB TV Support
+222 -207
View File
@@ -13,7 +13,7 @@
<groupId>com.omertron</groupId> <groupId>com.omertron</groupId>
<artifactId>themoviedbapi</artifactId> <artifactId>themoviedbapi</artifactId>
<version>4.0</version> <version>4.4-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>API-The MovieDB</name> <name>API-The MovieDB</name>
@@ -71,8 +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.5.1</version.jackson> <version.jackson>2.10.0</version.jackson>
<version.slf4j>1.7.10</version.slf4j> <version.slf4j>1.7.25</version.slf4j>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<timestamp>${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyy-MM-dd-HHmm</maven.build.timestamp.format>
<!--Turn off javadoc errors-->
<additionalparam>-Xdoclint:none</additionalparam>
</properties> </properties>
<dependencies> <dependencies>
@@ -80,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-->
@@ -115,219 +121,32 @@
<dependency> <dependency>
<groupId>org.yamj</groupId> <groupId>org.yamj</groupId>
<artifactId>api-common</artifactId> <artifactId>api-common</artifactId>
<version>1.4</version> <version>2.1</version>
</dependency> </dependency>
<!-- Apache Utils --> <!-- Apache Utils -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</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>
<build>
<finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<shortRevisionLength>10</shortRevisionLength>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<failOnError>true</failOnError>
<verbose>true</verbose>
<!-- excludes><exclude>**/*</exclude></excludes -->
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.5</version>
<configuration>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${buildNumber}</Implementation-Version>
<Implementation-Title>${timestamp}</Implementation-Title>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18</version>
<configuration>
<!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<id>create-version-txt</id>
<phase>generate-resources</phase>
<configuration>
<target>
<property name="version_file" value="${project.build.directory}/version.txt" />
<property name="header_line" value="The MovieDb API${line.separator}" />
<property name="build_date_line" value="Build Date: ${timestamp}${line.separator}" />
<property name="version_line" value="Version: ${project.version}${line.separator}" />
<property name="buildnumber_line" value="Git-SHA: ${buildNumber}${line.separator}" />
<echo>Writing version file: ${version_file}</echo>
<echo file="${version_file}" append="false">${header_line}</echo>
<echo file="${version_file}" append="true">${build_date_line}</echo>
<echo file="${version_file}" append="true">${version_line}</echo>
<echo file="${version_file}" append="true">${buildnumber_line}</echo>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/resources/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.4</version>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
<reports>
<report>index</report>
<report>scm</report>
<report>issue-tracking</report>
<report>help</report>
<report>dependency-convergence</report>
<report>summary</report>
<report>dependency-management</report>
<report>dependencies</report>
<report>license</report>
<report>modules</report>
</reports>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9</version>
</plugin>
</reportPlugins>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>2.6.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.7</version>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.8.1</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.8.1</version>
</extension>
<extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.1</version>
</extension>
</extensions>
</build>
<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>
@@ -355,4 +174,200 @@
</profile> </profile>
</profiles> </profiles>
<build>
<finalName>${project.artifactId}-${project.version}-${timestamp}-${git.commit.id.abbrev}</finalName>
<resources>
<resource>
<directory>src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>version.txt</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.21.0</version>
</plugin>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.4</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<dateFormat>yyyy-MM-dd HH:mm:ss z</dateFormat>
<abbrevLength>7</abbrevLength>
<injectAllReactorProjects>true</injectAllReactorProjects>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifestEntries>
<Specification-Title>${project.name}</Specification-Title>
<Specification-Version>${project.version}</Specification-Version>
<Implementation-Version>${buildNumber}</Implementation-Version>
<Implementation-Title>${timestamp}</Implementation-Title>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<!-- To skip tests by default -->
<skipTests>${skipTests}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
<configuration>
<descriptors>
<descriptor>src/main/resources/bin.xml</descriptor>
</descriptors>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<failOnError>true</failOnError>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<configuration>
<reportPlugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<reports>
<report>index</report>
<report>scm</report>
<report>issue-tracking</report>
<report>help</report>
<report>dependency-convergence</report>
<report>summary</report>
<report>dependency-management</report>
<report>dependencies</report>
<report>license</report>
<report>modules</report>
</reports>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</reportPlugins>
</configuration>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9.5</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.9.5</version>
</extension>
<extension>
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.1</version>
</extension>
</extensions>
</build>
</project> </project>
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,21 +28,21 @@ import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
*/ */
public class AppendToResponseBuilder { public class AppendToResponseBuilder {
private StringBuilder response; private final StringBuilder response;
/** /**
* 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.append(method.getPropertyString()); response = new StringBuilder(method.getPropertyString());
} }
/** /**
* 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());
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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);
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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
* *
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API 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.
*
* TheMovieDB API 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 TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.enumeration;
public enum Gender {
MALE(2),
FEMALE(1),
UNKNOWN(0);
private final int type;
private Gender(int type) {
this.type = type;
}
/**
* Get the gender from an integer type
*
* @param type Integer to convert to enum
* @return enum version of param
*/
public static Gender fromInteger(int type) {
for (Gender gender : Gender.values()) {
if (gender.type == type) {
return gender;
}
}
return UNKNOWN;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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
* *
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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
* *
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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
* *
*/ */
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API 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.
*
* TheMovieDB API 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 TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.enumeration;
/**
* Release Type for the video
*
* @author stuar
*/
public enum ReleaseType {
PREMIERE(1),
THEATRICAL_LIMITED(2),
THEATRICAL(3),
DIGITAL(4),
PHYSICAL(5),
TV(6),
UNKNOWN(0);
private final int type;
private ReleaseType(int type) {
this.type = type;
}
/**
* Get the Release Type from an integer type
*
* @param type Integer to convert to enum
* @return enum version of param
*/
public static ReleaseType fromInteger(int type) {
for (ReleaseType rt : ReleaseType.values()) {
if (rt.type == type) {
return rt;
}
}
return UNKNOWN;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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
* *
*/ */
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,6 +32,7 @@ import com.omertron.themoviedbapi.model.list.UserList;
import com.omertron.themoviedbapi.model.media.AlternativeTitle; import com.omertron.themoviedbapi.model.media.AlternativeTitle;
import com.omertron.themoviedbapi.model.movie.MovieBasic; import com.omertron.themoviedbapi.model.movie.MovieBasic;
import com.omertron.themoviedbapi.model.movie.MovieInfo; import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseDates;
import com.omertron.themoviedbapi.model.person.ContentRating; import com.omertron.themoviedbapi.model.person.ContentRating;
import com.omertron.themoviedbapi.model.person.PersonInfo; import com.omertron.themoviedbapi.model.person.PersonInfo;
import com.omertron.themoviedbapi.model.person.PersonFind; import com.omertron.themoviedbapi.model.person.PersonFind;
@@ -48,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;
@@ -67,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<Class, TypeReference>(); 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>>() {
@@ -100,6 +102,8 @@ public class AbstractMethod {
}); });
TYPE_REFS.put(AlternativeTitle.class, new TypeReference<WrapperGenericList<AlternativeTitle>>() { TYPE_REFS.put(AlternativeTitle.class, new TypeReference<WrapperGenericList<AlternativeTitle>>() {
}); });
TYPE_REFS.put(ReleaseDates.class, new TypeReference<WrapperGenericList<ReleaseDates>>() {
});
} }
@@ -121,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!");
} }
@@ -139,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();
} }
@@ -154,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
@@ -186,7 +190,7 @@ public class AbstractMethod {
try { try {
WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class); WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class);
ResultList<ChangeKeyItem> results = new ResultList<ChangeKeyItem>(wrapper.getChangedItems()); ResultList<ChangeKeyItem> results = new ResultList<>(wrapper.getChangedItems());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -50,13 +50,16 @@ public class TmdbAuthentication extends AbstractMethod {
} }
/** /**
* This method is used to generate a valid request token for user based authentication. * This method is used to generate a valid request token for user based
* authentication.
* *
* A request token is required in order to request a session id. * A request token is required in order to request a session id.
* *
* You can generate any number of request tokens but they will expire after 60 minutes. * You can generate any number of request tokens but they will expire after
* 60 minutes.
* *
* As soon as a valid session id has been created the token will be destroyed. * As soon as a valid session id has been created the token will be
* destroyed.
* *
* @return * @return
* @throws MovieDbException * @throws MovieDbException
@@ -75,7 +78,8 @@ public class TmdbAuthentication extends AbstractMethod {
} }
/** /**
* This method is used to generate a session id for user based authentication. * This method is used to generate a session id for user based
* authentication.
* *
* A session id is required in order to use any of the write methods. * A session id is required in order to use any of the write methods.
* *
@@ -102,7 +106,8 @@ public class TmdbAuthentication extends AbstractMethod {
} }
/** /**
* This method is used to generate a session id for user based authentication. User must provide their username and password * This method is used to generate a session id for user based
* authentication. User must provide their username and password
* *
* A session id is required in order to use any of the write methods. * A session id is required in order to use any of the write methods.
* *
@@ -136,14 +141,18 @@ public class TmdbAuthentication extends AbstractMethod {
/** /**
* This method is used to generate a guest session id. * This method is used to generate a guest session id.
* *
* A guest session can be used to rate movies without having a registered TMDb user account. * A guest session can be used to rate movies without having a registered
* TMDb user account.
* *
* You should only generate a single guest session per user (or device) as you will be able to attach the ratings to a TMDb user * You should only generate a single guest session per user (or device) as
* account in the future. * you will be able to attach the ratings to a TMDb user account in the
* future.
* *
* There are also IP limits in place so you should always make sure it's the end user doing the guest session actions. * There are also IP limits in place so you should always make sure it's the
* end user doing the guest session actions.
* *
* If a guest session is not used for the first time within 24 hours, it will be automatically discarded. * If a guest session is not used for the first time within 24 hours, it
* will be automatically discarded.
* *
* @return * @return
* @throws MovieDbException * @throws MovieDbException
@@ -157,4 +166,5 @@ public class TmdbAuthentication extends AbstractMethod {
} catch (IOException ex) { } catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex);
} }
}} }
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -65,7 +65,7 @@ public class TmdbCertifications extends AbstractMethod {
JsonNode node = MAPPER.readTree(webpage); JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() { Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
}); });
return new ResultsMap<String, List<Certification>>(results); return new ResultsMap<>(results);
} catch (IOException ex) { } catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex);
} }
@@ -85,7 +85,7 @@ public class TmdbCertifications extends AbstractMethod {
JsonNode node = MAPPER.readTree(webpage); JsonNode node = MAPPER.readTree(webpage);
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() { Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
}); });
return new ResultsMap<String, List<Certification>>(results); return new ResultsMap<>(results);
} catch (IOException ex) { } catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex);
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -97,7 +97,7 @@ public class TmdbCollections extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP)); ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP));
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -95,7 +95,7 @@ public class TmdbConfiguration extends AbstractMethod {
try { try {
WrapperJobList wrapper = MAPPER.readValue(webpage, WrapperJobList.class); WrapperJobList wrapper = MAPPER.readValue(webpage, WrapperJobList.class);
ResultList<JobDepartment> results = new ResultList<JobDepartment>(wrapper.getJobs()); ResultList<JobDepartment> results = new ResultList<>(wrapper.getJobs());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -121,7 +121,7 @@ public class TmdbConfiguration extends AbstractMethod {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex);
} }
ResultsMap<String, List<String>> timezones = new ResultsMap<String, List<String>>(); ResultsMap<String, List<String>> timezones = new ResultsMap<>();
for (Map<String, List<String>> tzMap : tzList) { for (Map<String, List<String>> tzMap : tzList) {
for (Map.Entry<String, List<String>> x : tzMap.entrySet()) { for (Map.Entry<String, List<String>> x : tzMap.entrySet()) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,7 +28,6 @@ import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.TmdbParameters; import com.omertron.themoviedbapi.tools.TmdbParameters;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import org.slf4j.LoggerFactory;
import org.yamj.api.common.exception.ApiExceptionType; import org.yamj.api.common.exception.ApiExceptionType;
/** /**
@@ -78,7 +77,6 @@ public class TmdbCredits extends AbstractMethod {
try { try {
return MAPPER.readValue(webpage, CreditInfo.class); return MAPPER.readValue(webpage, CreditInfo.class);
} catch (IOException ex) { } catch (IOException ex) {
LoggerFactory.getLogger("test").info("{}",ex);
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex);
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -42,7 +42,6 @@ import com.omertron.themoviedbapi.results.WrapperImages;
import com.omertron.themoviedbapi.results.WrapperVideos; import com.omertron.themoviedbapi.results.WrapperVideos;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import org.slf4j.LoggerFactory;
import org.yamj.api.common.exception.ApiExceptionType; import org.yamj.api.common.exception.ApiExceptionType;
/** /**
@@ -65,7 +64,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* Get the primary information about a TV episode by combination of a season and episode number. * Get the primary information about a TV episode by combination of a season
* and episode number.
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -89,7 +89,6 @@ public class TmdbEpisodes extends AbstractMethod {
try { try {
return MAPPER.readValue(webpage, TVEpisodeInfo.class); return MAPPER.readValue(webpage, TVEpisodeInfo.class);
} catch (IOException ex) { } catch (IOException ex) {
LoggerFactory.getLogger("test").warn("{}", ex);
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex);
} }
} }
@@ -108,7 +107,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* This method lets users get the status of whether or not the TV episode has been rated. * This method lets users get the status of whether or not the TV episode
* has been rated.
* *
* A valid session id is required. * A valid session id is required.
* *
@@ -161,7 +161,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* Get the external ids for a TV episode by comabination of a season and episode number. * Get the external ids for a TV episode by comabination of a season and
* episode number.
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -188,7 +189,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* Get the images (episode stills) for a TV episode by combination of a season and episode number. * Get the images (episode stills) for a TV episode by combination of a
* season and episode number.
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -207,7 +209,7 @@ public class TmdbEpisodes extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll()); ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -216,7 +218,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* This method lets users rate a TV episode. A valid session id or guest session id is required. * This method lets users rate a TV episode. A valid session id or guest
* session id is required.
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -253,7 +256,8 @@ public class TmdbEpisodes extends AbstractMethod {
} }
/** /**
* Get the videos that have been added to a TV episode (teasers, clips, etc...) * Get the videos that have been added to a TV episode (teasers, clips,
* etc...)
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -274,7 +278,7 @@ public class TmdbEpisodes extends AbstractMethod {
try { try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos()); ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -91,7 +91,7 @@ public class TmdbGenres extends AbstractMethod {
try { try {
WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class); WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class);
ResultList<Genre> results = new ResultList<Genre>(wrapper.getGenres()); ResultList<Genre> results = new ResultList<>(wrapper.getGenres());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,6 +32,7 @@ import com.omertron.themoviedbapi.model.media.MediaState;
import com.omertron.themoviedbapi.model.media.Translation; import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video; import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.movie.MovieInfo; import com.omertron.themoviedbapi.model.movie.MovieInfo;
import com.omertron.themoviedbapi.model.movie.ReleaseDates;
import com.omertron.themoviedbapi.model.movie.ReleaseInfo; import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
import com.omertron.themoviedbapi.model.review.Review; import com.omertron.themoviedbapi.model.review.Review;
import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.results.ResultList;
@@ -78,8 +79,7 @@ public class TmdbMovies extends AbstractMethod {
* *
* It will return the single highest rated poster and backdrop. * It will return the single highest rated poster and backdrop.
* *
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies * ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
* found.
* *
* @param movieId * @param movieId
* @param language * @param language
@@ -111,8 +111,7 @@ public class TmdbMovies extends AbstractMethod {
* *
* It will return the single highest rated poster and backdrop. * It will return the single highest rated poster and backdrop.
* *
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies * ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies found.
* found.
* *
* @param imdbId * @param imdbId
* @param language * @param language
@@ -141,8 +140,8 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method lets a user get the status of whether or not the movie has * This method lets a user get the status of whether or not the movie has been rated or added to their favourite or movie watch
* been rated or added to their favourite or movie watch list. * list.
* *
* A valid session id is required. * A valid session id is required.
* *
@@ -167,8 +166,7 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve all of the alternative titles we have for * This method is used to retrieve all of the alternative titles we have for a particular movie.
* a particular movie.
* *
* @param movieId * @param movieId
* @param country * @param country
@@ -184,7 +182,7 @@ public class TmdbMovies extends AbstractMethod {
String webpage = httpTools.getRequest(url); String webpage = httpTools.getRequest(url);
try { try {
WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class); WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class);
ResultList<AlternativeTitle> results = new ResultList<AlternativeTitle>(wrapper.getTitles()); ResultList<AlternativeTitle> results = new ResultList<>(wrapper.getTitles());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -213,8 +211,7 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method should be used when youre wanting to retrieve all of the * This method should be used when youre wanting to retrieve all of the images for a particular movie.
* images for a particular movie.
* *
* @param movieId * @param movieId
* @param language * @param language
@@ -231,7 +228,7 @@ public class TmdbMovies extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll()); ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -240,8 +237,7 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve all of the keywords that have been added * This method is used to retrieve all of the keywords that have been added to a particular movie.
* to a particular movie.
* *
* Currently, only English keywords exist. * Currently, only English keywords exist.
* *
@@ -258,7 +254,7 @@ public class TmdbMovies extends AbstractMethod {
try { try {
WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class); WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class);
ResultList<Keyword> results = new ResultList<Keyword>(wrapper.getKeywords()); ResultList<Keyword> results = new ResultList<>(wrapper.getKeywords());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -267,8 +263,25 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve all of the release and certification data * The recommendations method will let you retrieve the movie recommendations for a particular movie.
* we have for a specific 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.
* *
* @param movieId * @param movieId
* @param language * @param language
@@ -285,7 +298,7 @@ public class TmdbMovies extends AbstractMethod {
try { try {
WrapperReleaseInfo wrapper = MAPPER.readValue(webpage, WrapperReleaseInfo.class); WrapperReleaseInfo wrapper = MAPPER.readValue(webpage, WrapperReleaseInfo.class);
ResultList<ReleaseInfo> results = new ResultList<ReleaseInfo>(wrapper.getCountries()); ResultList<ReleaseInfo> results = new ResultList<>(wrapper.getCountries());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -294,8 +307,7 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve all of the trailers for a particular * This method is used to retrieve all of the trailers for a particular movie.
* movie.
* *
* Supported sites are YouTube and QuickTime. * Supported sites are YouTube and QuickTime.
* *
@@ -314,7 +326,7 @@ public class TmdbMovies extends AbstractMethod {
try { try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos()); ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -323,8 +335,25 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve a list of the available translations for * Get the release dates, certifications and related information by country for a specific movie id.
* a specific movie. *
* The results are keyed by country code and contain a type value.
*
* @param movieId
* @return
* @throws MovieDbException
*/
public ResultList<ReleaseDates> getReleaseDates(int movieId) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.ID, movieId);
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RELEASE_DATES).buildUrl(parameters);
WrapperGenericList<ReleaseDates> wrapper = processWrapper(getTypeReference(ReleaseDates.class), url, "release dates");
return wrapper.getResultsList();
}
/**
* This method is used to retrieve a list of the available translations for a specific movie.
* *
* @param movieId * @param movieId
* @return * @return
@@ -339,7 +368,7 @@ public class TmdbMovies extends AbstractMethod {
try { try {
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations()); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -348,11 +377,9 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* The similar movies method will let you retrieve the similar movies for a * The similar movies method will let you retrieve the similar movies for a particular movie.
* particular movie.
* *
* This data is created dynamically but with the help of users votes on * This data is created dynamically but with the help of users votes on TMDb.
* TMDb.
* *
* The data is much better with movies that have more keywords * The data is much better with movies that have more keywords
* *
@@ -420,8 +447,7 @@ public class TmdbMovies extends AbstractMethod {
* *
* By default, only the last 24 hours of changes are returned. * By default, only the last 24 hours of changes are returned.
* *
* The maximum number of days that can be returned in a single request is * The maximum number of days that can be returned in a single request is 14.
* 14.
* *
* The language is present on fields that are translatable. * The language is present on fields that are translatable.
* *
@@ -513,8 +539,7 @@ public class TmdbMovies extends AbstractMethod {
/** /**
* This method is used to retrieve the movies currently in theatres. * This method is used to retrieve the movies currently in theatres.
* *
* This is a curated list that will normally contain 100 movies. The default * This is a curated list that will normally contain 100 movies. The default response will return 20 movies.
* response will return 20 movies.
* *
* @param language * @param language
* @param page * @param page
@@ -552,8 +577,7 @@ public class TmdbMovies extends AbstractMethod {
} }
/** /**
* This method is used to retrieve the top rated movies that have over 10 * This method is used to retrieve the top rated movies that have over 10 votes on TMDb.
* votes on TMDb.
* *
* The default response will return 20 movies. * The default response will return 20 movies.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -46,7 +46,7 @@ import com.omertron.themoviedbapi.tools.Param;
import com.omertron.themoviedbapi.tools.TmdbParameters; import com.omertron.themoviedbapi.tools.TmdbParameters;
import java.io.IOException; import java.io.IOException;
import java.net.URL; import java.net.URL;
import org.slf4j.LoggerFactory; import org.apache.commons.lang3.StringUtils;
import org.yamj.api.common.exception.ApiExceptionType; import org.yamj.api.common.exception.ApiExceptionType;
/** /**
@@ -79,13 +79,19 @@ public class TmdbPeople extends AbstractMethod {
parameters.add(Param.ID, personId); parameters.add(Param.ID, personId);
parameters.add(Param.APPEND, appendToResponse); parameters.add(Param.APPEND, appendToResponse);
// Switch combined credits for tv & movie.
String atr = (String) parameters.get(Param.APPEND);
if (StringUtils.isNotBlank(atr) && atr.contains("combined_credits")) {
atr = atr.replace("combined_credits", "tv_credits,movie_credits");
parameters.add(Param.APPEND, atr);
}
URL url = new ApiUrl(apiKey, MethodBase.PERSON).buildUrl(parameters); URL url = new ApiUrl(apiKey, MethodBase.PERSON).buildUrl(parameters);
String webpage = httpTools.getRequest(url); String webpage = httpTools.getRequest(url);
try { try {
return MAPPER.readValue(webpage, PersonInfo.class); return MAPPER.readValue(webpage, PersonInfo.class);
} catch (IOException ex) { } catch (IOException ex) {
LoggerFactory.getLogger("test").info("{}", ex);
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex);
} }
} }
@@ -107,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) {
@@ -138,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) {
@@ -171,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) {
@@ -216,7 +222,7 @@ public class TmdbPeople extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll(ArtworkType.PROFILE)); ResultList<Artwork> results = new ResultList<>(wrapper.getAll(ArtworkType.PROFILE));
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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.
* *
@@ -203,13 +182,14 @@ public class TmdbSearch extends AbstractMethod {
try { try {
WrapperMultiSearch wrapper = MAPPER.readValue(webpage, WrapperMultiSearch.class); WrapperMultiSearch wrapper = MAPPER.readValue(webpage, WrapperMultiSearch.class);
ResultList<MediaBasic> results = new ResultList<MediaBasic>(); ResultList<MediaBasic> results = new ResultList<>();
results.getResults().addAll(wrapper.getResults()); results.getResults().addAll(wrapper.getResults());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get multi search", url, ex); throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get multi search", url, ex);
} } }
}
/** /**
* This is a good starting point to start finding people on TMDb. * This is a good starting point to start finding people on TMDb.
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -99,8 +99,7 @@ public class TmdbSeasons extends AbstractMethod {
} }
/** /**
* This method lets users get the status of whether or not the TV episodes * This method lets users get the status of whether or not the TV episodes of a season have been rated.
* of a season have been rated.
* *
* A valid session id is required. * A valid session id is required.
* *
@@ -147,8 +146,7 @@ public class TmdbSeasons extends AbstractMethod {
} }
/** /**
* Get the external ids that we have stored for a TV season by season * Get the external ids that we have stored for a TV season by season number.
* number.
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -194,7 +192,7 @@ public class TmdbSeasons extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll()); ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -203,8 +201,7 @@ public class TmdbSeasons extends AbstractMethod {
} }
/** /**
* Get the videos that have been added to a TV season (trailers, teasers, * Get the videos that have been added to a TV season (trailers, teasers, etc...)
* etc...)
* *
* @param tvID * @param tvID
* @param seasonNumber * @param seasonNumber
@@ -223,7 +220,7 @@ public class TmdbSeasons extends AbstractMethod {
try { try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos()); ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,7 +32,6 @@ import com.omertron.themoviedbapi.model.media.Translation;
import com.omertron.themoviedbapi.model.media.Video; import com.omertron.themoviedbapi.model.media.Video;
import com.omertron.themoviedbapi.model.person.ContentRating; import com.omertron.themoviedbapi.model.person.ContentRating;
import com.omertron.themoviedbapi.model.person.ExternalID; import com.omertron.themoviedbapi.model.person.ExternalID;
import com.omertron.themoviedbapi.model.tv.TVBasic;
import com.omertron.themoviedbapi.model.tv.TVInfo; import com.omertron.themoviedbapi.model.tv.TVInfo;
import com.omertron.themoviedbapi.results.ResultList; import com.omertron.themoviedbapi.results.ResultList;
import com.omertron.themoviedbapi.results.WrapperGenericList; import com.omertron.themoviedbapi.results.WrapperGenericList;
@@ -231,7 +230,7 @@ public class TmdbTV extends AbstractMethod {
try { try {
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class); WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll()); ResultList<Artwork> results = new ResultList<>(wrapper.getAll());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -327,7 +326,7 @@ public class TmdbTV extends AbstractMethod {
try { try {
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class); WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations()); ResultList<Translation> results = new ResultList<>(wrapper.getTranslations());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -354,7 +353,7 @@ public class TmdbTV extends AbstractMethod {
try { try {
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class); WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos()); ResultList<Video> results = new ResultList<>(wrapper.getVideos());
wrapper.setResultProperties(results); wrapper.setResultProperties(results);
return results; return results;
} catch (IOException ex) { } catch (IOException ex) {
@@ -390,13 +389,13 @@ public class TmdbTV extends AbstractMethod {
* @return * @return
* @throws com.omertron.themoviedbapi.MovieDbException * @throws com.omertron.themoviedbapi.MovieDbException
*/ */
public ResultList<TVBasic> getTVOnTheAir(Integer page, String language) throws MovieDbException { public ResultList<TVInfo> getTVOnTheAir(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters(); TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page); parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language); parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ON_THE_AIR).buildUrl(parameters); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ON_THE_AIR).buildUrl(parameters);
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "on the air"); WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "on the air");
return wrapper.getResultsList(); return wrapper.getResultsList();
} }
@@ -411,14 +410,14 @@ public class TmdbTV extends AbstractMethod {
* @return * @return
* @throws com.omertron.themoviedbapi.MovieDbException * @throws com.omertron.themoviedbapi.MovieDbException
*/ */
public ResultList<TVBasic> getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException { public ResultList<TVInfo> getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters(); TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page); parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language); parameters.add(Param.LANGUAGE, language);
parameters.add(Param.TIMEZONE, timezone); parameters.add(Param.TIMEZONE, timezone);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.AIRING_TODAY).buildUrl(parameters); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.AIRING_TODAY).buildUrl(parameters);
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "airing today"); WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "airing today");
return wrapper.getResultsList(); return wrapper.getResultsList();
} }
@@ -435,13 +434,13 @@ public class TmdbTV extends AbstractMethod {
* @return * @return
* @throws com.omertron.themoviedbapi.MovieDbException * @throws com.omertron.themoviedbapi.MovieDbException
*/ */
public ResultList<TVBasic> getTVTopRated(Integer page, String language) throws MovieDbException { public ResultList<TVInfo> getTVTopRated(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters(); TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page); parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language); parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.TOP_RATED).buildUrl(parameters); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.TOP_RATED).buildUrl(parameters);
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "top rated TV shows"); WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "top rated TV shows");
return wrapper.getResultsList(); return wrapper.getResultsList();
} }
@@ -453,13 +452,13 @@ public class TmdbTV extends AbstractMethod {
* @return * @return
* @throws com.omertron.themoviedbapi.MovieDbException * @throws com.omertron.themoviedbapi.MovieDbException
*/ */
public ResultList<TVBasic> getTVPopular(Integer page, String language) throws MovieDbException { public ResultList<TVInfo> getTVPopular(Integer page, String language) throws MovieDbException {
TmdbParameters parameters = new TmdbParameters(); TmdbParameters parameters = new TmdbParameters();
parameters.add(Param.PAGE, page); parameters.add(Param.PAGE, page);
parameters.add(Param.LANGUAGE, language); parameters.add(Param.LANGUAGE, language);
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.POPULAR).buildUrl(parameters); URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.POPULAR).buildUrl(parameters);
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "popular TV shows"); WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "popular TV shows");
return wrapper.getResultsList(); return wrapper.getResultsList();
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -31,7 +31,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class AbstractIdName extends AbstractJsonMapping implements Serializable, Identification { public class AbstractIdName extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
*/ */
public abstract class AbstractJsonMapping implements Serializable { public abstract class AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class); private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class);
/** /**
@@ -45,8 +45,8 @@ public abstract class AbstractJsonMapping implements Serializable {
@JsonAnySetter @JsonAnySetter
protected void handleUnknown(String key, Object value) { protected void handleUnknown(String key, Object value) {
StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName()); StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName());
unknown.append(": Unknown property='").append(key); unknown.append(": Unknown property='").append(key)
unknown.append("' value='").append(value).append("'"); .append("' value='").append(value).append("'");
LOG.trace(unknown.toString()); LOG.trace(unknown.toString());
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -26,7 +26,7 @@ import java.io.Serializable;
@JsonRootName("certification") @JsonRootName("certification")
public class Certification extends AbstractJsonMapping implements Serializable { public class Certification extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
// Properties // Properties
@JsonProperty("certification") @JsonProperty("certification")
private String value; private String value;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -33,7 +33,7 @@ import java.util.List;
*/ */
public class FindResults extends AbstractJsonMapping implements Serializable { public class FindResults extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("movie_results") @JsonProperty("movie_results")
private List<MovieBasic> movieResults; private List<MovieBasic> movieResults;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,6 +28,6 @@ import java.io.Serializable;
@JsonRootName("genre") @JsonRootName("genre")
public class Genre extends AbstractIdName implements Serializable { public class Genre extends AbstractIdName implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
// Nothing to override from the base class. // Nothing to override from the base class.
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -31,23 +31,23 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
@JsonRootName("spoken_language") @JsonRootName("spoken_language")
public class Language extends AbstractJsonMapping implements Serializable { public class Language extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("iso_639_1") @JsonProperty("iso_639_1")
private String isoCode; private String code;
@JsonProperty("name") @JsonProperty("name")
private String name; private String name;
public String getIsoCode() { public String getCode() {
return isoCode; return code;
} }
public String getName() { public String getName() {
return name; return name;
} }
public void setIsoCode(String isoCode) { public void setCode(String code) {
this.isoCode = isoCode; this.code = code;
} }
public void setName(String name) { public void setName(String name) {
@@ -59,7 +59,7 @@ public class Language extends AbstractJsonMapping implements Serializable {
if (obj instanceof Language) { if (obj instanceof Language) {
final Language other = (Language) obj; final Language other = (Language) obj;
return new EqualsBuilder() return new EqualsBuilder()
.append(isoCode, other.isoCode) .append(code, other.code)
.append(name, other.name) .append(name, other.name)
.isEquals(); .isEquals();
} else { } else {
@@ -70,7 +70,7 @@ public class Language extends AbstractJsonMapping implements Serializable {
@Override @Override
public int hashCode() { public int hashCode() {
return new HashCodeBuilder() return new HashCodeBuilder()
.append(isoCode) .append(code)
.append(name) .append(name)
.toHashCode(); .toHashCode();
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
*/ */
public class StatusCode extends AbstractJsonMapping { public class StatusCode extends AbstractJsonMapping {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("status_code") @JsonProperty("status_code")
private int code; private int code;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -22,11 +22,10 @@ package com.omertron.themoviedbapi.model.account;
import com.omertron.themoviedbapi.model.AbstractJsonMapping; import com.omertron.themoviedbapi.model.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.interfaces.Identification; import com.omertron.themoviedbapi.interfaces.Identification;
import java.io.Serializable;
public class Account extends AbstractJsonMapping implements Serializable, Identification { public class Account extends AbstractJsonMapping implements Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -40,6 +39,8 @@ public class Account extends AbstractJsonMapping implements Serializable, Identi
private String language; private String language;
@JsonProperty("iso_3166_1") @JsonProperty("iso_3166_1")
private String country; private String country;
@JsonProperty("avatar")
private Avatar avatar;
@Override @Override
public int getId() { public int getId() {
@@ -90,4 +91,12 @@ public class Account extends AbstractJsonMapping implements Serializable, Identi
public void setCountry(String country) { public void setCountry(String country) {
this.country = country; this.country = country;
} }
public Avatar getAvatar() {
return avatar;
}
public void setAvatar(Avatar avatar) {
this.avatar = avatar;
}
} }
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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 TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model.account;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
public class Avatar extends AbstractJsonMapping {
@JsonProperty("gravatar")
private AvatarHash hash = null;
public String getHash() {
return hash == null ? "" : hash.getHash();
}
public void setHash(AvatarHash hash) {
this.hash = hash;
}
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API 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;private either version 3 of the License;private or
* any later version.
*
* TheMovieDB API is distributed in the hope that it will be useful;private
* 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 TheMovieDB API. If not;private see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model.account;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
public class AvatarHash extends AbstractJsonMapping {
@JsonProperty("hash")
private String hash;
public String getHash() {
return hash;
}
public void setHash(String hash) {
this.hash = hash;
}
}
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -34,7 +34,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class Artwork extends AbstractJsonMapping implements Serializable { public class Artwork extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -38,7 +38,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class ArtworkMedia extends Artwork implements Serializable { public class ArtworkMedia extends Artwork implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
private MediaType mediaType; private MediaType mediaType;
@JsonTypeInfo( @JsonTypeInfo(
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -25,7 +25,7 @@ import java.io.Serializable;
public class TokenAuthorisation extends AbstractJsonMapping implements Serializable { public class TokenAuthorisation extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("expires_at") @JsonProperty("expires_at")
private String expires; private String expires;
@JsonProperty("request_token") @JsonProperty("request_token")
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -25,7 +25,7 @@ import java.io.Serializable;
public class TokenSession extends AbstractJsonMapping implements Serializable { public class TokenSession extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("session_id") @JsonProperty("session_id")
private String sessionId; private String sessionId;
@JsonProperty("success") @JsonProperty("success")
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -27,11 +27,11 @@ import java.util.List;
public class ChangeKeyItem extends AbstractJsonMapping implements Serializable { public class ChangeKeyItem extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("key") @JsonProperty("key")
private String key; private String key;
@JsonProperty("items") @JsonProperty("items")
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>(); private List<ChangedItem> changedItems = new ArrayList<>();
public String getKey() { public String getKey() {
return key; return key;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -25,7 +25,7 @@ import java.io.Serializable;
public class ChangeListItem extends AbstractJsonMapping implements Serializable { public class ChangeListItem extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -25,7 +25,7 @@ import java.io.Serializable;
public class ChangedItem extends AbstractJsonMapping implements Serializable { public class ChangedItem extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@JsonProperty("action") @JsonProperty("action")
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -24,6 +24,7 @@ import com.fasterxml.jackson.annotation.JsonRootName;
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;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.EqualsBuilder; import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder; import org.apache.commons.lang3.builder.HashCodeBuilder;
@@ -34,7 +35,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
@JsonRootName("collection") @JsonRootName("collection")
public class Collection extends AbstractJsonMapping implements Serializable, Identification { public class Collection extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -48,6 +49,24 @@ public class Collection extends AbstractJsonMapping implements Serializable, Ide
private String backdropPath; private String backdropPath;
@JsonProperty("release_date") @JsonProperty("release_date")
private String releaseDate; private String releaseDate;
@JsonProperty("genre_ids")
private List<Integer> genreIds;
@JsonProperty("adult")
private boolean adult;
@JsonProperty("original_language")
private String originalLanguage;
@JsonProperty("original_title")
private String originalTitle;
@JsonProperty("overview")
private String overview;
@JsonProperty("video")
private boolean video;
@JsonProperty("popularity")
private float popularity;
@JsonProperty("vote_average")
private float voteAverage;
@JsonProperty("vote_count")
private int voteCount;
public String getBackdropPath() { public String getBackdropPath() {
return backdropPath; return backdropPath;
@@ -80,6 +99,18 @@ public class Collection extends AbstractJsonMapping implements Serializable, Ide
return name; return name;
} }
public List<Integer> getGenreIds() {
return genreIds;
}
public boolean isAdult() {
return adult;
}
public String getOriginalLanguage() {
return originalLanguage;
}
public void setBackdropPath(String backdropPath) { public void setBackdropPath(String backdropPath) {
this.backdropPath = backdropPath; this.backdropPath = backdropPath;
} }
@@ -105,6 +136,66 @@ public class Collection extends AbstractJsonMapping implements Serializable, Ide
this.name = name; this.name = name;
} }
public void setGenreIds(List<Integer> genreIds) {
this.genreIds = genreIds;
}
public void setAdult(boolean adult) {
this.adult = adult;
}
public void setOriginalLanguage(String originalLanguage) {
this.originalLanguage = originalLanguage;
}
public String getOriginalTitle() {
return originalTitle;
}
public void setOriginalTitle(String originalTitle) {
this.originalTitle = originalTitle;
}
public String getOverview() {
return overview;
}
public void setOverview(String overview) {
this.overview = overview;
}
public boolean isVideo() {
return video;
}
public void setVideo(boolean video) {
this.video = video;
}
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;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof Collection) { if (obj instanceof Collection) {
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,7 +32,7 @@ import java.util.List;
*/ */
public class CollectionInfo extends AbstractJsonMapping implements Serializable, Identification { public class CollectionInfo extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -45,7 +45,7 @@ public class CollectionInfo extends AbstractJsonMapping implements Serializable,
@JsonProperty("backdrop_path") @JsonProperty("backdrop_path")
private String backdropPath; private String backdropPath;
@JsonProperty("parts") @JsonProperty("parts")
private List<Collection> parts = new ArrayList<Collection>(); private List<Collection> parts = new ArrayList<>();
public String getBackdropPath() { public String getBackdropPath() {
return backdropPath; return backdropPath;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,7 +32,7 @@ import static org.apache.commons.lang3.StringUtils.EMPTY;
*/ */
public class Company extends AbstractJsonMapping implements Serializable, Identification { public class Company extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
// Properties // Properties
@JsonProperty("id") @JsonProperty("id")
private int id = 0; private int id = 0;
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -34,7 +34,7 @@ import org.yamj.api.common.exception.ApiExceptionType;
*/ */
public class Configuration extends AbstractJsonMapping implements Serializable { public class Configuration extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("base_url") @JsonProperty("base_url")
private String baseUrl; private String baseUrl;
@@ -199,8 +199,7 @@ public class Configuration extends AbstractJsonMapping implements Serializable {
} }
StringBuilder sb = new StringBuilder(getBaseUrl()); StringBuilder sb = new StringBuilder(getBaseUrl());
sb.append(requiredSize); sb.append(requiredSize).append(imagePath);
sb.append(imagePath);
try { try {
return new URL(sb.toString()); return new URL(sb.toString());
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -26,11 +26,11 @@ import java.util.List;
public class JobDepartment extends AbstractJsonMapping implements Serializable { public class JobDepartment extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
// 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() {
@@ -1,6 +1,6 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -27,13 +27,14 @@ 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
*/ */
public class CreditBasic extends AbstractJsonMapping implements Serializable, Identification { public class CreditBasic extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
private CreditType creditType; private CreditType creditType;
private MediaType mediaType; private MediaType mediaType;
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,7 +28,7 @@ import java.io.Serializable;
*/ */
public class CreditMovieBasic extends CreditBasic implements Serializable { public class CreditMovieBasic extends CreditBasic implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("adult") @JsonProperty("adult")
private boolean adult; private boolean adult;
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,7 +28,7 @@ import java.io.Serializable;
*/ */
public class CreditTVBasic extends CreditBasic implements Serializable { public class CreditTVBasic extends CreditBasic implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("episode_count") @JsonProperty("episode_count")
private int episodeCount; private int episodeCount;
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -30,7 +30,7 @@ import java.io.Serializable;
*/ */
public class MediaCredit extends AbstractJsonMapping implements Serializable, Identification { public class MediaCredit extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("credit_id") @JsonProperty("credit_id")
private String creditId; private String creditId;
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,7 +28,7 @@ import java.io.Serializable;
*/ */
public class MediaCreditCast extends MediaCredit implements Serializable { public class MediaCreditCast extends MediaCredit implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("cast_id") @JsonProperty("cast_id")
private int castId = 0; private int castId = 0;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -28,7 +28,7 @@ import java.io.Serializable;
*/ */
public class MediaCreditCrew extends MediaCredit implements Serializable { public class MediaCreditCrew extends MediaCredit implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("department") @JsonProperty("department")
private String department; private String department;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -25,7 +25,7 @@ import com.omertron.themoviedbapi.tools.TmdbParameters;
/** /**
* Generate a discover object for use in the MovieDbApi * Generate a discover object for use in the MovieDbApi
* <p/> * <p>
* This allows you to just add the search components you are concerned with * This allows you to just add the search components you are concerned with
* *
* @author stuart.boston * @author stuart.boston
@@ -39,7 +39,7 @@ public class Discover {
/** /**
* Get the parameters * Get the parameters
* <p/> * <p>
* This will be used to construct the URL in the API * This will be used to construct the URL in the API
* *
* @return * @return
@@ -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
* *
@@ -183,7 +210,7 @@ public class Discover {
/** /**
* The minimum release to include. * The minimum release to include.
* <p/> * <p>
* Expected format is YYYY-MM-DD. * Expected format is YYYY-MM-DD.
* *
* @param releaseDateGte * @param releaseDateGte
@@ -196,7 +223,7 @@ public class Discover {
/** /**
* The maximum release to include. * The maximum release to include.
* <p/> * <p>
* Expected format is YYYY-MM-DD. * Expected format is YYYY-MM-DD.
* *
* @param releaseDateLte * @param releaseDateLte
@@ -209,9 +236,9 @@ public class Discover {
/** /**
* Only include movies with certifications for a specific country. * Only include movies with certifications for a specific country.
* <p/> * <p>
* When this value is specified, 'certificationLte' is required. * When this value is specified, 'certificationLte' is required.
* <p/> * <p>
* A ISO 3166-1 is expected * A ISO 3166-1 is expected
* *
* @param certificationCountry * @param certificationCountry
@@ -224,7 +251,7 @@ public class Discover {
/** /**
* Only include movies with this certification and lower. * Only include movies with this certification and lower.
* <p/> * <p>
* Expected value is a valid certification for the specified 'certificationCountry'. * Expected value is a valid certification for the specified 'certificationCountry'.
* *
* @param certificationLte * @param certificationLte
@@ -337,11 +364,11 @@ public class Discover {
/** /**
* Only include movies with the specified genres. * Only include movies with the specified genres.
* <p/> * <p>
* Expected value is an integer (the id of a genre). * Expected value is an integer (the id of a genre).
* <p/> * <p>
* Multiple values can be specified. * Multiple values can be specified.
* <p/> * <p>
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR' * Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
* *
* @param withGenres * @param withGenres
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -29,6 +29,6 @@ import java.io.Serializable;
@JsonRootName("keyword") @JsonRootName("keyword")
public class Keyword extends AbstractIdName implements Serializable { public class Keyword extends AbstractIdName implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
// Nothing to override from the base class. // Nothing to override from the base class.
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -33,7 +33,7 @@ import java.util.List;
*/ */
public class ListItem<T> extends AbstractJsonMapping implements Serializable { public class ListItem<T> extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -21,20 +21,29 @@ package com.omertron.themoviedbapi.model.list;
import com.omertron.themoviedbapi.model.AbstractJsonMapping; import com.omertron.themoviedbapi.model.AbstractJsonMapping;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/** /**
* @author Holger Brandl * @author Holger Brandl
*/ */
public class ListItemStatus extends AbstractJsonMapping implements Serializable { public class ListItemStatus extends AbstractJsonMapping {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 101L;
@JsonProperty("id")
private String id;
@JsonProperty("status_code") @JsonProperty("status_code")
private int statusCode; private int statusCode;
@JsonProperty("item_present") @JsonProperty("item_present")
private boolean itemPresent; private boolean itemPresent;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public int getStatusCode() { public int getStatusCode() {
return statusCode; return statusCode;
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -30,7 +30,7 @@ import java.io.Serializable;
*/ */
public class UserList extends AbstractJsonMapping implements Serializable { public class UserList extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -29,12 +29,14 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class AlternativeTitle implements Serializable { public class AlternativeTitle implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("iso_3166_1") @JsonProperty("iso_3166_1")
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();
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -33,7 +33,7 @@ import java.io.Serializable;
*/ */
public class MediaBasic extends AbstractJsonMapping implements Serializable, Identification { public class MediaBasic extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -33,7 +33,7 @@ import java.util.List;
*/ */
public class MediaCreditList extends AbstractJsonMapping implements Serializable, Identification { public class MediaCreditList extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id = 0; private int id = 0;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -31,7 +31,7 @@ import java.io.Serializable;
*/ */
public class MediaState extends AbstractJsonMapping implements Serializable, Identification { public class MediaState extends AbstractJsonMapping implements Serializable, Identification {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private int id; private int id;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -29,7 +29,7 @@ import java.io.Serializable;
*/ */
public class RatedValue extends AbstractJsonMapping implements Serializable { public class RatedValue extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("value") @JsonProperty("value")
private float value = -1f; private float value = -1f;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class Trailer extends AbstractJsonMapping implements Serializable { public class Trailer extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("name") @JsonProperty("name")
private String name; private String name;
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,39 +32,49 @@ import org.apache.commons.lang3.builder.ToStringStyle;
*/ */
public class Translation extends AbstractJsonMapping implements Serializable { public class Translation extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("english_name") @JsonProperty("english_name")
private String englishName; private String englishName;
@JsonProperty("iso_639_1") @JsonProperty("iso_639_1")
private String isoCode; private String language;
@JsonProperty("name") @JsonProperty("name")
private String name; private String name;
@JsonProperty("iso_3166_1")
private String country;
public String getEnglishName() { public String getEnglishName() {
return englishName; return englishName;
} }
public String getIsoCode() { public String getLanguage() {
return isoCode; return language;
} }
public String getName() { public String getName() {
return name; return name;
} }
public String getCountry() {
return country;
}
public void setEnglishName(String englishName) { public void setEnglishName(String englishName) {
this.englishName = englishName; this.englishName = englishName;
} }
public void setIsoCode(String isoCode) { public void setLanguage(String language) {
this.isoCode = isoCode; this.language = language;
} }
public void setName(String name) { public void setName(String name) {
this.name = name; this.name = name;
} }
public void setCountry(String country) {
this.country = country;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof Translation) { if (obj instanceof Translation) {
@@ -72,7 +82,7 @@ public class Translation extends AbstractJsonMapping implements Serializable {
return new EqualsBuilder() return new EqualsBuilder()
.append(name, other.name) .append(name, other.name)
.append(englishName, other.englishName) .append(englishName, other.englishName)
.append(isoCode, other.isoCode) .append(language, other.language)
.isEquals(); .isEquals();
} else { } else {
return false; return false;
@@ -83,7 +93,7 @@ public class Translation extends AbstractJsonMapping implements Serializable {
public int hashCode() { public int hashCode() {
return new HashCodeBuilder() return new HashCodeBuilder()
.append(englishName) .append(englishName)
.append(isoCode) .append(language)
.append(name) .append(name)
.toHashCode(); .toHashCode();
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,12 +32,10 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
*/ */
public class Video extends AbstractJsonMapping implements Serializable { public class Video extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("id") @JsonProperty("id")
private String id; private String id;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("key") @JsonProperty("key")
private String key; private String key;
@JsonProperty("name") @JsonProperty("name")
@@ -48,6 +46,10 @@ public class Video extends AbstractJsonMapping implements Serializable {
private int size; private int size;
@JsonProperty("type") @JsonProperty("type")
private String type; private String type;
@JsonProperty("iso_639_1")
private String language;
@JsonProperty("iso_3166_1")
private String country;
public String getId() { public String getId() {
return id; return id;
@@ -77,6 +79,10 @@ public class Video extends AbstractJsonMapping implements Serializable {
return language; return language;
} }
public String getCountry() {
return country;
}
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
} }
@@ -105,6 +111,10 @@ public class Video extends AbstractJsonMapping implements Serializable {
this.language = language; this.language = language;
} }
public void setCountry(String country) {
this.country = country;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (obj instanceof Video) { if (obj instanceof Video) {
@@ -115,6 +125,7 @@ public class Video extends AbstractJsonMapping implements Serializable {
.append(size, other.size) .append(size, other.size)
.append(key, other.key) .append(key, other.key)
.append(language, other.language) .append(language, other.language)
.append(country, other.country)
.isEquals(); .isEquals();
} else { } else {
return false; return false;
@@ -130,6 +141,7 @@ public class Video extends AbstractJsonMapping implements Serializable {
.append(key) .append(key)
.append(site) .append(site)
.append(language) .append(language)
.append(country)
.toHashCode(); .toHashCode();
} }
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -23,6 +23,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.enumeration.MediaType; import com.omertron.themoviedbapi.enumeration.MediaType;
import com.omertron.themoviedbapi.model.media.MediaBasic; import com.omertron.themoviedbapi.model.media.MediaBasic;
import java.io.Serializable; import java.io.Serializable;
import java.util.List;
/** /**
* Basic Movie information * Basic Movie information
@@ -31,8 +32,10 @@ import java.io.Serializable;
*/ */
public class MovieBasic extends MediaBasic implements Serializable { public class MovieBasic extends MediaBasic implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("_id")
private String mediaId;
@JsonProperty("adult") @JsonProperty("adult")
private boolean adult; private boolean adult;
@JsonProperty("original_title") @JsonProperty("original_title")
@@ -45,11 +48,27 @@ public class MovieBasic extends MediaBasic implements Serializable {
private Boolean video = null; private Boolean video = null;
@JsonProperty("rating") @JsonProperty("rating")
private float userRating = -1f; private float userRating = -1f;
@JsonProperty("genre_ids")
private List<Integer> genreIds;
@JsonProperty("original_language")
private String originalLanguage;
@JsonProperty("overview")
private String overview;
@JsonProperty("revenue")
private long revenue = 0L;
public MovieBasic() { public MovieBasic() {
super.setMediaType(MediaType.MOVIE); super.setMediaType(MediaType.MOVIE);
} }
public String getMediaId() {
return mediaId;
}
public void setMediaId(String mediaId) {
this.mediaId = mediaId;
}
public boolean isAdult() { public boolean isAdult() {
return adult; return adult;
} }
@@ -86,7 +105,7 @@ public class MovieBasic extends MediaBasic implements Serializable {
return video; return video;
} }
public void setVideo(boolean video) { public void setVideo(Boolean video) {
this.video = video; this.video = video;
} }
@@ -97,4 +116,36 @@ public class MovieBasic extends MediaBasic implements Serializable {
public void setUserRating(float userRating) { public void setUserRating(float userRating) {
this.userRating = userRating; this.userRating = userRating;
} }
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 long getRevenue() {
return revenue;
}
public void setRevenue(long revenue) {
this.revenue = revenue;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -53,13 +53,13 @@ import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
* Movie Bean * Movie Info
* *
* @author stuart.boston * @author stuart.boston
*/ */
public class MovieInfo extends MovieBasic implements Serializable, Identification, AppendToResponse<MovieMethod> { public class MovieInfo extends MovieBasic implements Serializable, Identification, AppendToResponse<MovieMethod> {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("belongs_to_collection") @JsonProperty("belongs_to_collection")
private Collection belongsToCollection; private Collection belongsToCollection;
@@ -71,18 +71,12 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
private String homepage; private String homepage;
@JsonProperty("imdb_id") @JsonProperty("imdb_id")
private String imdbID; private String imdbID;
@JsonProperty("overview")
private String overview;
@JsonProperty("production_companies") @JsonProperty("production_companies")
private List<ProductionCompany> productionCompanies = Collections.emptyList(); private List<ProductionCompany> productionCompanies = Collections.emptyList();
@JsonProperty("production_countries") @JsonProperty("production_countries")
private List<ProductionCountry> productionCountries = Collections.emptyList(); private List<ProductionCountry> productionCountries = Collections.emptyList();
@JsonProperty("revenue")
private long revenue;
@JsonProperty("runtime") @JsonProperty("runtime")
private int runtime; private int runtime;
@JsonProperty("original_language")
private String originalLanguage;
@JsonProperty("spoken_languages") @JsonProperty("spoken_languages")
private List<Language> spokenLanguages = Collections.emptyList(); private List<Language> spokenLanguages = Collections.emptyList();
@JsonProperty("tagline") @JsonProperty("tagline")
@@ -100,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();
@@ -125,10 +120,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
return imdbID; return imdbID;
} }
public String getOverview() {
return overview;
}
public List<ProductionCompany> getProductionCompanies() { public List<ProductionCompany> getProductionCompanies() {
return productionCompanies; return productionCompanies;
} }
@@ -137,10 +128,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
return productionCountries; return productionCountries;
} }
public long getRevenue() {
return revenue;
}
public int getRuntime() { public int getRuntime() {
return runtime; return runtime;
} }
@@ -156,10 +143,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
public String getStatus() { public String getStatus() {
return status; return status;
} }
public String getOriginalLanguage() {
return originalLanguage;
}
// </editor-fold> // </editor-fold>
// <editor-fold defaultstate="collapsed" desc="Setter methods"> // <editor-fold defaultstate="collapsed" desc="Setter methods">
@@ -183,10 +166,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
this.imdbID = imdbID; this.imdbID = imdbID;
} }
public void setOverview(String overview) {
this.overview = overview;
}
public void setProductionCompanies(List<ProductionCompany> productionCompanies) { public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
this.productionCompanies = productionCompanies; this.productionCompanies = productionCompanies;
} }
@@ -195,10 +174,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
this.productionCountries = productionCountries; this.productionCountries = productionCountries;
} }
public void setRevenue(long revenue) {
this.revenue = revenue;
}
public void setRuntime(int runtime) { public void setRuntime(int runtime) {
this.runtime = runtime; this.runtime = runtime;
} }
@@ -214,10 +189,6 @@ public class MovieInfo extends MovieBasic implements Serializable, Identificatio
public void setStatus(String status) { public void setStatus(String status) {
this.status = status; this.status = status;
} }
public void setOriginalLanguage(String originalLanguage) {
this.originalLanguage = originalLanguage;
}
// </editor-fold> // </editor-fold>
//<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters"> //<editor-fold defaultstate="collapsed" desc="AppendToResponse Getters">
@@ -325,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();
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -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;
@@ -29,6 +30,26 @@ import java.io.Serializable;
@JsonRootName("production_company") @JsonRootName("production_company")
public class ProductionCompany extends AbstractIdName implements Serializable { public class ProductionCompany extends AbstractIdName implements Serializable {
private static final long serialVersionUID = 4L; 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;
}
} }
@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004-2015 Stuart Boston * Copyright (c) 2004-2016 Stuart Boston
* *
* This file is part of TheMovieDB API. * This file is part of TheMovieDB API.
* *
@@ -32,7 +32,7 @@ import org.apache.commons.lang3.builder.HashCodeBuilder;
@JsonRootName("production_country") @JsonRootName("production_country")
public class ProductionCountry extends AbstractJsonMapping implements Serializable { public class ProductionCountry extends AbstractJsonMapping implements Serializable {
private static final long serialVersionUID = 4L; private static final long serialVersionUID = 100L;
@JsonProperty("iso_3166_1") @JsonProperty("iso_3166_1")
private String country; private String country;
@@ -0,0 +1,29 @@
package com.omertron.themoviedbapi.model.movie;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
public class Release extends AbstractJsonMapping {
@JsonProperty("certification")
private String certification;
@JsonProperty("release_date")
private String releaseDate;
public String getCertification() {
return certification;
}
public void setCertification(String certification) {
this.certification = certification;
}
public String getReleaseDate() {
return releaseDate;
}
public void setReleaseDate(String releaseDate) {
this.releaseDate = releaseDate;
}
}
@@ -0,0 +1,61 @@
/*
* Copyright (c) 2004-2016 Stuart Boston
*
* This file is part of TheMovieDB API.
*
* TheMovieDB API 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.
*
* TheMovieDB API 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 TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
*
*/
package com.omertron.themoviedbapi.model.movie;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSetter;
import com.omertron.themoviedbapi.enumeration.ReleaseType;
public class ReleaseDate extends Release {
private static final long serialVersionUID = 100L;
@JsonProperty("note")
private String note;
@JsonProperty("iso_639_1")
private String language;
private ReleaseType releaseType;
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
public ReleaseType getType() {
return releaseType;
}
@JsonSetter("type")
public void setType(int type) {
this.releaseType = ReleaseType.fromInteger(type);
}
}

Some files were not shown because too many files have changed in this diff Show More