Compare commits
308 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a1e120431 | |||
| 1d85c8b9d4 | |||
| b7e1f42dcf | |||
| e6e7fcc83e | |||
| 84243703e3 | |||
| c94688b0e1 | |||
| 8dadd91bf5 | |||
| 6e5873b7af | |||
| 5a1719c662 | |||
| 7c72a1fa92 | |||
| c2887f2f8c | |||
| 99896ca027 | |||
| 6e24cbe1d1 | |||
| 01fba3b235 | |||
| 21e1e55633 | |||
| a3f001a4d9 | |||
| f6a09940c1 | |||
| 6984049f44 | |||
| 3bd448220d | |||
| 8e11e975b7 | |||
| 28c814c1f0 | |||
| e5f2f1eaa9 | |||
| 8e68dd6dde | |||
| ebada5f008 | |||
| 91b86d9fd0 | |||
| c669689490 | |||
| a60d066993 | |||
| 1aa6e5bbf8 | |||
| 53aeac2b3e | |||
| d3942ccfb6 | |||
| 90e6891088 | |||
| d03adbfb38 | |||
| 564b00f423 | |||
| a89cd9c923 | |||
| 23fffe38cf | |||
| 2a46dc02dd | |||
| 9245984ca2 | |||
| 5c56e20f73 | |||
| 573d97c906 | |||
| a21e09a7ae | |||
| 1b1e2d8f67 | |||
| a05d6bb2b2 | |||
| f7d441468a | |||
| 455957b6f2 | |||
| 1af4e39815 | |||
| 9693aa458d | |||
| f713bde372 | |||
| f75e910a09 | |||
| 29c8aa5deb | |||
| 60df7278d4 | |||
| ee0c6e12f2 | |||
| 59f806b27e | |||
| b35c4beb45 | |||
| 34c019a86c | |||
| c8e71db71f | |||
| 27dcc56492 | |||
| 286b748a34 | |||
| ffdeb4c1b8 | |||
| 2c9f671345 | |||
| 591ccdc0f1 | |||
| 25e22919a5 | |||
| 8d2fbb8fa9 | |||
| ccd6f7411c | |||
| 590852c5ac | |||
| e95de23049 | |||
| 9f5a8b1650 | |||
| aa9f52f3c3 | |||
| 24ac470ede | |||
| 51593fbc52 | |||
| f107862285 | |||
| 8cb14aeb27 | |||
| dd3e04e6d1 | |||
| 3828eca965 | |||
| 1f1054995d | |||
| 0e57603b02 | |||
| 998c19f46b | |||
| 4f32632e52 | |||
| 577a25c81f | |||
| d7242984f7 | |||
| 7a9ea47d4b | |||
| d80f15a52d | |||
| 4db6d22d5b | |||
| 306f6f3cc2 | |||
| 5dd6ed7d60 | |||
| aa6bb1e252 | |||
| d0ec5c3b18 | |||
| 2697e3fcf2 | |||
| 4835cd426c | |||
| dada02db89 | |||
| e9945654c9 | |||
| e850ba1589 | |||
| e118f56f99 | |||
| 173792dc2e | |||
| df11f93ed7 | |||
| 3ebdce3c35 | |||
| ed987dd051 | |||
| 0143f31bbc | |||
| 4efc282eed | |||
| c93600fff5 | |||
| 9c473bf24b | |||
| 7c193d996b | |||
| 46a50703d7 | |||
| 45b66ef0b1 | |||
| d97e39c77e | |||
| c22ac9333e | |||
| bbc85c09c4 | |||
| bc333a4cb6 | |||
| 2c71a1485c | |||
| 8522ac4171 | |||
| 50820a437f | |||
| 6231130d46 | |||
| a129692ae3 | |||
| 57673d3f11 | |||
| d3c508aabf | |||
| 5b4acf1f8c | |||
| 45caa4d14d | |||
| e4dc8e9465 | |||
| 3e1b0f268b | |||
| 5642d7c99e | |||
| 410df1f056 | |||
| 69d2eba4db | |||
| 77b6ae5f60 | |||
| 77f1cf18e7 | |||
| 7f3f6f7d25 | |||
| 59c1b1f3ea | |||
| e9ef62d031 | |||
| 9ea18f546d | |||
| dc7e8c9600 | |||
| be963f38a6 | |||
| febc5185a4 | |||
| c88fde759c | |||
| 110b77d09a | |||
| dc6a49bc97 | |||
| af2d8400fc | |||
| a22a49cbf3 | |||
| ba64e339b1 | |||
| debfb1209e | |||
| e5e7cd1ac3 | |||
| 3078d12005 | |||
| 1e01a4e7df | |||
| c3edbc2aad | |||
| 9d396d32e5 | |||
| 4b95807845 | |||
| 97f3313d8c | |||
| bbda0eec72 | |||
| 84e59d53eb | |||
| 207f7f2488 | |||
| 87646c08e6 | |||
| cef5f8f6f0 | |||
| dd2a35b54c | |||
| c6e9c3fcf5 | |||
| 47f1521bf9 | |||
| 47ed93b69f | |||
| e736aee48a | |||
| 6eda79830e | |||
| ba0c8bc564 | |||
| 6722019db8 | |||
| 58a2858002 | |||
| f45429859e | |||
| 8a0d67f784 | |||
| abf69af81d | |||
| b0541d55e4 | |||
| b6cfb42170 | |||
| 783b076ead | |||
| 761daeb11a | |||
| 035b998511 | |||
| b353311169 | |||
| 588c618208 | |||
| 5eb756e03e | |||
| 9c58841c6c | |||
| 64ee879834 | |||
| 56a0cdb341 | |||
| aa522e2e7e | |||
| 67496724ba | |||
| 6b5eb2f5ad | |||
| 1189d6babd | |||
| 82c8b31f9f | |||
| d25c09f219 | |||
| 75c9142385 | |||
| d5fc5e279d | |||
| 00b24e3bdc | |||
| 8572433707 | |||
| a2f88915a5 | |||
| f05dbb817f | |||
| 6ed9d9ea4c | |||
| 2e7c85a41a | |||
| 4ee48e15c2 | |||
| 1e1cceceac | |||
| 48a8ff4e29 | |||
| c2d2c7cbe3 | |||
| 5c6f6fd9b1 | |||
| f908794e2b | |||
| 85eb7a5a4a | |||
| d7fd35c4d5 | |||
| e465c9cfdd | |||
| 46bfa7a324 | |||
| 021daccadc | |||
| 421084737c | |||
| 88f120923e | |||
| d5c996aef6 | |||
| 8c1aabf1d3 | |||
| c0653861c0 | |||
| d3c0c70fc9 | |||
| 67b4efe77c | |||
| 917c3bb029 | |||
| 68cbc9b54b | |||
| e2f1008d01 | |||
| 51b202df2d | |||
| d84582d336 | |||
| 121838598d | |||
| cd09cf8dfe | |||
| 3a53039b3e | |||
| f7b37a1eb9 | |||
| 52c19f98d4 | |||
| 796459b816 | |||
| eaf5849a43 | |||
| 231f60624b | |||
| 3b1855d75c | |||
| 0cfa4d0dd4 | |||
| 971ee44375 | |||
| 359a0d56a3 | |||
| 8eea8c796a | |||
| 82e9c5b06f | |||
| 57691ed17f | |||
| b705a85566 | |||
| db4f3e6f80 | |||
| 9eed62c8d7 | |||
| 51e5166233 | |||
| dd5176d6c6 | |||
| 6448542fb4 | |||
| 1ac805bed3 | |||
| 2ef41457d0 | |||
| d3338cc106 | |||
| 2c5569d53d | |||
| 546a1e0d93 | |||
| 3b503e78ef | |||
| 4cb0314c56 | |||
| 95b3a4dd36 | |||
| 8068b9ac45 | |||
| a25da9aa2f | |||
| 7a30ab831c | |||
| f64786e506 | |||
| a57e7eeb37 | |||
| 00bdfaf6a7 | |||
| 064117e66d | |||
| a520c75773 | |||
| 259eb81f32 | |||
| 8bfe7dcc1b | |||
| ac57816b1d | |||
| 073331cddb | |||
| 0ef278e19d | |||
| d6e02bf1df | |||
| fbdf744dc6 | |||
| 8478865141 | |||
| a98eac75dc | |||
| 9a237042f0 | |||
| bb57c16fe8 | |||
| 72186feaf9 | |||
| 20349013cc | |||
| c8e33abd59 | |||
| 940b6a007f | |||
| 822ac2a5d2 | |||
| f2593b2754 | |||
| 24f7b507b9 | |||
| d298faec9a | |||
| 486486b753 | |||
| 159fe23efb | |||
| fc1e05d0b4 | |||
| dc6f5f07b1 | |||
| 4243b5aa81 | |||
| 1070abcabc | |||
| 9cca4660bc | |||
| 5f27260f57 | |||
| bec9b24129 | |||
| 8679b03930 | |||
| 845aedf871 | |||
| d6adc40215 | |||
| 17815b9ffc | |||
| 60cb490eca | |||
| f08c78c921 | |||
| 0414369327 | |||
| 44ba85aaa8 | |||
| 009e725cb6 | |||
| edf4518f35 | |||
| c6248b621e | |||
| 7900b6d25b | |||
| 4747c42fc6 | |||
| 1a96343924 | |||
| 76191c13c0 | |||
| ce533c2b41 | |||
| de623ff0db | |||
| 6745f5f3d5 | |||
| 955ef0369e | |||
| 4c682731b6 | |||
| c99f60f636 | |||
| 265878d016 | |||
| 9bf7175ee8 | |||
| 00063cc85d | |||
| 2f7468914c | |||
| 4d9d53421f | |||
| 9f135c3ca7 | |||
| 7d9552a08c | |||
| 3acf07b36a | |||
| f501126b76 | |||
| 8ab8699dd5 | |||
| 6c4ba2a492 | |||
| 44df73f2d1 | |||
| 98a1b5d1b9 |
@@ -0,0 +1,22 @@
|
|||||||
|
# Auto detect text files and perform LF normalization
|
||||||
|
* text=auto
|
||||||
|
|
||||||
|
# Custom for Visual Studio
|
||||||
|
*.cs diff=csharp
|
||||||
|
*.sln merge=union
|
||||||
|
*.csproj merge=union
|
||||||
|
*.vbproj merge=union
|
||||||
|
*.fsproj merge=union
|
||||||
|
*.dbproj merge=union
|
||||||
|
|
||||||
|
# Standard to msysgit
|
||||||
|
*.doc diff=astextplain
|
||||||
|
*.DOC diff=astextplain
|
||||||
|
*.docx diff=astextplain
|
||||||
|
*.DOCX diff=astextplain
|
||||||
|
*.dot diff=astextplain
|
||||||
|
*.DOT diff=astextplain
|
||||||
|
*.pdf diff=astextplain
|
||||||
|
*.PDF diff=astextplain
|
||||||
|
*.rtf diff=astextplain
|
||||||
|
*.RTF diff=astextplain
|
||||||
+8
-2
@@ -1,8 +1,14 @@
|
|||||||
*.class
|
*.class
|
||||||
|
|
||||||
# Package Files #
|
# Package Files #
|
||||||
*.jar
|
*.jar
|
||||||
*.war
|
*.war
|
||||||
*.ear
|
*.ear
|
||||||
|
*.bin
|
||||||
/target/
|
/target/
|
||||||
|
/nbactions.xml
|
||||||
|
testing.properties
|
||||||
|
*.bin
|
||||||
|
.settings
|
||||||
|
.classpath
|
||||||
|
.project
|
||||||
|
.DS_Store
|
||||||
@@ -3,17 +3,37 @@ The Movie DB API
|
|||||||
|
|
||||||
Author: Stuart Boston (Omertron AT Gmail DOT com)
|
Author: Stuart Boston (Omertron AT Gmail DOT com)
|
||||||
|
|
||||||
This API uses the TheMovieDB.org API as specified here http://api.themoviedb.org/
|
This API uses the [TheMovieDB.org API](http://api.themoviedb.org/)
|
||||||
|
|
||||||
Originally written for use by YetAnotherMovieJukebox (YAMJ) http://code.google.com/p/moviejukebox/
|
Originally written for use by Yet Another Movie Jukebox [(YAMJ)](http://code.google.com/p/moviejukebox/)
|
||||||
But anyone can feel free to use it for other projects as well.
|
|
||||||
|
|
||||||
TheMovieDB.org is an excellent open database for movie and film content. I encourage you to check it out and contribute to keep it growing.
|
But anyone can use it for other projects as well.
|
||||||
http://www.themoviedb.org
|
|
||||||
|
|
||||||
|
[](https://flattr.com/submit/auto?user_id=Omertron&url=https://github.com/Omertron/api-themoviedb&title=TheMovieDB API&language=&tags=github&category=software)
|
||||||
|
|
||||||
|
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||||
|
***
|
||||||
|
|
||||||
|
TMDB TV Support
|
||||||
|
===============
|
||||||
|
|
||||||
|
Release 4.0 of the API now includes TV shows.
|
||||||
|
|
||||||
|
This has resulted in a complete re-write of the API and many of the methods and models have been re-written to support the new TV calls.
|
||||||
|
|
||||||
|
|
||||||
|
***
|
||||||
|
### TheMovieDB.org
|
||||||
|
This is an excellent open database for movie and film content.
|
||||||
|
|
||||||
|
I *strongly* encourage you to check it out and contribute to keep it growing.
|
||||||
|
|
||||||
|
### http://www.themoviedb.org
|
||||||
|
***
|
||||||
Project Logging
|
Project Logging
|
||||||
---------------
|
---------------
|
||||||
This project uses SLF4J (http://www.slf4j.org) to abstract the logging in the project.
|
This project uses [SLF4J](http://www.slf4j.org) to abstract the logging in the project.
|
||||||
|
|
||||||
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
|
To use the logging in your own project you should add one of the bindings listed [HERE](http://www.slf4j.org/manual.html#swapping)
|
||||||
|
|
||||||
Project Documentation
|
Project Documentation
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>org.sonatype.oss</groupId>
|
<groupId>org.sonatype.oss</groupId>
|
||||||
<artifactId>oss-parent</artifactId>
|
<artifactId>oss-parent</artifactId>
|
||||||
<version>7</version>
|
<version>9</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<prerequisites>
|
<prerequisites>
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
<groupId>com.omertron</groupId>
|
<groupId>com.omertron</groupId>
|
||||||
<artifactId>themoviedbapi</artifactId>
|
<artifactId>themoviedbapi</artifactId>
|
||||||
<version>3.4</version>
|
<version>4.0</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>API-The MovieDB</name>
|
<name>API-The MovieDB</name>
|
||||||
@@ -62,7 +62,7 @@
|
|||||||
</issueManagement>
|
</issueManagement>
|
||||||
|
|
||||||
<ciManagement>
|
<ciManagement>
|
||||||
<system>Hudson CI</system>
|
<system>Jenkins CI</system>
|
||||||
<url>http://jenkins.omertron.com/job/API-TheMovieDb/</url>
|
<url>http://jenkins.omertron.com/job/API-TheMovieDb/</url>
|
||||||
</ciManagement>
|
</ciManagement>
|
||||||
|
|
||||||
@@ -71,64 +71,74 @@
|
|||||||
<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.slf4j>1.7.10</version.slf4j>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<!--TESTING-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>junit</groupId>
|
<groupId>junit</groupId>
|
||||||
<artifactId>junit</artifactId>
|
<artifactId>junit</artifactId>
|
||||||
<version>4.11</version>
|
<version>4.12</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--JSON-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-core</artifactId>
|
<artifactId>jackson-core</artifactId>
|
||||||
<version>2.1.4</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-annotations</artifactId>
|
<artifactId>jackson-annotations</artifactId>
|
||||||
<version>2.1.4</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
<artifactId>jackson-databind</artifactId>
|
<artifactId>jackson-databind</artifactId>
|
||||||
<version>2.1.4</version>
|
<version>${version.jackson}</version>
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>commons-codec</groupId>
|
|
||||||
<artifactId>commons-codec</artifactId>
|
|
||||||
<version>1.7</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.commons</groupId>
|
|
||||||
<artifactId>commons-lang3</artifactId>
|
|
||||||
<version>3.1</version>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!--LOGGING-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-api</artifactId>
|
<artifactId>slf4j-api</artifactId>
|
||||||
<version>1.7.3</version>
|
<version>${version.slf4j}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
<artifactId>slf4j-jdk14</artifactId>
|
<artifactId>slf4j-jdk14</artifactId>
|
||||||
<version>1.7.3</version>
|
<version>${version.slf4j}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<!--COMMON HTTP TOOLS-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yamj</groupId>
|
||||||
|
<artifactId>api-common</artifactId>
|
||||||
|
<version>1.4</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Apache Utils -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>${project.artifactId}-${project.version}-r${buildNumber}</finalName>
|
<finalName>${project.artifactId}-${project.version}-${buildNumber}</finalName>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||||
<version>1.2</version>
|
<version>1.3</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
|
<shortRevisionLength>10</shortRevisionLength>
|
||||||
<revisionOnScmFailure>0000</revisionOnScmFailure>
|
<doCheck>false</doCheck>
|
||||||
|
<doUpdate>false</doUpdate>
|
||||||
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
|
<timestampFormat>{0,date,yyyy-MM-dd HH:mm:ss}</timestampFormat>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
@@ -140,22 +150,22 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.0</version>
|
<version>3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>1.6</source>
|
|
||||||
<target>1.6</target>
|
|
||||||
<failOnError>true</failOnError>
|
<failOnError>true</failOnError>
|
||||||
<verbose>true</verbose>
|
<verbose>true</verbose>
|
||||||
<!-- excludes><exclude>**/*</exclude></excludes -->
|
<!-- excludes><exclude>**/*</exclude></excludes -->
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.5</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<archive>
|
<archive>
|
||||||
<manifestEntries>
|
<manifestEntries>
|
||||||
@@ -167,15 +177,17 @@
|
|||||||
</archive>
|
</archive>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<version>2.13</version>
|
<version>2.18</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- To skip tests by default -->
|
<!-- To skip tests by default -->
|
||||||
<skipTests>${skipTests}</skipTests>
|
<skipTests>${skipTests}</skipTests>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-antrun-plugin</artifactId>
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
@@ -190,12 +202,12 @@
|
|||||||
<property name="header_line" value="The MovieDb API${line.separator}" />
|
<property name="header_line" value="The MovieDb API${line.separator}" />
|
||||||
<property name="build_date_line" value="Build Date: ${timestamp}${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="version_line" value="Version: ${project.version}${line.separator}" />
|
||||||
<!--<property name="revision_line" value="Revision: r${buildNumber}${line.separator}" />-->
|
<property name="buildnumber_line" value="Git-SHA: ${buildNumber}${line.separator}" />
|
||||||
<echo>Writing version file: ${version_file}</echo>
|
<echo>Writing version file: ${version_file}</echo>
|
||||||
<echo file="${version_file}" append="false">${header_line}</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">${build_date_line}</echo>
|
||||||
<echo file="${version_file}" append="true">${version_line}</echo>
|
<echo file="${version_file}" append="true">${version_line}</echo>
|
||||||
<!--<echo file="${version_file}" append="true">${revision_line}</echo>-->
|
<echo file="${version_file}" append="true">${buildnumber_line}</echo>
|
||||||
</target>
|
</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<goals>
|
<goals>
|
||||||
@@ -204,10 +216,11 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.5.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>distro-assembly</id>
|
<id>distro-assembly</id>
|
||||||
@@ -223,15 +236,17 @@
|
|||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.codehaus.mojo</groupId>
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
<artifactId>versions-maven-plugin</artifactId>
|
<artifactId>versions-maven-plugin</artifactId>
|
||||||
<version>2.0</version>
|
<version>2.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-site-plugin</artifactId>
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.4</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<reportPlugins>
|
<reportPlugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
@@ -259,43 +274,49 @@
|
|||||||
</reportPlugins>
|
</reportPlugins>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-clean-plugin</artifactId>
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
<version>2.5</version>
|
<version>2.6.1</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-deploy-plugin</artifactId>
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.8.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.5</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-install-plugin</artifactId>
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
<version>2.4</version>
|
<version>2.5.2</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-resources-plugin</artifactId>
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
<version>2.6</version>
|
<version>2.7</version>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
||||||
<extensions>
|
<extensions>
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-provider-gitexe</artifactId>
|
<artifactId>maven-scm-provider-gitexe</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.8.1</version>
|
||||||
</extension>
|
</extension>
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.apache.maven.scm</groupId>
|
<groupId>org.apache.maven.scm</groupId>
|
||||||
<artifactId>maven-scm-manager-plexus</artifactId>
|
<artifactId>maven-scm-manager-plexus</artifactId>
|
||||||
<version>1.4</version>
|
<version>1.8.1</version>
|
||||||
</extension>
|
</extension>
|
||||||
<extension>
|
<extension>
|
||||||
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
|
<groupId>org.kathrynhuxtable.maven.wagon</groupId>
|
||||||
|
|||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple string builder for the Append To Response methods
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class AppendToResponseBuilder {
|
||||||
|
|
||||||
|
private StringBuilder response;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct the builder with the first method
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
*/
|
||||||
|
public AppendToResponseBuilder(AppendToResponseMethod method) {
|
||||||
|
response.append(method.getPropertyString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the string
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String build() {
|
||||||
|
return response.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a method to the list
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public AppendToResponseBuilder add(AppendToResponseMethod method) {
|
||||||
|
response.append(",").append(method.getPropertyString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare various objects to see if the are logically the same.
|
||||||
|
*
|
||||||
|
* Allows for some variance of the details
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class Compare {
|
||||||
|
|
||||||
|
// Constants
|
||||||
|
private static final int YEAR_LENGTH = 4;
|
||||||
|
|
||||||
|
private Compare() {
|
||||||
|
throw new UnsupportedOperationException("Utility class");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the MovieDB object with a title & year
|
||||||
|
*
|
||||||
|
* @param moviedb The moviedb object to compare too
|
||||||
|
* @param title The title of the movie to compare
|
||||||
|
* @param year The year of the movie to compare exact match
|
||||||
|
* @return True if there is a match, False otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean movies(final MovieInfo moviedb, final String title, final String year) {
|
||||||
|
return movies(moviedb, title, year, 0, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the MovieDB object with a title & year
|
||||||
|
*
|
||||||
|
* @param moviedb The moviedb object to compare too
|
||||||
|
* @param title The title of the movie to compare
|
||||||
|
* @param year The year of the movie to compare
|
||||||
|
* @param maxDistance The Levenshtein Distance between the two titles. 0 =
|
||||||
|
* exact match
|
||||||
|
* @param caseSensitive true if the comparison is to be case sensitive
|
||||||
|
* @return True if there is a match, False otherwise.
|
||||||
|
*/
|
||||||
|
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance, boolean caseSensitive) {
|
||||||
|
if ((moviedb == null) || (StringUtils.isBlank(title))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String primaryTitle, firstCompareTitle, secondCompareTitle;
|
||||||
|
if (caseSensitive) {
|
||||||
|
primaryTitle = title;
|
||||||
|
firstCompareTitle = moviedb.getOriginalTitle();
|
||||||
|
secondCompareTitle = moviedb.getTitle();
|
||||||
|
} else {
|
||||||
|
primaryTitle = title.toLowerCase();
|
||||||
|
firstCompareTitle = moviedb.getTitle().toLowerCase();
|
||||||
|
secondCompareTitle = moviedb.getOriginalTitle().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isValidYear(year) && isValidYear(moviedb.getReleaseDate())) {
|
||||||
|
// Compare with year
|
||||||
|
String movieYear = moviedb.getReleaseDate().substring(0, YEAR_LENGTH);
|
||||||
|
return movieYear.equals(year) && compareTitles(primaryTitle, firstCompareTitle, secondCompareTitle, maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare without year
|
||||||
|
return compareTitles(primaryTitle, firstCompareTitle, secondCompareTitle, maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare a title with two other titles.
|
||||||
|
*
|
||||||
|
* @param primaryTitle Primary title
|
||||||
|
* @param firstCompareTitle First title to compare with
|
||||||
|
* @param secondCompareTitle Second title to compare with
|
||||||
|
* @param maxDistance Maximum difference between the titles
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static boolean compareTitles(String primaryTitle, String firstCompareTitle, String secondCompareTitle, int maxDistance) {
|
||||||
|
// Compare with the first title
|
||||||
|
if (compareDistance(primaryTitle, firstCompareTitle, maxDistance)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare with the other title
|
||||||
|
return compareDistance(primaryTitle, secondCompareTitle, maxDistance);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the MovieDB object with a title & year, case sensitive
|
||||||
|
*
|
||||||
|
* @param moviedb
|
||||||
|
* @param title
|
||||||
|
* @param year
|
||||||
|
* @param maxDistance
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static boolean movies(final MovieInfo moviedb, final String title, final String year, int maxDistance) {
|
||||||
|
return Compare.movies(moviedb, title, year, maxDistance, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare the Levenshtein Distance between the two strings
|
||||||
|
*
|
||||||
|
* @param title1
|
||||||
|
* @param title2
|
||||||
|
* @param distance
|
||||||
|
*/
|
||||||
|
private static boolean compareDistance(final String title1, final String title2, int distance) {
|
||||||
|
return StringUtils.getLevenshteinDistance(title1, title2) <= distance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check the year is not blank or UNKNOWN
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
*/
|
||||||
|
private static boolean isValidYear(final String year) {
|
||||||
|
return StringUtils.isNotBlank(year) && !"UNKNOWN".equals(year);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,65 +19,45 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi;
|
package com.omertron.themoviedbapi;
|
||||||
|
|
||||||
public class MovieDbException extends Exception {
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiException;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
public class MovieDbException extends ApiException {
|
||||||
|
|
||||||
public enum MovieDbExceptionType {
|
public MovieDbException(ApiExceptionType exceptionType, String response) {
|
||||||
/*
|
super(exceptionType, response);
|
||||||
* Unknown error occured
|
|
||||||
*/
|
|
||||||
UNKNOWN_CAUSE,
|
|
||||||
/*
|
|
||||||
* URL is invalid
|
|
||||||
*/
|
|
||||||
INVALID_URL,
|
|
||||||
/*
|
|
||||||
* Page not found
|
|
||||||
*/
|
|
||||||
HTTP_404_ERROR,
|
|
||||||
/*
|
|
||||||
* The movie id was not found
|
|
||||||
*/
|
|
||||||
MOVIE_ID_NOT_FOUND,
|
|
||||||
/*
|
|
||||||
* Mapping failed from target to internal onbjects
|
|
||||||
*/
|
|
||||||
MAPPING_FAILED,
|
|
||||||
/*
|
|
||||||
* Error connecting to the service
|
|
||||||
*/
|
|
||||||
CONNECTION_ERROR,
|
|
||||||
/*
|
|
||||||
* Image was invalid
|
|
||||||
*/
|
|
||||||
INVALID_IMAGE,
|
|
||||||
/*
|
|
||||||
* Autorisation rejected
|
|
||||||
*/
|
|
||||||
AUTHORISATION_FAILURE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private final MovieDbExceptionType exceptionType;
|
public MovieDbException(ApiExceptionType exceptionType, String response, URL url) {
|
||||||
private final String response;
|
super(exceptionType, response, url);
|
||||||
|
|
||||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response) {
|
|
||||||
super();
|
|
||||||
this.exceptionType = exceptionType;
|
|
||||||
this.response = response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieDbException(final MovieDbExceptionType exceptionType, final String response, final Throwable cause) {
|
public MovieDbException(ApiExceptionType exceptionType, String response, int responseCode, URL url) {
|
||||||
super(cause);
|
super(exceptionType, response, responseCode, url);
|
||||||
this.exceptionType = exceptionType;
|
|
||||||
this.response = response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MovieDbExceptionType getExceptionType() {
|
public MovieDbException(ApiExceptionType exceptionType, String response, String url) {
|
||||||
return exceptionType;
|
super(exceptionType, response, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getResponse() {
|
public MovieDbException(ApiExceptionType exceptionType, String response, int responseCode, String url) {
|
||||||
return response;
|
super(exceptionType, response, responseCode, url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(ApiExceptionType exceptionType, String response, URL url, Throwable cause) {
|
||||||
|
super(exceptionType, response, url, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(ApiExceptionType exceptionType, String response, int responseCode, URL url, Throwable cause) {
|
||||||
|
super(exceptionType, response, responseCode, url, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(ApiExceptionType exceptionType, String response, String url, Throwable cause) {
|
||||||
|
super(exceptionType, response, url, cause);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MovieDbException(ApiExceptionType exceptionType, String response, int responseCode, String url, Throwable cause) {
|
||||||
|
super(exceptionType, response, responseCode, url, cause);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ArtworkType enum List of the artwork types that are available
|
||||||
|
*/
|
||||||
|
public enum ArtworkType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Poster artwork
|
||||||
|
*/
|
||||||
|
POSTER,
|
||||||
|
/**
|
||||||
|
* Fanart/backdrop
|
||||||
|
*/
|
||||||
|
BACKDROP,
|
||||||
|
/**
|
||||||
|
* Person image
|
||||||
|
*/
|
||||||
|
PROFILE,
|
||||||
|
/**
|
||||||
|
* Still (Video image)
|
||||||
|
*/
|
||||||
|
STILL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param artworkType
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static ArtworkType fromString(String artworkType) {
|
||||||
|
if (StringUtils.isNotBlank(artworkType)) {
|
||||||
|
try {
|
||||||
|
return ArtworkType.valueOf(artworkType.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("ArtworkType " + artworkType + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("ArtworkType must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
+6
-7
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,15 +17,14 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.enumeration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author stuart.boston
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public enum PersonType {
|
public enum CreditType {
|
||||||
|
|
||||||
CAST, // A member of the cast
|
CAST,
|
||||||
CREW, // A member of the crew
|
CREW;
|
||||||
PERSON // No specific type
|
|
||||||
}
|
}
|
||||||
+15
-7
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,14 +17,22 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.enumeration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ArtworkType enum List of the artwork types that are available
|
*
|
||||||
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public enum ArtworkType {
|
public enum ExternalSource {
|
||||||
|
|
||||||
|
FREEBASE_ID,
|
||||||
|
FREEBASE_MID,
|
||||||
|
IMDB_ID,
|
||||||
|
TVDB_ID,
|
||||||
|
TVRAGE_ID;
|
||||||
|
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
POSTER, // Poster artwork
|
|
||||||
BACKDROP, // Fanart/backdrop
|
|
||||||
PROFILE // Person image
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Media type options
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum MediaType {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Movie media type
|
||||||
|
*/
|
||||||
|
MOVIE,
|
||||||
|
/**
|
||||||
|
* TV Show media type
|
||||||
|
*/
|
||||||
|
TV,
|
||||||
|
/**
|
||||||
|
* TV Episode media type
|
||||||
|
*/
|
||||||
|
EPISODE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param mediaType
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static MediaType fromString(String mediaType) {
|
||||||
|
if (StringUtils.isNotBlank(mediaType)) {
|
||||||
|
try {
|
||||||
|
return MediaType.valueOf(mediaType.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("MediaType " + mediaType + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("MediaType must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of all "Append To Response" movie methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum MovieMethod implements AppendToResponseMethod {
|
||||||
|
|
||||||
|
ALTERNATIVE_TITLES,
|
||||||
|
CHANGES,
|
||||||
|
CREDITS,
|
||||||
|
IMAGES,
|
||||||
|
KEYWORDS,
|
||||||
|
LISTS,
|
||||||
|
RELEASES,
|
||||||
|
REVIEWS,
|
||||||
|
SIMILAR,
|
||||||
|
TRANSLATIONS,
|
||||||
|
VIDEOS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string to use in the URL
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static MovieMethod fromString(String method) {
|
||||||
|
if (StringUtils.isNotBlank(method)) {
|
||||||
|
try {
|
||||||
|
return MovieMethod.valueOf(method.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("Method " + method + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Method must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of People methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum PeopleMethod implements AppendToResponseMethod {
|
||||||
|
|
||||||
|
CHANGES,
|
||||||
|
COMBINED_CREDITS,
|
||||||
|
EXTERNAL_IDS,
|
||||||
|
IMAGES,
|
||||||
|
MOVIE_CREDITS,
|
||||||
|
TAGGED_IMAGES,
|
||||||
|
TV_CREDITS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string to use in the URL
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static PeopleMethod fromString(String method) {
|
||||||
|
if (StringUtils.isNotBlank(method)) {
|
||||||
|
try {
|
||||||
|
return PeopleMethod.valueOf(method.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("Method " + method + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Method must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum SearchType {
|
||||||
|
|
||||||
|
PHRASE,
|
||||||
|
NGRAM;
|
||||||
|
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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 SortBy {
|
||||||
|
|
||||||
|
CREATED_AT_ASC,
|
||||||
|
CREATED_AT_DESC,
|
||||||
|
POPULARITY_ASC,
|
||||||
|
POPULARITY_DESC,
|
||||||
|
RELEASE_DATE_ASC,
|
||||||
|
RELEASE_DATE_DESC,
|
||||||
|
REVENUE_ASC,
|
||||||
|
REVENUE_DESC,
|
||||||
|
PRIMARY_RELEASE_DATE_ASC,
|
||||||
|
PRIMARY_RELEASE_DATE_DESC,
|
||||||
|
ORIGINAL_TITLE_ASC,
|
||||||
|
ORIGINAL_TITLE_DESC,
|
||||||
|
VOTE_AVERAGE_ASC,
|
||||||
|
VOTE_AVERAGE_DESC,
|
||||||
|
VOTE_COUNT_ASC,
|
||||||
|
VOTE_COUNT_DESC;
|
||||||
|
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase().replace("_asc", ".asc").replaceAll("_desc", ".desc");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of TV methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum TVEpisodeMethod implements AppendToResponseMethod {
|
||||||
|
|
||||||
|
CREDITS,
|
||||||
|
EXTERNAL_IDS,
|
||||||
|
IMAGES,
|
||||||
|
VIDEOS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string to use in the URL
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static TVEpisodeMethod fromString(String method) {
|
||||||
|
if (StringUtils.isNotBlank(method)) {
|
||||||
|
try {
|
||||||
|
return TVEpisodeMethod.valueOf(method.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("Method " + method + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Method must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of TV methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum TVMethod implements AppendToResponseMethod {
|
||||||
|
|
||||||
|
ALTERNATIVE_TITLES,
|
||||||
|
CHANGES,
|
||||||
|
CONTENT_RATINGS,
|
||||||
|
CREDITS,
|
||||||
|
EXTERNAL_IDS,
|
||||||
|
IMAGES,
|
||||||
|
KEYWORDS,
|
||||||
|
SIMILAR,
|
||||||
|
TRANSLATIONS,
|
||||||
|
VIDEOS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string to use in the URL
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static TVMethod fromString(String method) {
|
||||||
|
if (StringUtils.isNotBlank(method)) {
|
||||||
|
try {
|
||||||
|
return TVMethod.valueOf(method.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("Method " + method + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Method must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.interfaces.AppendToResponseMethod;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of TV methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public enum TVSeasonMethod implements AppendToResponseMethod {
|
||||||
|
|
||||||
|
CREDITS,
|
||||||
|
EXTERNAL_IDS,
|
||||||
|
IMAGES,
|
||||||
|
VIDEOS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the string to use in the URL
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String getPropertyString() {
|
||||||
|
return this.name().toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert a string into an Enum type
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @return
|
||||||
|
* @throws IllegalArgumentException If type is not recognised
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static TVSeasonMethod fromString(String method) {
|
||||||
|
if (StringUtils.isNotBlank(method)) {
|
||||||
|
try {
|
||||||
|
return TVSeasonMethod.valueOf(method.trim().toUpperCase());
|
||||||
|
} catch (IllegalArgumentException ex) {
|
||||||
|
throw new IllegalArgumentException("Method " + method + " does not exist.", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Method must not be null");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.interfaces;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface to indicate that the object has append to response methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
* @param <T> Method for Append To Response
|
||||||
|
*/
|
||||||
|
public interface AppendToResponse<T extends AppendToResponseMethod> {
|
||||||
|
|
||||||
|
boolean hasMethod(T method);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.interfaces;
|
||||||
|
|
||||||
|
public interface AppendToResponseMethod {
|
||||||
|
|
||||||
|
String getPropertyString();
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.interfaces;
|
||||||
|
|
||||||
|
public interface Identification {
|
||||||
|
|
||||||
|
int getId();
|
||||||
|
|
||||||
|
void setId(int id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.interfaces;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.results.ResultDates;
|
||||||
|
|
||||||
|
public interface WrapperDates {
|
||||||
|
|
||||||
|
ResultDates getDates();
|
||||||
|
|
||||||
|
void setDates(ResultDates dates);
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.interfaces;
|
||||||
|
|
||||||
|
public interface WrapperPages {
|
||||||
|
|
||||||
|
int getPage();
|
||||||
|
|
||||||
|
void setPage(int page);
|
||||||
|
|
||||||
|
int getTotalPages();
|
||||||
|
|
||||||
|
void setTotalPages(int totalPages);
|
||||||
|
|
||||||
|
int getTotalResults();
|
||||||
|
|
||||||
|
void setTotalResults(int totalResults);
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.ArtworkMedia;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||||
|
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||||
|
import com.omertron.themoviedbapi.model.company.Company;
|
||||||
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
|
import com.omertron.themoviedbapi.model.list.UserList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
|
import com.omertron.themoviedbapi.model.review.Review;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperChanges;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract methods
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class AbstractMethod {
|
||||||
|
|
||||||
|
// The API key to be used
|
||||||
|
protected final String apiKey;
|
||||||
|
// The HttpTools to use
|
||||||
|
protected final HttpTools httpTools;
|
||||||
|
// Jackson JSON configuration
|
||||||
|
protected static final ObjectMapper MAPPER = new ObjectMapper();
|
||||||
|
private static final Map<Class, TypeReference> TYPE_REFS = new HashMap<Class, TypeReference>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
TYPE_REFS.put(MovieBasic.class, new TypeReference<WrapperGenericList<MovieBasic>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(TVBasic.class, new TypeReference<WrapperGenericList<TVBasic>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(UserList.class, new TypeReference<WrapperGenericList<UserList>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(Company.class, new TypeReference<WrapperGenericList<Company>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(Collection.class, new TypeReference<WrapperGenericList<Collection>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(Keyword.class, new TypeReference<WrapperGenericList<Keyword>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(MovieInfo.class, new TypeReference<WrapperGenericList<MovieInfo>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(PersonInfo.class, new TypeReference<WrapperGenericList<PersonInfo>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(PersonFind.class, new TypeReference<WrapperGenericList<PersonFind>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(Review.class, new TypeReference<WrapperGenericList<Review>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(ChangeListItem.class, new TypeReference<WrapperGenericList<ChangeListItem>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(ArtworkMedia.class, new TypeReference<WrapperGenericList<ArtworkMedia>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(ContentRating.class, new TypeReference<WrapperGenericList<ContentRating>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(TVInfo.class, new TypeReference<WrapperGenericList<TVInfo>>() {
|
||||||
|
});
|
||||||
|
TYPE_REFS.put(AlternativeTitle.class, new TypeReference<WrapperGenericList<AlternativeTitle>>() {
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for the methods
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public AbstractMethod(String apiKey, HttpTools httpTools) {
|
||||||
|
this.apiKey = apiKey;
|
||||||
|
this.httpTools = httpTools;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to get a pre-generated TypeReference for a class
|
||||||
|
*
|
||||||
|
* @param aClass
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
protected static TypeReference getTypeReference(Class aClass) throws MovieDbException {
|
||||||
|
if (TYPE_REFS.containsKey(aClass)) {
|
||||||
|
return TYPE_REFS.get(aClass);
|
||||||
|
} else {
|
||||||
|
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Class type reference for '" + aClass.getSimpleName() + "' not found!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the wrapper list and return the results
|
||||||
|
*
|
||||||
|
* @param <T> Type of list to process
|
||||||
|
* @param typeRef
|
||||||
|
* @param url URL of the page (Error output only)
|
||||||
|
* @param errorMessageSuffix Error message to output (Error output only)
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
protected <T> List<T> processWrapperList(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
||||||
|
WrapperGenericList<T> val = processWrapper(typeRef, url, errorMessageSuffix);
|
||||||
|
return val.getResults();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process the wrapper list and return the whole wrapper
|
||||||
|
*
|
||||||
|
* @param <T> Type of list to process
|
||||||
|
* @param typeRef
|
||||||
|
* @param url URL of the page (Error output only)
|
||||||
|
* @param errorMessageSuffix Error message to output (Error output only)
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
protected <T> WrapperGenericList<T> processWrapper(TypeReference typeRef, URL url, String errorMessageSuffix) throws MovieDbException {
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
// Due to type erasure, this doesn't work
|
||||||
|
// TypeReference<WrapperGenericList<T>> typeRef = new TypeReference<WrapperGenericList<T>>() {};
|
||||||
|
return MAPPER.readValue(webpage, typeRef);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get " + errorMessageSuffix, url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Look up the media's changes by ID
|
||||||
|
*
|
||||||
|
* @param mediaID
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
protected ResultList<ChangeKeyItem> getMediaChanges(int mediaID, String startDate, String endDate) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, mediaID);
|
||||||
|
parameters.add(Param.START_DATE, startDate);
|
||||||
|
parameters.add(Param.END_DATE, endDate);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.CHANGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperChanges wrapper = MAPPER.readValue(webpage, WrapperChanges.class);
|
||||||
|
ResultList<ChangeKeyItem> results = new ResultList<ChangeKeyItem>(wrapper.getChangedItems());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get changes", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,326 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.SortBy;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.account.Account;
|
||||||
|
import com.omertron.themoviedbapi.model.list.UserList;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostBody;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Account Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbAccount extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbAccount(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the basic information for an account. You will need to have a valid session id.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Account getAccount(String sessionId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, Account.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Account", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all lists of a given user
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @return The lists
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.LISTS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "user list");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of favorite movies for an account.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getFavoriteMovies(String sessionId, int accountId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.FAVORITE_MOVIES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "favorite movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of favorite TV series for an account.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getFavoriteTv(String sessionId, int accountId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.FAVORITE_TV).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "favorite TV shows");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or remove a movie to an accounts favorite list.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param mediaType
|
||||||
|
* @param mediaId
|
||||||
|
* @param setFavorite
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode modifyFavoriteStatus(String sessionId, int accountId, MediaType mediaType, int mediaId, boolean setFavorite) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.MEDIA_TYPE, mediaType.toString().toLowerCase())
|
||||||
|
.add(PostBody.MEDIA_ID, mediaId)
|
||||||
|
.add(PostBody.FAVORITE, setFavorite)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.FAVORITE).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to set favorite status", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of rated movies (and associated rating) for an account.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param page
|
||||||
|
* @param sortBy
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getRatedMovies(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.SORT_BY, sortBy);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.RATED_MOVIES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "rated movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of rated TV shows (and associated rating) for an account.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param page
|
||||||
|
* @param sortBy
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getRatedTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.SORT_BY, sortBy);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.RATED_TV).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "rated TV shows");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of movies on an accounts watch list.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param page
|
||||||
|
* @param sortBy
|
||||||
|
* @param language
|
||||||
|
* @return The watch list of the user
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getWatchListMovie(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.SORT_BY, sortBy);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.WATCHLIST_MOVIES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "movie watch list");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of movies on an accounts watch list.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param page
|
||||||
|
* @param sortBy
|
||||||
|
* @param language
|
||||||
|
* @return The watch list of the user
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getWatchListTV(String sessionId, int accountId, Integer page, String sortBy, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.SORT_BY, sortBy);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.WATCHLIST_TV).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "TV watch list");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add or remove a movie to an accounts watch list.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param accountId
|
||||||
|
* @param movieId
|
||||||
|
* @param mediaType
|
||||||
|
* @param addToWatchlist
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode modifyWatchList(String sessionId, int accountId, MediaType mediaType, Integer movieId, boolean addToWatchlist) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, accountId);
|
||||||
|
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.MEDIA_TYPE, mediaType.toString().toLowerCase())
|
||||||
|
.add(PostBody.MEDIA_ID, movieId)
|
||||||
|
.add(PostBody.WATCHLIST, addToWatchlist)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.WATCHLIST).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to modify watch list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of rated movies for a specific guest session id.
|
||||||
|
*
|
||||||
|
* @param guestSessionId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @param sortBy only CREATED_AT_ASC or CREATED_AT_DESC is supported
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getGuestRatedMovies(String guestSessionId, String language, Integer page, SortBy sortBy) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, guestSessionId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
if (sortBy != null) {
|
||||||
|
// Only created_at is supported
|
||||||
|
parameters.add(Param.SORT_BY, "created_at");
|
||||||
|
|
||||||
|
if (sortBy.getPropertyString().endsWith("asc")) {
|
||||||
|
parameters.add(Param.SORT_ORDER, "asc");
|
||||||
|
} else {
|
||||||
|
parameters.add(Param.SORT_ORDER, "desc");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.GUEST_SESSION).subMethod(MethodSub.RATED_MOVIES_GUEST).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "Guest Session Movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.authentication.TokenAuthorisation;
|
||||||
|
import com.omertron.themoviedbapi.model.authentication.TokenSession;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Authentication Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbAuthentication extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbAuthentication(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TokenAuthorisation getAuthorisationToken() throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_NEW).buildUrl(parameters);
|
||||||
|
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TokenAuthorisation.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Failed to get Authorisation Token", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @param token
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TokenSession getSessionToken(TokenAuthorisation token) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
|
||||||
|
if (!token.getSuccess()) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!");
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters.add(Param.TOKEN, token.getRequestToken());
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.SESSION_NEW).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TokenSession.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @param token Session token
|
||||||
|
* @param username User's username
|
||||||
|
* @param password User's password
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TokenAuthorisation getSessionTokenLogin(TokenAuthorisation token, String username, String password) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
|
||||||
|
if (!token.getSuccess()) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.AUTH_FAILURE, "Authorisation token was not successful!");
|
||||||
|
}
|
||||||
|
|
||||||
|
parameters.add(Param.TOKEN, token.getRequestToken());
|
||||||
|
parameters.add(Param.USERNAME, username);
|
||||||
|
parameters.add(Param.PASSWORD, password);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.TOKEN_VALIDATE).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TokenAuthorisation.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Session Token", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* If a guest session is not used for the first time within 24 hours, it will be automatically discarded.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TokenSession getGuestSessionToken() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.AUTH).subMethod(MethodSub.GUEST_SESSION).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TokenSession.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get Guest Session Token", url, ex);
|
||||||
|
}
|
||||||
|
}}
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultsMap;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import java.util.List;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.omertron.themoviedbapi.model.Certification;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Certification Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbCertifications extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbCertifications(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of movies certification.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultsMap<String, List<Certification>> getMoviesCertification() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.MOVIE_LIST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
JsonNode node = MAPPER.readTree(webpage);
|
||||||
|
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
|
||||||
|
});
|
||||||
|
return new ResultsMap<String, List<Certification>>(results);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get movie certifications", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of tv certification.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultsMap<String, List<Certification>> getTvCertification() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.CERTIFICATION).subMethod(MethodSub.TV_LIST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
JsonNode node = MAPPER.readTree(webpage);
|
||||||
|
Map<String, List<Certification>> results = MAPPER.readValue(node.elements().next().traverse(), new TypeReference<Map<String, List<Certification>>>() {
|
||||||
|
});
|
||||||
|
return new ResultsMap<String, List<Certification>>(results);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV certifications", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeListItem;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Change Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbChanges extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbChanges(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of Media IDs that have been edited.
|
||||||
|
*
|
||||||
|
* You can then use the movie/TV/person changes API to get the actual data that has been changed.
|
||||||
|
*
|
||||||
|
* @param method The method base to get
|
||||||
|
* @param page
|
||||||
|
* @param startDate the start date of the changes, optional
|
||||||
|
* @param endDate the end date of the changes, optional
|
||||||
|
* @return List of changed movie
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeListItem> getChangeList(MethodBase method, Integer page, String startDate, String endDate) throws MovieDbException {
|
||||||
|
TmdbParameters params = new TmdbParameters();
|
||||||
|
params.add(Param.PAGE, page);
|
||||||
|
params.add(Param.START_DATE, startDate);
|
||||||
|
params.add(Param.END_DATE, endDate);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, method).subMethod(MethodSub.CHANGES).buildUrl(params);
|
||||||
|
WrapperGenericList<ChangeListItem> wrapper = processWrapper(getTypeReference(ChangeListItem.class), url, "changes");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||||
|
import com.omertron.themoviedbapi.model.collection.CollectionInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Collections Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbCollections extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbCollections(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the basic information about a
|
||||||
|
* movie collection.
|
||||||
|
*
|
||||||
|
* You can get the ID needed for this method by making a getMovieInfo
|
||||||
|
* request for the belongs_to_collection.
|
||||||
|
*
|
||||||
|
* @param collectionId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public CollectionInfo getCollectionInfo(int collectionId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, collectionId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.COLLECTION).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, CollectionInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get collection information", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all of the images for a particular collection by collection id.
|
||||||
|
*
|
||||||
|
* @param collectionId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getCollectionImages(int collectionId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, collectionId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.COLLECTION).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll(ArtworkType.POSTER, ArtworkType.BACKDROP));
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get collection images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,98 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.company.Company;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Company Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbCompanies extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbCompanies(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the basic information about a production company on TMDb.
|
||||||
|
*
|
||||||
|
* @param companyId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Company getCompanyInfo(int companyId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, companyId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.COMPANY).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, Company.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get company information", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the movies associated with a company.
|
||||||
|
*
|
||||||
|
* These movies are returned in order of most recently released to oldest. The default response will return 20 movies per page.
|
||||||
|
*
|
||||||
|
* @param companyId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getCompanyMovies(int companyId, String language, Integer page) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, companyId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.COMPANY).subMethod(MethodSub.MOVIES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,135 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.config.Configuration;
|
||||||
|
import com.omertron.themoviedbapi.model.config.JobDepartment;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultsMap;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperConfig;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperJobList;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Configuration Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbConfiguration extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cache the configuration in memory<br/>
|
||||||
|
* It rarely changes, so this should be safe.
|
||||||
|
*/
|
||||||
|
private static Configuration config = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbConfiguration(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the configuration<br/>
|
||||||
|
* If the configuration has been previously retrieved, use that instead
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Configuration getConfig() throws MovieDbException {
|
||||||
|
if (config == null) {
|
||||||
|
URL configUrl = new ApiUrl(apiKey, MethodBase.CONFIGURATION).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(configUrl);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperConfig wc = MAPPER.readValue(webpage, WrapperConfig.class);
|
||||||
|
config = wc.getTmdbConfiguration();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to read configuration", configUrl, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of valid jobs
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<JobDepartment> getJobs() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.JOB).subMethod(MethodSub.LIST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperJobList wrapper = MAPPER.readValue(webpage, WrapperJobList.class);
|
||||||
|
ResultList<JobDepartment> results = new ResultList<JobDepartment>(wrapper.getJobs());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get job list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of supported timezones for the API methods that support them
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultsMap<String, List<String>> getTimezones() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TIMEZONES).subMethod(MethodSub.LIST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
List<Map<String, List<String>>> tzList;
|
||||||
|
try {
|
||||||
|
tzList = MAPPER.readValue(webpage, new TypeReference<List<Map<String, List<String>>>>() {
|
||||||
|
});
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get timezone list", url, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
ResultsMap<String, List<String>> timezones = new ResultsMap<String, List<String>>();
|
||||||
|
|
||||||
|
for (Map<String, List<String>> tzMap : tzList) {
|
||||||
|
for (Map.Entry<String, List<String>> x : tzMap.entrySet()) {
|
||||||
|
timezones.put(x.getKey(), x.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return timezones;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.person.CreditInfo;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Credit Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbCredits extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbCredits(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the detailed information about a particular credit record.
|
||||||
|
* <p>
|
||||||
|
* This is currently only supported with the new credit model found in TV.
|
||||||
|
* <br/>
|
||||||
|
* These IDs can be found from any TV credit response as well as the
|
||||||
|
* TV_credits and combined_credits methods for people. <br/>
|
||||||
|
* The episodes object returns a list of episodes and are generally going to
|
||||||
|
* be guest stars. <br/>
|
||||||
|
* The season array will return a list of season numbers. <br/>
|
||||||
|
* Season credits are credits that were marked with the "add to every
|
||||||
|
* season" option in the editing interface and are assumed to be "season
|
||||||
|
* regulars".
|
||||||
|
*
|
||||||
|
* @param creditId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public CreditInfo getCreditInfo(String creditId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, creditId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.CREDIT).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, CreditInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LoggerFactory.getLogger("test").info("{}",ex);
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credit info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.discover.Discover;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Discover Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbDiscover extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbDiscover(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
|
||||||
|
*
|
||||||
|
* @param discover A discover object containing the search criteria required
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getDiscoverMovies(Discover discover) throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.MOVIE).buildUrl(discover.getParams());
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Discover movies by different types of data like average rating, number of votes, genres and certifications.
|
||||||
|
*
|
||||||
|
* @param discover A discover object containing the search criteria required
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getDiscoverTV(Discover discover) throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.DISCOVER).subMethod(MethodSub.TV).buildUrl(discover.getParams());
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, webpage);
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Video;
|
||||||
|
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVEpisodeInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostBody;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperVideos;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the TV Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbEpisodes extends AbstractMethod {
|
||||||
|
|
||||||
|
private static final int RATING_MAX = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbEpisodes(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the primary information about a TV episode by combination of a season and episode number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @param language
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TVEpisodeInfo getEpisodeInfo(int tvID, int seasonNumber, int episodeNumber, String language, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TVEpisodeInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LoggerFactory.getLogger("test").warn("{}", ex);
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Episode Info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up a TV episode's changes by episode ID
|
||||||
|
*
|
||||||
|
* @param episodeID
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeKeyItem> getEpisodeChanges(int episodeID, String startDate, String endDate) throws MovieDbException {
|
||||||
|
return getMediaChanges(episodeID, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users get the status of whether or not the TV episode has been rated.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @param sessionID
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaState getEpisodeAccountState(int tvID, int seasonNumber, int episodeNumber, String sessionID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaState.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the TV episode credits by combination of season and episode number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaCreditList getEpisodeCredits(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the external ids for a TV episode by comabination of a season and episode number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ExternalID getEpisodeExternalID(int tvID, int seasonNumber, int episodeNumber, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ExternalID.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get external IDs", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the images (episode stills) for a TV episode by combination of a season and episode number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getEpisodeImages(int tvID, int seasonNumber, int episodeNumber) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users rate a TV episode. A valid session id or guest session id is required.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @param rating
|
||||||
|
* @param sessionID
|
||||||
|
* @param guestSessionID
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode postEpisodeRating(int tvID, int seasonNumber, int episodeNumber, int rating, String sessionID, String guestSessionID) throws MovieDbException {
|
||||||
|
if (rating < 0 || rating > RATING_MAX) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Rating out of range");
|
||||||
|
}
|
||||||
|
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionID);
|
||||||
|
parameters.add(Param.GUEST_SESSION_ID, guestSessionID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.RATING).buildUrl(parameters);
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.VALUE, rating)
|
||||||
|
.build();
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to post rating", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the videos that have been added to a TV episode (teasers, clips, etc...)
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param episodeNumber
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Video> getEpisodeVideos(int tvID, int seasonNumber, int episodeNumber, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.EPISODE_NUMBER, episodeNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.EPISODE).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
|
||||||
|
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.ExternalSource;
|
||||||
|
import com.omertron.themoviedbapi.model.FindResults;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Find Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbFind extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbFind(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* You con use this method to find movies, tv series or persons using external ids.
|
||||||
|
*
|
||||||
|
* Supported query ids are
|
||||||
|
* <ul>
|
||||||
|
* <li>Movies: imdb_id</li>
|
||||||
|
* <li>People: imdb_id, freebase_mid, freebase_id, tvrage_id</li>
|
||||||
|
* <li>TV Series: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
|
||||||
|
* <li>TV Seasons: freebase_mid, freebase_id, tvdb_id, tvrage_id</li>
|
||||||
|
* <li>TV Episodes: imdb_id, freebase_mid, freebase_id, tvdb_id, tvrage_idimdb_id, freebase_mid, freebase_id, tvrage_id,
|
||||||
|
* tvdb_id.
|
||||||
|
* </ul>
|
||||||
|
*
|
||||||
|
* For details see http://docs.themoviedb.apiary.io/#find
|
||||||
|
*
|
||||||
|
* @param id the external id
|
||||||
|
* @param externalSource one of {@link ExternalSource}.
|
||||||
|
* @param language the language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public FindResults find(String id, ExternalSource externalSource, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, id);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.EXTERNAL_SOURCE, externalSource.getPropertyString());
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.FIND).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, FindResults.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get find results", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.Genre;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenres;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Genre Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbGenres extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbGenres(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of movie genres.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Genre> getGenreMovieList(String language) throws MovieDbException {
|
||||||
|
return getGenreList(language, MethodSub.MOVIE_LIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of TV genres.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Genre> getGenreTVList(String language) throws MovieDbException {
|
||||||
|
return getGenreList(language, MethodSub.TV_LIST);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of genres for movies or TV
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @param sub
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
private ResultList<Genre> getGenreList(String language, MethodSub sub) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.GENRE).subMethod(sub).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperGenres wrapper = MAPPER.readValue(webpage, WrapperGenres.class);
|
||||||
|
ResultList<Genre> results = new ResultList<Genre>(wrapper.getGenres());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get genre " + sub.toString(), url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of movies for a particular genre by id.
|
||||||
|
*
|
||||||
|
* By default, only movies with 10 or more votes are included.
|
||||||
|
*
|
||||||
|
* @param genreId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @param includeAllMovies
|
||||||
|
* @param includeAdult
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getGenreMovies(int genreId, String language, Integer page, Boolean includeAllMovies, Boolean includeAdult) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, genreId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.INCLUDE_ALL_MOVIES, includeAllMovies);
|
||||||
|
parameters.add(Param.INCLUDE_ADULT, includeAdult);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.GENRE).subMethod(MethodSub.MOVIES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, webpage);
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,96 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Keyword Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbKeywords extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbKeywords(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the basic information for a specific keyword id.
|
||||||
|
*
|
||||||
|
* @param keywordId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Keyword getKeyword(String keywordId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, keywordId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, Keyword.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keyword " + keywordId, url, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of movies for a particular keyword by id.
|
||||||
|
*
|
||||||
|
* @param keywordId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return List of movies with the keyword
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieBasic> getKeywordMovies(String keywordId, String language, Integer page) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, keywordId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.KEYWORD).subMethod(MethodSub.MOVIES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieBasic> wrapper = processWrapper(getTypeReference(MovieBasic.class), url, "keyword movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.list.ListStatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.list.ListItem;
|
||||||
|
import com.omertron.themoviedbapi.model.list.ListItemStatus;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostBody;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the List Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbLists extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbLists(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list by its ID
|
||||||
|
*
|
||||||
|
* @param listId
|
||||||
|
* @return The list and its items
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ListItem<MovieInfo> getList(String listId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, listId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, new TypeReference<ListItem<MovieInfo>>() {
|
||||||
|
});
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check to see if an ID is already on a list.
|
||||||
|
*
|
||||||
|
* @param listId
|
||||||
|
* @param mediaId
|
||||||
|
* @return true if the movie is on the list
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public boolean checkItemStatus(String listId, int mediaId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, listId);
|
||||||
|
parameters.add(Param.MOVIE_ID, mediaId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(MethodSub.ITEM_STATUS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ListItemStatus.class).isItemPresent();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get item status", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users create a new list. A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param name
|
||||||
|
* @param description
|
||||||
|
* @return The list id
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public String createList(String sessionId, String name, String description) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.NAME, StringUtils.trimToEmpty(name))
|
||||||
|
.add(PostBody.DESCRIPTION, StringUtils.trimToEmpty(description))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ListStatusCode.class).getListId();
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to create list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users delete a list that they created. A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param listId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode deleteList(String sessionId, String listId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, listId);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.deleteRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to delete list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Modify a list
|
||||||
|
*
|
||||||
|
* This can be used to add or remove an item from the list
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param listId
|
||||||
|
* @param movieId
|
||||||
|
* @param operation
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
private StatusCode modifyMovieList(String sessionId, String listId, int movieId, MethodSub operation) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, listId);
|
||||||
|
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.MEDIA_ID, movieId)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(operation).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to remove item from list", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users add new items to a list that they created.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param listId
|
||||||
|
* @param mediaId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode addItem(String sessionId, String listId, int mediaId) throws MovieDbException {
|
||||||
|
return modifyMovieList(sessionId, listId, mediaId, MethodSub.ADD_ITEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users delete items from a list that they created.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param listId
|
||||||
|
* @param mediaId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode removeItem(String sessionId, String listId, int mediaId) throws MovieDbException {
|
||||||
|
return modifyMovieList(sessionId, listId, mediaId, MethodSub.REMOVE_ITEM);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clear all of the items within a list.
|
||||||
|
*
|
||||||
|
* This is a irreversible action and should be treated with caution.
|
||||||
|
*
|
||||||
|
* A valid session id is required. A call without confirm=true will return status code 29.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param listId
|
||||||
|
* @param confirm
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode clear(String sessionId, String listId, boolean confirm) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.ID, listId);
|
||||||
|
parameters.add(Param.CONFIRM, confirm);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(MethodSub.CLEAR).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.postRequest(url, "");
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to clear list", url, ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,575 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
|
import com.omertron.themoviedbapi.model.list.UserList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Translation;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Video;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.ReleaseInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.review.Review;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperAlternativeTitles;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperMovieKeywords;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperReleaseInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperTranslations;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperVideos;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostBody;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Movie Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbMovies extends AbstractMethod {
|
||||||
|
|
||||||
|
private static final int RATING_MAX = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbMovies(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the basic movie information.
|
||||||
|
*
|
||||||
|
* It will return the single highest rated poster and backdrop.
|
||||||
|
*
|
||||||
|
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
|
||||||
|
* found.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MovieInfo getMovieInfo(int movieId, String language, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
MovieInfo movie = MAPPER.readValue(webpage, MovieInfo.class);
|
||||||
|
if (movie == null || movie.getId() == 0) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.ID_NOT_FOUND, "No movie found for ID: " + movieId, url);
|
||||||
|
}
|
||||||
|
return movie;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the basic movie information.
|
||||||
|
*
|
||||||
|
* It will return the single highest rated poster and backdrop.
|
||||||
|
*
|
||||||
|
* ApiExceptionType.MOVIE_ID_NOT_FOUND will be thrown if there are no movies
|
||||||
|
* found.
|
||||||
|
*
|
||||||
|
* @param imdbId
|
||||||
|
* @param language
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MovieInfo getMovieInfoImdb(String imdbId, String language, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, imdbId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
MovieInfo movie = MAPPER.readValue(webpage, MovieInfo.class);
|
||||||
|
if (movie == null || movie.getId() == 0) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.ID_NOT_FOUND, "No movie found for IMDB ID: " + imdbId, url);
|
||||||
|
}
|
||||||
|
return movie;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get info (IMDB)", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 list.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param sessionId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaState getMovieAccountState(int movieId, String sessionId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaState.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the alternative titles we have for
|
||||||
|
* a particular movie.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param country
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<AlternativeTitle> getMovieAlternativeTitles(int movieId, String country) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.COUNTRY, country);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
WrapperAlternativeTitles wrapper = MAPPER.readValue(webpage, WrapperAlternativeTitles.class);
|
||||||
|
ResultList<AlternativeTitle> results = new ResultList<AlternativeTitle>(wrapper.getTitles());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get alternative titles", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cast and crew information for a specific movie id.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaCreditList getMovieCredits(int movieId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method should be used when you’re wanting to retrieve all of the
|
||||||
|
* images for a particular movie.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getMovieImages(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.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the keywords that have been added
|
||||||
|
* to a particular movie.
|
||||||
|
*
|
||||||
|
* Currently, only English keywords exist.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Keyword> getMovieKeywords(int movieId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperMovieKeywords wrapper = MAPPER.readValue(webpage, WrapperMovieKeywords.class);
|
||||||
|
ResultList<Keyword> results = new ResultList<Keyword>(wrapper.getKeywords());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get keywords", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the release and certification data
|
||||||
|
* we have for a specific movie.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ReleaseInfo> getMovieReleaseInfo(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.RELEASES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperReleaseInfo wrapper = MAPPER.readValue(webpage, WrapperReleaseInfo.class);
|
||||||
|
ResultList<ReleaseInfo> results = new ResultList<ReleaseInfo>(wrapper.getCountries());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get release information", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve all of the trailers for a particular
|
||||||
|
* movie.
|
||||||
|
*
|
||||||
|
* Supported sites are YouTube and QuickTime.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Video> getMovieVideos(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.VIDEOS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
|
||||||
|
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve a list of the available translations for
|
||||||
|
* a specific movie.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Translation> getMovieTranslations(int movieId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
|
||||||
|
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The similar movies method will let you retrieve the similar movies for a
|
||||||
|
* particular movie.
|
||||||
|
*
|
||||||
|
* This data is created dynamically but with the help of users votes on
|
||||||
|
* TMDb.
|
||||||
|
*
|
||||||
|
* The data is much better with movies that have more keywords
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getSimilarMovies(int movieId, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "similar movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the reviews for a particular movie id.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Review> getMovieReviews(int movieId, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.REVIEWS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<Review> wrapper = processWrapper(getTypeReference(Review.class), url, "review");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the lists that the movie belongs to
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<UserList> getMovieLists(int movieId, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.LISTS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "movie lists");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the changes for a specific movie ID.
|
||||||
|
*
|
||||||
|
* Changes are grouped by key, and ordered by date in descending order.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* 14.
|
||||||
|
*
|
||||||
|
* The language is present on fields that are translatable.
|
||||||
|
*
|
||||||
|
* @param movieId
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeKeyItem> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException {
|
||||||
|
return getMediaChanges(movieId, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users rate a movie.
|
||||||
|
*
|
||||||
|
* A valid session id or guest session id is required.
|
||||||
|
*
|
||||||
|
* @param sessionId
|
||||||
|
* @param movieId
|
||||||
|
* @param rating
|
||||||
|
* @param guestSessionId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode postMovieRating(int movieId, int rating, String sessionId, String guestSessionId) throws MovieDbException {
|
||||||
|
if (rating < 0 || rating > RATING_MAX) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Rating out of range");
|
||||||
|
}
|
||||||
|
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, movieId);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionId);
|
||||||
|
parameters.add(Param.GUEST_SESSION_ID, guestSessionId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.RATING).buildUrl(parameters);
|
||||||
|
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.VALUE, rating)
|
||||||
|
.build();
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to post rating", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the newest movie that was added to TMDb.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MovieInfo getLatestMovie() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.LATEST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MovieInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest movie", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of upcoming movies.
|
||||||
|
*
|
||||||
|
* This list refreshes every day.
|
||||||
|
*
|
||||||
|
* The maximum number of items this list will include is 100.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getUpcoming(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.UPCOMING).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "upcoming movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the movies currently in theatres.
|
||||||
|
*
|
||||||
|
* This is a curated list that will normally contain 100 movies. The default
|
||||||
|
* response will return 20 movies.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getNowPlayingMovies(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.NOW_PLAYING).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "now playing movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the daily movie popularity list.
|
||||||
|
*
|
||||||
|
* This list is updated daily. The default response will return 20 movies.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getPopularMovieList(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.POPULAR).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "popular movie list");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the top rated movies that have over 10
|
||||||
|
* votes on TMDb.
|
||||||
|
*
|
||||||
|
* The default response will return 20 movies.
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> getTopRatedMovies(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.MOVIE).subMethod(MethodSub.TOP_RATED).buildUrl(parameters);
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "top rated movies");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.network.Network;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Network Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbNetworks extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbNetworks(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method is used to retrieve the basic information about a TV network.
|
||||||
|
* <p>
|
||||||
|
* You can use this ID to search for TV shows with the discover method.
|
||||||
|
*
|
||||||
|
* @param networkId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Network getNetworkInfo(int networkId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, networkId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.NETWORK).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, Network.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get network information", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,306 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.ArtworkMedia;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.credits.CreditBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.credits.CreditMovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.credits.CreditTVBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonCreditList;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonCreditsMixIn;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the People Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbPeople extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbPeople(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the general person information for a specific id.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public PersonInfo getPersonInfo(int personId, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, PersonInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
LoggerFactory.getLogger("test").info("{}", ex);
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the movie credits for a specific person id.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public PersonCreditList<CreditMovieBasic> getPersonMovieCredits(int personId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.MOVIE_CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
TypeReference tr = new TypeReference<PersonCreditList<CreditMovieBasic>>() {
|
||||||
|
};
|
||||||
|
return MAPPER.readValue(webpage, tr);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person movie credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the TV credits for a specific person id.
|
||||||
|
*
|
||||||
|
* To get the expanded details for each record, call the /credit method with
|
||||||
|
* the provided credit_id.
|
||||||
|
*
|
||||||
|
* This will provide details about which episode and/or season the credit is
|
||||||
|
* for.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public PersonCreditList<CreditTVBasic> getPersonTVCredits(int personId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TV_CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
TypeReference tr = new TypeReference<PersonCreditList<CreditTVBasic>>() {
|
||||||
|
};
|
||||||
|
return MAPPER.readValue(webpage, tr);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person TV credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the combined (movie and TV) credits for a specific person id.
|
||||||
|
*
|
||||||
|
* To get the expanded details for each TV record, call the /credit method
|
||||||
|
* with the provided credit_id.
|
||||||
|
*
|
||||||
|
* This will provide details about which episode and/or season the credit is
|
||||||
|
* for.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public PersonCreditList<CreditBasic> getPersonCombinedCredits(int personId, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.COMBINED_CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
mapper.addMixIn(PersonCreditList.class, PersonCreditsMixIn.class);
|
||||||
|
TypeReference tr = new TypeReference<PersonCreditList<CreditBasic>>() {
|
||||||
|
};
|
||||||
|
return mapper.readValue(webpage, tr);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person combined credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the external ids for a specific person id.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ExternalID getPersonExternalIds(int personId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ExternalID.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person external IDs", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the images for a specific person id.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getPersonImages(int personId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll(ArtworkType.PROFILE));
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get person images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the images that have been tagged with a specific person id.
|
||||||
|
*
|
||||||
|
* We return all of the image results with a media object mapped for each
|
||||||
|
* image.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ArtworkMedia> getPersonTaggedImages(int personId, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, personId);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.TAGGED_IMAGES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<ArtworkMedia> wrapper = processWrapper(getTypeReference(ArtworkMedia.class), url, "tagged images");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the changes for a specific person id.
|
||||||
|
*
|
||||||
|
* Changes are grouped by key, and ordered by date in descending order.
|
||||||
|
*
|
||||||
|
* 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
|
||||||
|
* 14.
|
||||||
|
*
|
||||||
|
* The language is present on fields that are translatable.
|
||||||
|
*
|
||||||
|
* @param personId
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeKeyItem> getPersonChanges(int personId, String startDate, String endDate) throws MovieDbException {
|
||||||
|
return getMediaChanges(personId, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of popular people on The Movie Database.
|
||||||
|
*
|
||||||
|
* This list refreshes every day.
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<PersonFind> getPersonPopular(Integer page) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.POPULAR).buildUrl(parameters);
|
||||||
|
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person popular");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest person id.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public PersonInfo getPersonLatest() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.PERSON).subMethod(MethodSub.LATEST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, PersonInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest person", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.review.Review;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Review Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbReviews extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbReviews(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the full details of a review by ID.
|
||||||
|
*
|
||||||
|
* @param reviewId
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public Review getReview(String reviewId) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, reviewId);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.REVIEW).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, Review.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get review", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,264 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.SearchType;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.collection.Collection;
|
||||||
|
import com.omertron.themoviedbapi.model.company.Company;
|
||||||
|
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.movie.MovieInfo;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperMultiSearch;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the Search Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbSearch extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbSearch(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search Companies.
|
||||||
|
*
|
||||||
|
* You can use this method to search for production companies that are part of TMDb. The company IDs will map to those returned
|
||||||
|
* on movie calls.
|
||||||
|
*
|
||||||
|
* http://help.themoviedb.org/kb/api/search-companies
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Company> searchCompanies(String query, Integer page) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.COMPANY).buildUrl(parameters);
|
||||||
|
WrapperGenericList<Company> wrapper = processWrapper(getTypeReference(Company.class), url, "company");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for collections by name.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param language
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Collection> searchCollection(String query, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.COLLECTION).buildUrl(parameters);
|
||||||
|
WrapperGenericList<Collection> wrapper = processWrapper(getTypeReference(Collection.class), url, "collection");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for keywords by name
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Keyword> searchKeyword(String query, Integer page) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.KEYWORD).buildUrl(parameters);
|
||||||
|
WrapperGenericList<Keyword> wrapper = processWrapper(getTypeReference(Keyword.class), url, "keyword");
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param searchYear Limit the search to the provided year. Zero (0) will get all years
|
||||||
|
* @param language The language to include. Can be blank/null.
|
||||||
|
* @param includeAdult true or false to include adult titles in the search
|
||||||
|
* @param page The page of results to return. 0 to get the default (first page)
|
||||||
|
* @param primaryReleaseYear
|
||||||
|
* @param searchType
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MovieInfo> searchMovie(String query,
|
||||||
|
Integer page,
|
||||||
|
String language,
|
||||||
|
Boolean includeAdult,
|
||||||
|
Integer searchYear,
|
||||||
|
Integer primaryReleaseYear,
|
||||||
|
SearchType searchType) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.ADULT, includeAdult);
|
||||||
|
parameters.add(Param.YEAR, searchYear);
|
||||||
|
parameters.add(Param.PRIMARY_RELEASE_YEAR, primaryReleaseYear);
|
||||||
|
if (searchType != null) {
|
||||||
|
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
|
||||||
|
}
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.MOVIE).buildUrl(parameters);
|
||||||
|
|
||||||
|
WrapperGenericList<MovieInfo> wrapper = processWrapper(getTypeReference(MovieInfo.class), url, "movie");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search the movie, tv show and person collections with a single query.
|
||||||
|
*
|
||||||
|
* Each item returned in the result array has a media_type field that maps to either movie, tv or person.
|
||||||
|
*
|
||||||
|
* Each mapped result is the same response you would get from each independent search
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @param includeAdult
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<MediaBasic> searchMulti(String query, Integer page, String language, Boolean includeAdult) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.ADULT, includeAdult);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.MULTI).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperMultiSearch wrapper = MAPPER.readValue(webpage, WrapperMultiSearch.class);
|
||||||
|
ResultList<MediaBasic> results = new ResultList<MediaBasic>();
|
||||||
|
results.getResults().addAll(wrapper.getResults());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException 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.
|
||||||
|
*
|
||||||
|
* The idea is to be a quick and light method so you can iterate through people quickly.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param includeAdult
|
||||||
|
* @param page
|
||||||
|
* @param searchType
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<PersonFind> searchPeople(String query, Integer page, Boolean includeAdult, SearchType searchType) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.ADULT, includeAdult);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
if (searchType != null) {
|
||||||
|
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
|
||||||
|
}
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.PERSON).buildUrl(parameters);
|
||||||
|
WrapperGenericList<PersonFind> wrapper = processWrapper(getTypeReference(PersonFind.class), url, "person");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for TV shows by title.
|
||||||
|
*
|
||||||
|
* @param query
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @param firstAirDateYear
|
||||||
|
* @param searchType
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> searchTV(String query, Integer page, String language, Integer firstAirDateYear, SearchType searchType) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.QUERY, query);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.FIRST_AIR_DATE_YEAR, firstAirDateYear);
|
||||||
|
if (searchType != null) {
|
||||||
|
parameters.add(Param.SEARCH_TYPE, searchType.getPropertyString());
|
||||||
|
}
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEARCH).subMethod(MethodSub.TV).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "TV Show");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,233 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Video;
|
||||||
|
import com.omertron.themoviedbapi.model.person.ExternalID;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVSeasonInfo;
|
||||||
|
import com.omertron.themoviedbapi.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperVideos;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the TV Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbSeasons extends AbstractMethod {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbSeasons(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the primary information about a TV season by its season number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param language
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public TVSeasonInfo getSeasonInfo(int tvID, int seasonNumber, String language, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TVSeasonInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Season Info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Look up a TV season's changes by season ID.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeKeyItem> getSeasonChanges(int tvID, String startDate, String endDate) throws MovieDbException {
|
||||||
|
return getMediaChanges(tvID, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users get the status of whether or not the TV episodes
|
||||||
|
* of a season have been rated.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param sessionID
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaState getSeasonAccountState(int tvID, String sessionID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaState.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cast & crew credits for a TV season by season number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaCreditList getSeasonCredits(int tvID, int seasonNumber) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the external ids that we have stored for a TV season by season
|
||||||
|
* number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ExternalID getSeasonExternalID(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ExternalID.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get external IDs", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the images that we have stored for a TV season by season number.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param language
|
||||||
|
* @param includeImageLanguage
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getSeasonImages(int tvID, int seasonNumber, String language, String... includeImageLanguage) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, includeImageLanguage);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the videos that have been added to a TV season (trailers, teasers,
|
||||||
|
* etc...)
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param seasonNumber
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Video> getSeasonVideos(int tvID, int seasonNumber, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SEASON_NUMBER, seasonNumber);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.SEASON).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
|
||||||
|
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,465 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.methods;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import static com.omertron.themoviedbapi.methods.AbstractMethod.MAPPER;
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.omertron.themoviedbapi.model.artwork.Artwork;
|
||||||
|
import com.omertron.themoviedbapi.model.change.ChangeKeyItem;
|
||||||
|
import com.omertron.themoviedbapi.model.keyword.Keyword;
|
||||||
|
import com.omertron.themoviedbapi.model.media.AlternativeTitle;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaCreditList;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaState;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Translation;
|
||||||
|
import com.omertron.themoviedbapi.model.media.Video;
|
||||||
|
import com.omertron.themoviedbapi.model.person.ContentRating;
|
||||||
|
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.results.ResultList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperGenericList;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperImages;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperTranslations;
|
||||||
|
import com.omertron.themoviedbapi.results.WrapperVideos;
|
||||||
|
import com.omertron.themoviedbapi.tools.ApiUrl;
|
||||||
|
import com.omertron.themoviedbapi.tools.HttpTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodBase;
|
||||||
|
import com.omertron.themoviedbapi.tools.MethodSub;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostBody;
|
||||||
|
import com.omertron.themoviedbapi.tools.PostTools;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URL;
|
||||||
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to hold the TV Methods
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class TmdbTV extends AbstractMethod {
|
||||||
|
|
||||||
|
private static final int RATING_MAX = 10;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @param apiKey
|
||||||
|
* @param httpTools
|
||||||
|
*/
|
||||||
|
public TmdbTV(String apiKey, HttpTools httpTools) {
|
||||||
|
super(apiKey, httpTools);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the primary information about a TV series by id.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param language
|
||||||
|
* @param appendToResponse
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public TVInfo getTVInfo(int tvID, String language, String... appendToResponse) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.APPEND, appendToResponse);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TVInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get TV Info", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users get the status of whether or not the TV show has
|
||||||
|
* been rated or added to their favourite or watch lists.
|
||||||
|
*
|
||||||
|
* A valid session id is required.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param sessionID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaState getTVAccountState(int tvID, String sessionID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ACCOUNT_STATES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaState.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get account state", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the alternative titles for a specific show ID.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<AlternativeTitle> getTVAlternativeTitles(int tvID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.ALT_TITLES).buildUrl(parameters);
|
||||||
|
WrapperGenericList<AlternativeTitle> wrapper = processWrapper(getTypeReference(AlternativeTitle.class), url, "alternative titles");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the changes for a specific TV show id.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param startDate
|
||||||
|
* @param endDate
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ChangeKeyItem> getTVChanges(int tvID, String startDate, String endDate) throws MovieDbException {
|
||||||
|
return getMediaChanges(tvID, startDate, endDate);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the content ratings for a specific TV show id.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<ContentRating> getTVContentRatings(int tvID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CONTENT_RATINGS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<ContentRating> wrapper = processWrapper(getTypeReference(ContentRating.class), url, "content rating");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the cast & crew information about a TV series.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public MediaCreditList getTVCredits(int tvID, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.CREDITS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, MediaCreditList.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get credits", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the external ids that we have stored for a TV series.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ExternalID getTVExternalIDs(int tvID, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.EXTERNAL_IDS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, ExternalID.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get external IDs", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the images (posters and backdrops) for a TV series.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param language
|
||||||
|
* @param includeImageLanguage
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Artwork> getTVImages(int tvID, String language, String... includeImageLanguage) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.INCLUDE_IMAGE_LANGUAGE, includeImageLanguage);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.IMAGES).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperImages wrapper = MAPPER.readValue(webpage, WrapperImages.class);
|
||||||
|
ResultList<Artwork> results = new ResultList<Artwork>(wrapper.getAll());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get images", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the plot keywords for a specific TV show id.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Keyword> getTVKeywords(int tvID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.KEYWORDS).buildUrl(parameters);
|
||||||
|
WrapperGenericList<Keyword> wrapper = processWrapper(getTypeReference(Keyword.class), url, "keywords");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method lets users rate a TV show.
|
||||||
|
*
|
||||||
|
* A valid session id or guest session id is required.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param rating
|
||||||
|
* @param sessionID
|
||||||
|
* @param guestSessionID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public StatusCode postTVRating(int tvID, int rating, String sessionID, String guestSessionID) throws MovieDbException {
|
||||||
|
if (rating < 0 || rating > RATING_MAX) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.UNKNOWN_CAUSE, "Rating out of range");
|
||||||
|
}
|
||||||
|
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.SESSION_ID, sessionID);
|
||||||
|
parameters.add(Param.GUEST_SESSION_ID, guestSessionID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.RATING).buildUrl(parameters);
|
||||||
|
String jsonBody = new PostTools()
|
||||||
|
.add(PostBody.VALUE, rating)
|
||||||
|
.build();
|
||||||
|
String webpage = httpTools.postRequest(url, jsonBody);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, StatusCode.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to post rating", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the similar TV shows for a specific tv id.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVInfo> getTVSimilar(int tvID, Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.SIMILAR).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVInfo> wrapper = processWrapper(getTypeReference(TVInfo.class), url, "similar TV shows");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of translations that exist for a TV series. These
|
||||||
|
* translations cascade down to the episode level.
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Translation> getTVTranslations(int tvID) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.TRANSLATIONS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperTranslations wrapper = MAPPER.readValue(webpage, WrapperTranslations.class);
|
||||||
|
ResultList<Translation> results = new ResultList<Translation>(wrapper.getTranslations());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get translations", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the videos that have been added to a TV series (trailers, opening
|
||||||
|
* credits, etc...)
|
||||||
|
*
|
||||||
|
* @param tvID
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<Video> getTVVideos(int tvID, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.ID, tvID);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.VIDEOS).buildUrl(parameters);
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
WrapperVideos wrapper = MAPPER.readValue(webpage, WrapperVideos.class);
|
||||||
|
ResultList<Video> results = new ResultList<Video>(wrapper.getVideos());
|
||||||
|
wrapper.setResultProperties(results);
|
||||||
|
return results;
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get videos", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the latest TV show id.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public TVInfo getLatestTV() throws MovieDbException {
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.LATEST).buildUrl();
|
||||||
|
String webpage = httpTools.getRequest(url);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return MAPPER.readValue(webpage, TVInfo.class);
|
||||||
|
} catch (IOException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get latest TV show", url, ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of TV shows that are currently on the air.
|
||||||
|
*
|
||||||
|
* This query looks for any TV show that has an episode with an air date in
|
||||||
|
* the next 7 days.
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getTVOnTheAir(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
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");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of TV shows that air today.
|
||||||
|
*
|
||||||
|
* Without a specified timezone, this query defaults to EST
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @param timezone
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getTVAiringToday(Integer page, String language, String timezone) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
parameters.add(Param.TIMEZONE, timezone);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.AIRING_TODAY).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "airing today");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of top rated TV shows.
|
||||||
|
*
|
||||||
|
* By default, this list will only include TV shows that have 2 or more
|
||||||
|
* votes.
|
||||||
|
*
|
||||||
|
* This list refreshes every day.
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getTVTopRated(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
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");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the list of popular TV shows. This list refreshes every day.
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
* @throws com.omertron.themoviedbapi.MovieDbException
|
||||||
|
*/
|
||||||
|
public ResultList<TVBasic> getTVPopular(Integer page, String language) throws MovieDbException {
|
||||||
|
TmdbParameters parameters = new TmdbParameters();
|
||||||
|
parameters.add(Param.PAGE, page);
|
||||||
|
parameters.add(Param.LANGUAGE, language);
|
||||||
|
|
||||||
|
URL url = new ApiUrl(apiKey, MethodBase.TV).subMethod(MethodSub.POPULAR).buildUrl(parameters);
|
||||||
|
WrapperGenericList<TVBasic> wrapper = processWrapper(getTypeReference(TVBasic.class), url, "popular TV shows");
|
||||||
|
return wrapper.getResultsList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class AbstractIdName extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(final Object obj) {
|
||||||
|
if (obj instanceof AbstractIdName) {
|
||||||
|
final AbstractIdName other = (AbstractIdName) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(id, other.id)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.append(id)
|
||||||
|
.append(name)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract class to handle any unknown properties by outputting a log message
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public abstract class AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(AbstractJsonMapping.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle unknown properties and print a message
|
||||||
|
*
|
||||||
|
* @param key
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
@JsonAnySetter
|
||||||
|
protected void handleUnknown(String key, Object value) {
|
||||||
|
StringBuilder unknown = new StringBuilder(this.getClass().getSimpleName());
|
||||||
|
unknown.append(": Unknown property='").append(key);
|
||||||
|
unknown.append("' value='").append(value).append("'");
|
||||||
|
|
||||||
|
LOG.trace(unknown.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return ToStringBuilder.reflectionToString(this, ToStringStyle.SHORT_PREFIX_STYLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,116 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class AlternativeTitle implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AlternativeTitle.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("iso_3166_1")
|
|
||||||
private String country;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCountry() {
|
|
||||||
return country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final AlternativeTitle other = (AlternativeTitle) obj;
|
|
||||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
|
||||||
hash = 89 * hash + (this.title != null ? this.title.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[AlternativeTitle=");
|
|
||||||
sb.append("[country=").append(country);
|
|
||||||
sb.append("],[title=").append(title);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,208 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The artwork type information
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class Artwork implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Artwork.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("aspect_ratio")
|
|
||||||
private float aspectRatio;
|
|
||||||
@JsonProperty("file_path")
|
|
||||||
private String filePath;
|
|
||||||
@JsonProperty("height")
|
|
||||||
private int height;
|
|
||||||
@JsonProperty("iso_639_1")
|
|
||||||
private String language;
|
|
||||||
@JsonProperty("width")
|
|
||||||
private int width;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private int voteCount;
|
|
||||||
@JsonProperty("flag")
|
|
||||||
private String flag;
|
|
||||||
private ArtworkType artworkType = ArtworkType.POSTER;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public ArtworkType getArtworkType() {
|
|
||||||
return artworkType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getAspectRatio() {
|
|
||||||
return aspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFilePath() {
|
|
||||||
return filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getHeight() {
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getFlag() {
|
|
||||||
return flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setArtworkType(ArtworkType artworkType) {
|
|
||||||
this.artworkType = artworkType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAspectRatio(float aspectRatio) {
|
|
||||||
this.aspectRatio = aspectRatio;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFilePath(String filePath) {
|
|
||||||
this.filePath = filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHeight(int height) {
|
|
||||||
this.height = height;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWidth(int width) {
|
|
||||||
this.width = width;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(int voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFlag(String flag) {
|
|
||||||
this.flag = flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Artwork other = (Artwork) obj;
|
|
||||||
if (Float.floatToIntBits(this.aspectRatio) != Float.floatToIntBits(other.aspectRatio)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.filePath == null) ? (other.filePath != null) : !this.filePath.equals(other.filePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.height != other.height) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.language == null) ? (other.language != null) : !this.language.equals(other.language)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.width != other.width) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.artworkType != other.artworkType) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 71 * hash + Float.floatToIntBits(this.aspectRatio);
|
|
||||||
hash = 71 * hash + (this.filePath != null ? this.filePath.hashCode() : 0);
|
|
||||||
hash = 71 * hash + this.height;
|
|
||||||
hash = 71 * hash + (this.language != null ? this.language.hashCode() : 0);
|
|
||||||
hash = 71 * hash + this.width;
|
|
||||||
hash = 71 * hash + (this.artworkType != null ? this.artworkType.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Artwork=");
|
|
||||||
sb.append("[aspectRatio=").append(aspectRatio);
|
|
||||||
sb.append("],[filePath=").append(filePath);
|
|
||||||
sb.append("],[height=").append(height);
|
|
||||||
sb.append("],[language=").append(language);
|
|
||||||
sb.append("],[width=").append(width);
|
|
||||||
sb.append("],[artworkType=").append(artworkType);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@JsonRootName("certification")
|
||||||
|
public class Certification extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
// Properties
|
||||||
|
@JsonProperty("certification")
|
||||||
|
private String value;
|
||||||
|
@JsonProperty("meaning")
|
||||||
|
private String meaning;
|
||||||
|
@JsonProperty("order")
|
||||||
|
private int order;
|
||||||
|
|
||||||
|
public String getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(String value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMeaning() {
|
||||||
|
return meaning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMeaning(String meaning) {
|
||||||
|
this.meaning = meaning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(int order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class ChangeValue {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("poster")
|
|
||||||
private Artwork poster;
|
|
||||||
@JsonProperty("backdrop")
|
|
||||||
private Artwork backdrop;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("iso_3166_1")
|
|
||||||
private String language;
|
|
||||||
@JsonProperty("site")
|
|
||||||
private String site;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public Artwork getPoster() {
|
|
||||||
return poster;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Artwork getBackdrop() {
|
|
||||||
return backdrop;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSite() {
|
|
||||||
return site;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
|
||||||
public void setPoster(Artwork poster) {
|
|
||||||
this.poster = poster;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBackdrop(Artwork backdrop) {
|
|
||||||
this.backdrop = backdrop;
|
|
||||||
backdrop.setArtworkType(ArtworkType.BACKDROP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
|
||||||
this.language = language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSite(String site) {
|
|
||||||
this.site = site;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
@JsonRootName("collection")
|
|
||||||
public class Collection implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Collection.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
if (StringUtils.isBlank(title)) {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
if (StringUtils.isBlank(name)) {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Collection other = (Collection) obj;
|
|
||||||
if ((this.backdropPath == null) ? (other.backdropPath != null) : !this.backdropPath.equals(other.backdropPath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 19 * hash + (this.backdropPath != null ? this.backdropPath.hashCode() : 0);
|
|
||||||
hash = 19 * hash + this.id;
|
|
||||||
hash = 19 * hash + (this.title != null ? this.title.hashCode() : 0);
|
|
||||||
hash = 19 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
hash = 19 * hash + (this.posterPath != null ? this.posterPath.hashCode() : 0);
|
|
||||||
hash = 19 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Collection=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[title=").append(title);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("],[posterPath=").append(posterPath);
|
|
||||||
sb.append("],[backdropPath=").append(backdropPath);
|
|
||||||
sb.append("],[releaseDate=").append(releaseDate);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.person.PersonFind;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVEpisodeBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVSeasonBasic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class FindResults extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("movie_results")
|
||||||
|
private List<MovieBasic> movieResults;
|
||||||
|
@JsonProperty("person_results")
|
||||||
|
private List<PersonFind> personResults;
|
||||||
|
@JsonProperty("tv_results")
|
||||||
|
private List<TVBasic> tvResults;
|
||||||
|
@JsonProperty("tv_season_results")
|
||||||
|
private List<TVSeasonBasic> tvSeasonResults;
|
||||||
|
@JsonProperty("tv_episode_results")
|
||||||
|
private List<TVEpisodeBasic> tvEpisodeResults;
|
||||||
|
|
||||||
|
public List<MovieBasic> getMovieResults() {
|
||||||
|
return movieResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMovieResults(List<MovieBasic> movieResults) {
|
||||||
|
this.movieResults = movieResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<PersonFind> getPersonResults() {
|
||||||
|
return personResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPersonResults(List<PersonFind> personResults) {
|
||||||
|
this.personResults = personResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TVBasic> getTvResults() {
|
||||||
|
return tvResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvResults(List<TVBasic> tvResults) {
|
||||||
|
this.tvResults = tvResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TVSeasonBasic> getTvSeasonResults() {
|
||||||
|
return tvSeasonResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvSeasonResults(List<TVSeasonBasic> tvSeasonResults) {
|
||||||
|
this.tvSeasonResults = tvSeasonResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TVEpisodeBasic> getTvEpisodeResults() {
|
||||||
|
return tvEpisodeResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTvEpisodeResults(List<TVEpisodeBasic> tvEpisodeResults) {
|
||||||
|
this.tvEpisodeResults = tvEpisodeResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,99 +19,15 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
@JsonRootName("genre")
|
@JsonRootName("genre")
|
||||||
public class Genre implements Serializable {
|
public class Genre extends AbstractIdName implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 4L;
|
||||||
/*
|
// Nothing to override from the base class.
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Genre.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Genre other = (Genre) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 5;
|
|
||||||
hash = 53 * hash + this.id;
|
|
||||||
hash = 53 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Genre=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
@JsonRootName("keyword")
|
|
||||||
public class Keyword implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Keyword.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Keyword other = (Keyword) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 83 * hash + this.id;
|
|
||||||
hash = 83 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Keyword=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class KeywordMovie implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(KeywordMovie.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String originalTitle;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private double voteCount;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public static long getSerialVersionUID() {
|
|
||||||
return serialVersionUID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginalTitle() {
|
|
||||||
return originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalTitle(String originalTitle) {
|
|
||||||
this.originalTitle = originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(double voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,34 +19,25 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.slf4j.Logger;
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
@JsonRootName("spoken_language")
|
@JsonRootName("spoken_language")
|
||||||
public class Language implements Serializable {
|
public class Language extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Language.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("iso_639_1")
|
@JsonProperty("iso_639_1")
|
||||||
private String isoCode;
|
private String isoCode;
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getIsoCode() {
|
public String getIsoCode() {
|
||||||
return isoCode;
|
return isoCode;
|
||||||
}
|
}
|
||||||
@@ -54,9 +45,7 @@ public class Language implements Serializable {
|
|||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setIsoCode(String isoCode) {
|
public void setIsoCode(String isoCode) {
|
||||||
this.isoCode = isoCode;
|
this.isoCode = isoCode;
|
||||||
}
|
}
|
||||||
@@ -64,54 +53,25 @@ public class Language implements Serializable {
|
|||||||
public void setName(String name) {
|
public void setName(String name) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (obj == null) {
|
if (obj instanceof Language) {
|
||||||
|
final Language other = (Language) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(isoCode, other.isoCode)
|
||||||
|
.append(name, other.name)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Language other = (Language) obj;
|
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int hash = 7;
|
return new HashCodeBuilder()
|
||||||
hash = 71 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
.append(isoCode)
|
||||||
hash = 71 * hash + (this.name != null ? this.name.hashCode() : 0);
|
.append(name)
|
||||||
return hash;
|
.toHashCode();
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Language=");
|
|
||||||
sb.append("isoCode=").append(isoCode);
|
|
||||||
sb.append(", name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,82 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class MovieChanges implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("key")
|
|
||||||
private String key;
|
|
||||||
@JsonProperty("items")
|
|
||||||
private List<ChangeItem> items;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getKey() {
|
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ChangeItem> getItems() {
|
|
||||||
return items;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
|
||||||
public void setKey(String key) {
|
|
||||||
this.key = key;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setItems(List<ChangeItem> items) {
|
|
||||||
this.items = items;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,354 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Movie Bean
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class MovieDb implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieDb.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("backdrop_path")
|
|
||||||
private String backdropPath;
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String originalTitle;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String title;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private boolean adult;
|
|
||||||
@JsonProperty("belongs_to_collection")
|
|
||||||
private Collection belongsToCollection;
|
|
||||||
@JsonProperty("budget")
|
|
||||||
private long budget;
|
|
||||||
@JsonProperty("genres")
|
|
||||||
private List<Genre> genres;
|
|
||||||
@JsonProperty("homepage")
|
|
||||||
private String homepage;
|
|
||||||
@JsonProperty("imdb_id")
|
|
||||||
private String imdbID;
|
|
||||||
@JsonProperty("overview")
|
|
||||||
private String overview;
|
|
||||||
@JsonProperty("production_companies")
|
|
||||||
private List<ProductionCompany> productionCompanies;
|
|
||||||
@JsonProperty("production_countries")
|
|
||||||
private List<ProductionCountry> productionCountries;
|
|
||||||
@JsonProperty("revenue")
|
|
||||||
private long revenue;
|
|
||||||
@JsonProperty("runtime")
|
|
||||||
private int runtime;
|
|
||||||
@JsonProperty("spoken_languages")
|
|
||||||
private List<Language> spokenLanguages;
|
|
||||||
@JsonProperty("tagline")
|
|
||||||
private String tagline;
|
|
||||||
@JsonProperty("vote_average")
|
|
||||||
private float voteAverage;
|
|
||||||
@JsonProperty("vote_count")
|
|
||||||
private int voteCount;
|
|
||||||
@JsonProperty("status")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
|
||||||
return backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOriginalTitle() {
|
|
||||||
return originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle() {
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection getBelongsToCollection() {
|
|
||||||
return belongsToCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getBudget() {
|
|
||||||
return budget;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Genre> getGenres() {
|
|
||||||
return genres;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHomepage() {
|
|
||||||
return homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImdbID() {
|
|
||||||
return imdbID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getOverview() {
|
|
||||||
return overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProductionCompany> getProductionCompanies() {
|
|
||||||
return productionCompanies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ProductionCountry> getProductionCountries() {
|
|
||||||
return productionCountries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getRevenue() {
|
|
||||||
return revenue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getRuntime() {
|
|
||||||
return runtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Language> getSpokenLanguages() {
|
|
||||||
return spokenLanguages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTagline() {
|
|
||||||
return tagline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getVoteAverage() {
|
|
||||||
return voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getVoteCount() {
|
|
||||||
return voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
|
||||||
this.backdropPath = backdropPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalTitle(String originalTitle) {
|
|
||||||
this.originalTitle = originalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTitle(String title) {
|
|
||||||
this.title = title;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(boolean adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBelongsToCollection(Collection belongsToCollection) {
|
|
||||||
this.belongsToCollection = belongsToCollection;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBudget(long budget) {
|
|
||||||
this.budget = budget;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setGenres(List<Genre> genres) {
|
|
||||||
this.genres = genres;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomepage(String homepage) {
|
|
||||||
this.homepage = homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImdbID(String imdbID) {
|
|
||||||
this.imdbID = imdbID;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOverview(String overview) {
|
|
||||||
this.overview = overview;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductionCompanies(List<ProductionCompany> productionCompanies) {
|
|
||||||
this.productionCompanies = productionCompanies;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProductionCountries(List<ProductionCountry> productionCountries) {
|
|
||||||
this.productionCountries = productionCountries;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRevenue(long revenue) {
|
|
||||||
this.revenue = revenue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRuntime(int runtime) {
|
|
||||||
this.runtime = runtime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSpokenLanguages(List<Language> spokenLanguages) {
|
|
||||||
this.spokenLanguages = spokenLanguages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTagline(String tagline) {
|
|
||||||
this.tagline = tagline;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteAverage(float voteAverage) {
|
|
||||||
this.voteAverage = voteAverage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVoteCount(int voteCount) {
|
|
||||||
this.voteCount = voteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
// </editor-fold>
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Equals and HashCode">
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final MovieDb other = (MovieDb) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.imdbID == null) ? (other.imdbID != null) : !this.imdbID.equals(other.imdbID)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.runtime != other.runtime) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 5;
|
|
||||||
hash = 89 * hash + this.id;
|
|
||||||
hash = 89 * hash + (this.imdbID != null ? this.imdbID.hashCode() : 0);
|
|
||||||
hash = 89 * hash + this.runtime;
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[MovieDB=");
|
|
||||||
sb.append("[backdropPath=").append(backdropPath);
|
|
||||||
sb.append("],[id=").append(id);
|
|
||||||
sb.append("],[originalTitle=").append(originalTitle);
|
|
||||||
sb.append("],[popularity=").append(popularity);
|
|
||||||
sb.append("],[posterPath=").append(posterPath);
|
|
||||||
sb.append("],[releaseDate=").append(releaseDate);
|
|
||||||
sb.append("],[title=").append(title);
|
|
||||||
sb.append("],[adult=").append(adult);
|
|
||||||
sb.append("],[belongsToCollection=").append(belongsToCollection);
|
|
||||||
sb.append("],[budget=").append(budget);
|
|
||||||
sb.append("],[genres=").append(genres);
|
|
||||||
sb.append("],[homepage=").append(homepage);
|
|
||||||
sb.append("],[imdbID=").append(imdbID);
|
|
||||||
sb.append("],[overview=").append(overview);
|
|
||||||
sb.append("],[productionCompanies=").append(productionCompanies);
|
|
||||||
sb.append("],[productionCountries=").append(productionCountries);
|
|
||||||
sb.append("],[revenue=").append(revenue);
|
|
||||||
sb.append("],[runtime=").append(runtime);
|
|
||||||
sb.append("],[spokenLanguages=").append(spokenLanguages);
|
|
||||||
sb.append("],[tagline=").append(tagline);
|
|
||||||
sb.append("],[voteAverage=").append(voteAverage);
|
|
||||||
sb.append("],[voteCount=").append(voteCount);
|
|
||||||
sb.append("],[status=").append(status);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,343 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class Person implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Person.class);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Static fields for default cast information
|
|
||||||
*/
|
|
||||||
private static final String CAST_DEPARTMENT = "acting";
|
|
||||||
private static final String CAST_JOB = "actor";
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id = -1;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name = "";
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath = DEFAULT_STRING;
|
|
||||||
private PersonType personType = PersonType.PERSON;
|
|
||||||
private String department = DEFAULT_STRING; // Crew
|
|
||||||
private String job = DEFAULT_STRING; // Crew
|
|
||||||
private String character = DEFAULT_STRING; // Cast
|
|
||||||
private int order = -1; // Cast
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private boolean adult = false; // Person info
|
|
||||||
@JsonProperty("also_known_as")
|
|
||||||
private List<String> aka = new ArrayList<String>();
|
|
||||||
@JsonProperty("biography")
|
|
||||||
private String biography = DEFAULT_STRING;
|
|
||||||
@JsonProperty("birthday")
|
|
||||||
private String birthday = DEFAULT_STRING;
|
|
||||||
@JsonProperty("deathday")
|
|
||||||
private String deathday = DEFAULT_STRING;
|
|
||||||
@JsonProperty("homepage")
|
|
||||||
private String homepage = DEFAULT_STRING;
|
|
||||||
@JsonProperty("place_of_birth")
|
|
||||||
private String birthplace = DEFAULT_STRING;
|
|
||||||
@JsonProperty("imdb_id")
|
|
||||||
private String imdbId = DEFAULT_STRING;
|
|
||||||
@JsonProperty("popularity")
|
|
||||||
private float popularity = 0.0f;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a crew member
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param profilePath
|
|
||||||
* @param department
|
|
||||||
* @param job
|
|
||||||
*/
|
|
||||||
public void addCrew(int id, String name, String profilePath, String department, String job) {
|
|
||||||
this.personType = PersonType.CREW;
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
this.department = department;
|
|
||||||
this.job = job;
|
|
||||||
this.character = "";
|
|
||||||
this.order = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a cast member
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param profilePath
|
|
||||||
* @param character
|
|
||||||
* @param order
|
|
||||||
*/
|
|
||||||
public void addCast(int id, String name, String profilePath, String character, int order) {
|
|
||||||
this.personType = PersonType.CAST;
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
this.character = character;
|
|
||||||
this.order = order;
|
|
||||||
this.department = CAST_DEPARTMENT;
|
|
||||||
this.job = CAST_JOB;
|
|
||||||
}
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PersonType getPersonType() {
|
|
||||||
return personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<String> getAka() {
|
|
||||||
return aka;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBiography() {
|
|
||||||
return biography;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBirthday() {
|
|
||||||
return birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBirthplace() {
|
|
||||||
return birthplace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeathday() {
|
|
||||||
return deathday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getHomepage() {
|
|
||||||
return homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getImdbId() {
|
|
||||||
return imdbId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float getPopularity() {
|
|
||||||
return popularity;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder(int order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonType(PersonType personType) {
|
|
||||||
this.personType = personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(boolean adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAka(List<String> aka) {
|
|
||||||
this.aka = aka;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBiography(String biography) {
|
|
||||||
this.biography = biography;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthday(String birthday) {
|
|
||||||
this.birthday = birthday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBirthplace(String birthplace) {
|
|
||||||
this.birthplace = birthplace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeathday(String deathday) {
|
|
||||||
this.deathday = deathday;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomepage(String homepage) {
|
|
||||||
this.homepage = homepage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setImdbId(String imdbId) {
|
|
||||||
this.imdbId = imdbId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPopularity(float popularity) {
|
|
||||||
this.popularity = popularity;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Person other = (Person) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.personType != other.personType) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 37 * hash + this.id;
|
|
||||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
hash = 37 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
|
||||||
hash = 37 * hash + (this.personType != null ? this.personType.hashCode() : 0);
|
|
||||||
hash = 37 * hash + (this.department != null ? this.department.hashCode() : 0);
|
|
||||||
hash = 37 * hash + (this.job != null ? this.job.hashCode() : 0);
|
|
||||||
hash = 37 * hash + (this.character != null ? this.character.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Person=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("],[profilePath=").append(profilePath);
|
|
||||||
sb.append("],[personType=").append(personType);
|
|
||||||
sb.append("],[department=").append(department);
|
|
||||||
sb.append("],[job=").append(job);
|
|
||||||
sb.append("],[character=").append(character);
|
|
||||||
sb.append("],[order=").append(order);
|
|
||||||
sb.append("],[adult=").append(adult);
|
|
||||||
sb.append("],[=aka").append(aka.toString());
|
|
||||||
sb.append("],[biography=").append(biography);
|
|
||||||
sb.append("],[birthday=").append(birthday);
|
|
||||||
sb.append("],[deathday=").append(deathday);
|
|
||||||
sb.append("],[homepage=").append(homepage);
|
|
||||||
sb.append("],[birthplace=").append(birthplace);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,173 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class PersonCast implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCast.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("character")
|
|
||||||
private String character;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("order")
|
|
||||||
private int order;
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath;
|
|
||||||
@JsonProperty("cast_id")
|
|
||||||
private int castId;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getOrder() {
|
|
||||||
return order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCastId() {
|
|
||||||
return castId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setOrder(int order) {
|
|
||||||
this.order = order;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCastId(int castId) {
|
|
||||||
this.castId = castId;
|
|
||||||
}
|
|
||||||
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PersonCast other = (PersonCast) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.character == null) ? (other.character != null) : !this.character.equals(other.character)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (this.order != other.order) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.profilePath == null) ? (other.profilePath != null) : !this.profilePath.equals(other.profilePath)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 41 * hash + this.id;
|
|
||||||
hash = 41 * hash + (this.character != null ? this.character.hashCode() : 0);
|
|
||||||
hash = 41 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
hash = 41 * hash + this.order;
|
|
||||||
hash = 41 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[PersonCast=");
|
|
||||||
sb.append("id=").append(id);
|
|
||||||
sb.append("],[character=").append(character);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("],[order=").append(order);
|
|
||||||
sb.append("],[profilePath=").append(profilePath);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
public class PersonCredit implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCredit.class);
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int movieId = 0;
|
|
||||||
@JsonProperty("character")
|
|
||||||
private String character = DEFAULT_STRING;
|
|
||||||
@JsonProperty("original_title")
|
|
||||||
private String movieOriginalTitle = DEFAULT_STRING;
|
|
||||||
@JsonProperty("poster_path")
|
|
||||||
private String posterPath = DEFAULT_STRING;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate = DEFAULT_STRING;
|
|
||||||
@JsonProperty("title")
|
|
||||||
private String movieTitle = DEFAULT_STRING;
|
|
||||||
@JsonProperty("department")
|
|
||||||
private String department = DEFAULT_STRING;
|
|
||||||
@JsonProperty("job")
|
|
||||||
private String job = DEFAULT_STRING;
|
|
||||||
@JsonProperty("adult")
|
|
||||||
private String adult = DEFAULT_STRING;
|
|
||||||
private PersonType personType = PersonType.PERSON;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getCharacter() {
|
|
||||||
return character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMovieId() {
|
|
||||||
return movieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMovieOriginalTitle() {
|
|
||||||
return movieOriginalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMovieTitle() {
|
|
||||||
return movieTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PersonType getPersonType() {
|
|
||||||
return personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAdult() {
|
|
||||||
return adult;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
|
||||||
public void setCharacter(String character) {
|
|
||||||
this.character = character;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieId(int movieId) {
|
|
||||||
this.movieId = movieId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieOriginalTitle(String movieOriginalTitle) {
|
|
||||||
this.movieOriginalTitle = movieOriginalTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMovieTitle(String movieTitle) {
|
|
||||||
this.movieTitle = movieTitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPersonType(PersonType personType) {
|
|
||||||
this.personType = personType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAdult(String adult) {
|
|
||||||
this.adult = adult;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[PersonCredit=");
|
|
||||||
sb.append("[movieId=").append(movieId);
|
|
||||||
sb.append("],[personType=").append(personType);
|
|
||||||
sb.append("],[originalTitle=").append(movieOriginalTitle);
|
|
||||||
sb.append("],[movieTitle=").append(movieTitle);
|
|
||||||
sb.append("],[posterPath=").append(posterPath);
|
|
||||||
sb.append("],[releaseDate=").append(releaseDate);
|
|
||||||
sb.append("],[character=").append(character);
|
|
||||||
sb.append("],[department=").append(department);
|
|
||||||
sb.append("],[job=").append(job);
|
|
||||||
sb.append("],[adult=").append(adult);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,158 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class PersonCrew implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(PersonCrew.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("department")
|
|
||||||
private String department;
|
|
||||||
@JsonProperty("job")
|
|
||||||
private String job;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
@JsonProperty("profile_path")
|
|
||||||
private String profilePath;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getDepartment() {
|
|
||||||
return department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getJob() {
|
|
||||||
return job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProfilePath() {
|
|
||||||
return profilePath;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setDepartment(String department) {
|
|
||||||
this.department = department;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setJob(String job) {
|
|
||||||
this.job = job;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProfilePath(String profilePath) {
|
|
||||||
this.profilePath = profilePath;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final PersonCrew other = (PersonCrew) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.department == null) ? (other.department != null) : !this.department.equals(other.department)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.job == null) ? (other.job != null) : !this.job.equals(other.job)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 59 * hash + this.id;
|
|
||||||
hash = 59 * hash + (this.department != null ? this.department.hashCode() : 0);
|
|
||||||
hash = 59 * hash + (this.job != null ? this.job.hashCode() : 0);
|
|
||||||
hash = 59 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
hash = 59 * hash + (this.profilePath != null ? this.profilePath.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[PersonCrew=");
|
|
||||||
sb.append("id=").append(id);
|
|
||||||
sb.append("],[department=").append(department);
|
|
||||||
sb.append("],[job=").append(job);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("],[profilePath=").append(profilePath);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
@JsonRootName("production_company")
|
|
||||||
public class ProductionCompany implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ProductionCompany.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
|
||||||
private int id;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public int getId() {
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setId(int id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ProductionCompany other = (ProductionCompany) obj;
|
|
||||||
if (this.id != other.id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 5;
|
|
||||||
hash = 37 * hash + this.id;
|
|
||||||
hash = 37 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[ProductionCompany=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonRootName;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author stuart.boston
|
|
||||||
*/
|
|
||||||
@JsonRootName("production_country")
|
|
||||||
public class ProductionCountry implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ProductionCountry.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("iso_3166_1")
|
|
||||||
private String isoCode;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getIsoCode() {
|
|
||||||
return isoCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setIsoCode(String isoCode) {
|
|
||||||
this.isoCode = isoCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ProductionCountry other = (ProductionCountry) obj;
|
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 47 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
|
||||||
hash = 47 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[ProductionCountry=");
|
|
||||||
sb.append("[isoCode=").append(isoCode);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class ReleaseInfo implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(ReleaseInfo.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("iso_3166_1")
|
|
||||||
private String country;
|
|
||||||
@JsonProperty("certification")
|
|
||||||
private String certification;
|
|
||||||
@JsonProperty("release_date")
|
|
||||||
private String releaseDate;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getCertification() {
|
|
||||||
return certification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCountry() {
|
|
||||||
return country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getReleaseDate() {
|
|
||||||
return releaseDate;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setCertification(String certification) {
|
|
||||||
this.certification = certification;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCountry(String country) {
|
|
||||||
this.country = country;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setReleaseDate(String releaseDate) {
|
|
||||||
this.releaseDate = releaseDate;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ReleaseInfo other = (ReleaseInfo) obj;
|
|
||||||
if ((this.country == null) ? (other.country != null) : !this.country.equals(other.country)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.certification == null) ? (other.certification != null) : !this.certification.equals(other.certification)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.releaseDate == null) ? (other.releaseDate != null) : !this.releaseDate.equals(other.releaseDate)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 89 * hash + (this.country != null ? this.country.hashCode() : 0);
|
|
||||||
hash = 89 * hash + (this.certification != null ? this.certification.hashCode() : 0);
|
|
||||||
hash = 89 * hash + (this.releaseDate != null ? this.releaseDate.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[ReleaseInfo=");
|
|
||||||
sb.append("[country=").append(country);
|
|
||||||
sb.append("],[certification=").append(certification);
|
|
||||||
sb.append("],[releaseDate=").append(releaseDate);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -19,71 +19,33 @@
|
|||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class StatusCode implements Serializable {
|
public class StatusCode extends AbstractJsonMapping {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(StatusCode.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("status_code")
|
@JsonProperty("status_code")
|
||||||
private int statusCode;
|
private int code;
|
||||||
@JsonProperty("status_message")
|
@JsonProperty("status_message")
|
||||||
private String statusMessage;
|
private String message;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
public int getCode() {
|
||||||
public int getStatusCode() {
|
return code;
|
||||||
return statusCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusCode(int statusCode) {
|
public void setCode(int code) {
|
||||||
this.statusCode = statusCode;
|
this.code = code;
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public String getStatusMessage() {
|
|
||||||
return statusMessage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusMessage(String statusMessage) {
|
public String getMessage() {
|
||||||
this.statusMessage = statusMessage;
|
return message;
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setMessage(String message) {
|
||||||
public String toString() {
|
this.message = message;
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Status Code: ").append(statusCode);
|
|
||||||
sb.append(", Message: ").append(statusMessage);
|
|
||||||
return sb.toString();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,143 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class Trailer implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Trailer.class);
|
|
||||||
/*
|
|
||||||
* Website sources
|
|
||||||
*/
|
|
||||||
public static final String WEBSITE_YOUTUBE = "youtube";
|
|
||||||
public static final String WEBSITE_QUICKTIME = "quicktime";
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
private String size;
|
|
||||||
private String source;
|
|
||||||
private String website; // The website of the trailer
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSize() {
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getSource() {
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWebsite() {
|
|
||||||
return website;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSize(String size) {
|
|
||||||
this.size = size;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSource(String source) {
|
|
||||||
this.source = source;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWebsite(String website) {
|
|
||||||
this.website = website;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Trailer other = (Trailer) obj;
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.size == null) ? (other.size != null) : !this.size.equals(other.size)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.source == null) ? (other.source != null) : !this.source.equals(other.source)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 7;
|
|
||||||
hash = 61 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
hash = 61 * hash + (this.size != null ? this.size.hashCode() : 0);
|
|
||||||
hash = 61 * hash + (this.source != null ? this.source.hashCode() : 0);
|
|
||||||
hash = 61 * hash + (this.website != null ? this.website.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Trailer=");
|
|
||||||
sb.append("name=").append(name);
|
|
||||||
sb.append("],[size=").append(size);
|
|
||||||
sb.append("],[source=").append(source);
|
|
||||||
sb.append("],[website=").append(website);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,131 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2004-2013 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;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import java.io.Serializable;
|
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Stuart
|
|
||||||
*/
|
|
||||||
public class Translation implements Serializable {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Translation.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("english_name")
|
|
||||||
private String englishName;
|
|
||||||
@JsonProperty("iso_639_1")
|
|
||||||
private String isoCode;
|
|
||||||
@JsonProperty("name")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getEnglishName() {
|
|
||||||
return englishName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getIsoCode() {
|
|
||||||
return isoCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setEnglishName(String englishName) {
|
|
||||||
this.englishName = englishName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setIsoCode(String isoCode) {
|
|
||||||
this.isoCode = isoCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setName(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (getClass() != obj.getClass()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final Translation other = (Translation) obj;
|
|
||||||
if ((this.englishName == null) ? (other.englishName != null) : !this.englishName.equals(other.englishName)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.isoCode == null) ? (other.isoCode != null) : !this.isoCode.equals(other.isoCode)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
int hash = 3;
|
|
||||||
hash = 29 * hash + (this.englishName != null ? this.englishName.hashCode() : 0);
|
|
||||||
hash = 29 * hash + (this.isoCode != null ? this.isoCode.hashCode() : 0);
|
|
||||||
hash = 29 * hash + (this.name != null ? this.name.hashCode() : 0);
|
|
||||||
return hash;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[Translation=");
|
|
||||||
sb.append("[englishName=").append(englishName);
|
|
||||||
sb.append("],[isoCode=").append(isoCode);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,93 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class Account extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
@JsonProperty("username")
|
||||||
|
private String userName;
|
||||||
|
@JsonProperty("include_adult")
|
||||||
|
private boolean includeAdult;
|
||||||
|
@JsonProperty("iso_639_1")
|
||||||
|
private String language;
|
||||||
|
@JsonProperty("iso_3166_1")
|
||||||
|
private String country;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isIncludeAdult() {
|
||||||
|
return includeAdult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIncludeAdult(boolean includeAdult) {
|
||||||
|
this.includeAdult = includeAdult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserName() {
|
||||||
|
return userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserName(String userName) {
|
||||||
|
this.userName = userName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,172 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.artwork;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.ArtworkType;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The artwork type information
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class Artwork extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private String id;
|
||||||
|
@JsonProperty("aspect_ratio")
|
||||||
|
private float aspectRatio;
|
||||||
|
@JsonProperty("file_path")
|
||||||
|
private String filePath;
|
||||||
|
@JsonProperty("height")
|
||||||
|
private int height;
|
||||||
|
@JsonProperty("iso_639_1")
|
||||||
|
private String language;
|
||||||
|
@JsonProperty("width")
|
||||||
|
private int width;
|
||||||
|
@JsonProperty("vote_average")
|
||||||
|
private float voteAverage;
|
||||||
|
@JsonProperty("vote_count")
|
||||||
|
private int voteCount;
|
||||||
|
@JsonProperty("flag")
|
||||||
|
private String flag;
|
||||||
|
private ArtworkType artworkType = ArtworkType.POSTER;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getAspectRatio() {
|
||||||
|
return aspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAspectRatio(float aspectRatio) {
|
||||||
|
this.aspectRatio = aspectRatio;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilePath() {
|
||||||
|
return filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilePath(String filePath) {
|
||||||
|
this.filePath = filePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHeight() {
|
||||||
|
return height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeight(int height) {
|
||||||
|
this.height = height;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLanguage(String language) {
|
||||||
|
this.language = language;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWidth(int width) {
|
||||||
|
this.width = width;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFlag() {
|
||||||
|
return flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlag(String flag) {
|
||||||
|
this.flag = flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArtworkType getArtworkType() {
|
||||||
|
return artworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtworkType(ArtworkType artworkType) {
|
||||||
|
this.artworkType = artworkType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("image_type")
|
||||||
|
public void setArtworkType(String artworkType) {
|
||||||
|
this.artworkType = ArtworkType.fromString(artworkType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof Artwork) {
|
||||||
|
final Artwork other = (Artwork) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(aspectRatio, other.aspectRatio)
|
||||||
|
.append(filePath, other.filePath)
|
||||||
|
.append(language, other.language)
|
||||||
|
.append(height, other.height)
|
||||||
|
.append(width, other.width)
|
||||||
|
.append(artworkType, other.artworkType)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.append(aspectRatio)
|
||||||
|
.append(filePath)
|
||||||
|
.append(height)
|
||||||
|
.append(width)
|
||||||
|
.append(language)
|
||||||
|
.append(artworkType)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.artwork;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import com.omertron.themoviedbapi.model.media.MediaBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.movie.MovieBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVBasic;
|
||||||
|
import com.omertron.themoviedbapi.model.tv.TVEpisodeBasic;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class ArtworkMedia extends Artwork implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
private MediaType mediaType;
|
||||||
|
@JsonTypeInfo(
|
||||||
|
use = JsonTypeInfo.Id.NAME,
|
||||||
|
include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
|
||||||
|
property = "media_type",
|
||||||
|
defaultImpl = MediaBasic.class
|
||||||
|
)
|
||||||
|
@JsonSubTypes({
|
||||||
|
@JsonSubTypes.Type(value = MovieBasic.class, name = "movie"),
|
||||||
|
@JsonSubTypes.Type(value = TVBasic.class, name = "tv"),
|
||||||
|
@JsonSubTypes.Type(value = TVEpisodeBasic.class, name = "episode")
|
||||||
|
})
|
||||||
|
@JsonProperty("media")
|
||||||
|
private MediaBasic media;
|
||||||
|
|
||||||
|
public MediaType getMediaType() {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaType(MediaType mediaType) {
|
||||||
|
this.mediaType = mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("media_type")
|
||||||
|
public void setMediaType(String mediaType) {
|
||||||
|
this.mediaType = MediaType.fromString(mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaBasic getMedia() {
|
||||||
|
return media;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMedia(MediaBasic media) {
|
||||||
|
this.media = media;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.appendSuper(super.hashCode())
|
||||||
|
.append(mediaType)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof ArtworkMedia) {
|
||||||
|
final ArtworkMedia other = (ArtworkMedia) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.appendSuper(super.equals(obj))
|
||||||
|
.append(mediaType, other.mediaType)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+7
-37
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,21 +17,15 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.authentication;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.slf4j.Logger;
|
import java.io.Serializable;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class TokenAuthorisation {
|
public class TokenAuthorisation extends AbstractJsonMapping implements Serializable {
|
||||||
/*
|
|
||||||
* Logger
|
private static final long serialVersionUID = 4L;
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TokenAuthorisation.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("expires_at")
|
@JsonProperty("expires_at")
|
||||||
private String expires;
|
private String expires;
|
||||||
@JsonProperty("request_token")
|
@JsonProperty("request_token")
|
||||||
@@ -39,7 +33,6 @@ public class TokenAuthorisation {
|
|||||||
@JsonProperty("success")
|
@JsonProperty("success")
|
||||||
private Boolean success;
|
private Boolean success;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getExpires() {
|
public String getExpires() {
|
||||||
return expires;
|
return expires;
|
||||||
}
|
}
|
||||||
@@ -51,9 +44,7 @@ public class TokenAuthorisation {
|
|||||||
public Boolean getSuccess() {
|
public Boolean getSuccess() {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setExpires(String expires) {
|
public void setExpires(String expires) {
|
||||||
this.expires = expires;
|
this.expires = expires;
|
||||||
}
|
}
|
||||||
@@ -65,25 +56,4 @@ public class TokenAuthorisation {
|
|||||||
public void setSuccess(Boolean success) {
|
public void setSuccess(Boolean success) {
|
||||||
this.success = success;
|
this.success = success;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "TokenAuthorisation{" + "expires=" + expires + ", requestToken=" + requestToken + ", success=" + success + '}';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
+6
-37
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,22 +17,15 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.authentication;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.slf4j.Logger;
|
import java.io.Serializable;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
public class TokenSession {
|
public class TokenSession extends AbstractJsonMapping implements Serializable {
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TokenSession.class);
|
private static final long serialVersionUID = 4L;
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("session_id")
|
@JsonProperty("session_id")
|
||||||
private String sessionId;
|
private String sessionId;
|
||||||
@JsonProperty("success")
|
@JsonProperty("success")
|
||||||
@@ -46,7 +39,6 @@ public class TokenSession {
|
|||||||
@JsonProperty("expires_at")
|
@JsonProperty("expires_at")
|
||||||
private String expiresAt;
|
private String expiresAt;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
@@ -70,9 +62,7 @@ public class TokenSession {
|
|||||||
public String getExpiresAt() {
|
public String getExpiresAt() {
|
||||||
return expiresAt;
|
return expiresAt;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setSessionId(String sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
@@ -96,25 +86,4 @@ public class TokenSession {
|
|||||||
public void setExpiresAt(String expiresAt) {
|
public void setExpiresAt(String expiresAt) {
|
||||||
this.expiresAt = expiresAt;
|
this.expiresAt = expiresAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "TokenSession{" + "sessionId=" + sessionId + ", success=" + success + ", statusCode=" + statusCode + ", statusMessage=" + statusMessage + ", guestSessionId=" + guestSessionId + ", expiresAt=" + expiresAt + '}';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.change;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ChangeKeyItem extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
@JsonProperty("key")
|
||||||
|
private String key;
|
||||||
|
@JsonProperty("items")
|
||||||
|
private List<ChangedItem> changedItems = new ArrayList<ChangedItem>();
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setKey(String key) {
|
||||||
|
this.key = key;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<ChangedItem> getChangedItems() {
|
||||||
|
return changedItems;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChangedItems(List<ChangedItem> changes) {
|
||||||
|
this.changedItems = changes;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.change;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class ChangeListItem extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("adult")
|
||||||
|
private boolean adult;
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdult() {
|
||||||
|
return adult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdult(boolean adult) {
|
||||||
|
this.adult = adult;
|
||||||
|
}
|
||||||
|
}
|
||||||
+33
-65
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,106 +17,74 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.change;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import org.slf4j.Logger;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import org.slf4j.LoggerFactory;
|
import java.io.Serializable;
|
||||||
|
|
||||||
public class ChangeItem {
|
public class ChangedItem extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieChanges.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
@JsonProperty("action")
|
@JsonProperty("action")
|
||||||
private String action;
|
private String action;
|
||||||
@JsonProperty("time")
|
@JsonProperty("time")
|
||||||
private String time;
|
private String time;
|
||||||
@JsonProperty("value")
|
|
||||||
private ChangeValue value;
|
|
||||||
@JsonProperty("original_value")
|
|
||||||
private ChangeValue originalValue;
|
|
||||||
@JsonProperty("iso_639_1")
|
@JsonProperty("iso_639_1")
|
||||||
private String language;
|
private String language;
|
||||||
|
@JsonProperty("value")
|
||||||
|
private Object value;
|
||||||
|
@JsonProperty("original_value")
|
||||||
|
private Object originalValue;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
public String getAction() {
|
public String getAction() {
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTime() {
|
|
||||||
return time;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeValue getValue() {
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ChangeValue getOriginalValue() {
|
|
||||||
return originalValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
|
||||||
public void setId(String id) {
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAction(String action) {
|
public void setAction(String action) {
|
||||||
this.action = action;
|
this.action = action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTime(String time) {
|
public void setTime(String time) {
|
||||||
this.time = time;
|
this.time = time;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(ChangeValue value) {
|
public String getLanguage() {
|
||||||
this.value = value;
|
return language;
|
||||||
}
|
|
||||||
|
|
||||||
public void setOriginalValue(ChangeValue originalValue) {
|
|
||||||
this.originalValue = originalValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
public void setLanguage(String language) {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
//</editor-fold>
|
public Object getValue() {
|
||||||
|
return value;
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "ChangeItem{" + "id=" + id + ", action=" + action + ", time=" + time + ", value=" + value + '}';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public void setValue(Object value) {
|
||||||
* Handle unknown properties and print a message
|
this.value = value;
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getOriginalValue() {
|
||||||
|
return originalValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalValue(Object originalValue) {
|
||||||
|
this.originalValue = originalValue;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.collection;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
@JsonRootName("collection")
|
||||||
|
public class Collection extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("title")
|
||||||
|
private String title;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
@JsonProperty("poster_path")
|
||||||
|
private String posterPath;
|
||||||
|
@JsonProperty("backdrop_path")
|
||||||
|
private String backdropPath;
|
||||||
|
@JsonProperty("release_date")
|
||||||
|
private String releaseDate;
|
||||||
|
|
||||||
|
public String getBackdropPath() {
|
||||||
|
return backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPosterPath() {
|
||||||
|
return posterPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReleaseDate() {
|
||||||
|
return releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
if (StringUtils.isBlank(title)) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
if (StringUtils.isBlank(name)) {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackdropPath(String backdropPath) {
|
||||||
|
this.backdropPath = backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosterPath(String posterPath) {
|
||||||
|
this.posterPath = posterPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleaseDate(String releaseDate) {
|
||||||
|
this.releaseDate = releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof Collection) {
|
||||||
|
final Collection other = (Collection) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(id, other.id)
|
||||||
|
.append(name, other.name)
|
||||||
|
.append(title, other.title)
|
||||||
|
.append(backdropPath, other.backdropPath)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.append(id)
|
||||||
|
.append(backdropPath)
|
||||||
|
.append(title)
|
||||||
|
.append(name)
|
||||||
|
.append(posterPath)
|
||||||
|
.append(releaseDate)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
+20
-45
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,34 +17,29 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.collection;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class CollectionInfo implements Serializable {
|
public class CollectionInfo extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(CollectionInfo.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private int id;
|
private int id;
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
|
@JsonProperty("overview")
|
||||||
|
private String overview;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String posterPath;
|
private String posterPath;
|
||||||
@JsonProperty("backdrop_path")
|
@JsonProperty("backdrop_path")
|
||||||
@@ -52,11 +47,11 @@ public class CollectionInfo implements Serializable {
|
|||||||
@JsonProperty("parts")
|
@JsonProperty("parts")
|
||||||
private List<Collection> parts = new ArrayList<Collection>();
|
private List<Collection> parts = new ArrayList<Collection>();
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getBackdropPath() {
|
public String getBackdropPath() {
|
||||||
return backdropPath;
|
return backdropPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -65,6 +60,10 @@ public class CollectionInfo implements Serializable {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getOverview() {
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Collection> getParts() {
|
public List<Collection> getParts() {
|
||||||
return parts;
|
return parts;
|
||||||
}
|
}
|
||||||
@@ -72,13 +71,12 @@ public class CollectionInfo implements Serializable {
|
|||||||
public String getPosterPath() {
|
public String getPosterPath() {
|
||||||
return posterPath;
|
return posterPath;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setBackdropPath(String backdropPath) {
|
public void setBackdropPath(String backdropPath) {
|
||||||
this.backdropPath = backdropPath;
|
this.backdropPath = backdropPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void setId(int id) {
|
public void setId(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@@ -87,6 +85,10 @@ public class CollectionInfo implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOverview(String overview) {
|
||||||
|
this.overview = overview;
|
||||||
|
}
|
||||||
|
|
||||||
public void setParts(List<Collection> parts) {
|
public void setParts(List<Collection> parts) {
|
||||||
this.parts = parts;
|
this.parts = parts;
|
||||||
}
|
}
|
||||||
@@ -94,31 +96,4 @@ public class CollectionInfo implements Serializable {
|
|||||||
public void setPosterPath(String posterPath) {
|
public void setPosterPath(String posterPath) {
|
||||||
this.posterPath = posterPath;
|
this.posterPath = posterPath;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handle unknown properties and print a message
|
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[CollectionInfo=");
|
|
||||||
sb.append("[id=").append(id);
|
|
||||||
sb.append("],[name=").append(name);
|
|
||||||
sb.append("],[posterPath=").append(posterPath);
|
|
||||||
sb.append("],[backdropPath=").append(backdropPath);
|
|
||||||
sb.append("],[# of parts=").append(parts.size());
|
|
||||||
sb.append("]]");
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
+28
-44
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,44 +17,41 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.company;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.slf4j.Logger;
|
import static org.apache.commons.lang3.StringUtils.EMPTY;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Company information
|
* Company information
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author Stuart
|
||||||
*/
|
*/
|
||||||
public class Company implements Serializable {
|
public class Company extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 4L;
|
||||||
// Logger
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(Company.class);
|
|
||||||
private static final String DEFAULT_STRING = "";
|
|
||||||
// Properties
|
// Properties
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private int companyId = 0;
|
private int id = 0;
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name = DEFAULT_STRING;
|
private String name = EMPTY;
|
||||||
@JsonProperty("description")
|
@JsonProperty("description")
|
||||||
private String description = DEFAULT_STRING;
|
private String description = EMPTY;
|
||||||
@JsonProperty("headquarters")
|
@JsonProperty("headquarters")
|
||||||
private String headquarters = DEFAULT_STRING;
|
private String headquarters = EMPTY;
|
||||||
@JsonProperty("homepage")
|
@JsonProperty("homepage")
|
||||||
private String homepage = DEFAULT_STRING;
|
private String homepage = EMPTY;
|
||||||
@JsonProperty("logo_path")
|
@JsonProperty("logo_path")
|
||||||
private String logoPath = DEFAULT_STRING;
|
private String logoPath = EMPTY;
|
||||||
@JsonProperty("parent_company")
|
@JsonProperty("parent_company")
|
||||||
private String parentCompany = DEFAULT_STRING;
|
private Company parentCompany = null;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
@Override
|
||||||
public int getCompanyId() {
|
public int getId() {
|
||||||
return companyId;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
@@ -77,14 +74,13 @@ public class Company implements Serializable {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getParentCompany() {
|
public Company getParentCompany() {
|
||||||
return parentCompany;
|
return parentCompany;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
@Override
|
||||||
public void setCompanyId(int companyId) {
|
public void setId(int id) {
|
||||||
this.companyId = companyId;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDescription(String description) {
|
public void setDescription(String description) {
|
||||||
@@ -107,27 +103,15 @@ public class Company implements Serializable {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParentCompany(String parentCompany) {
|
public void setParentCompany(Company parentCompany) {
|
||||||
this.parentCompany = parentCompany;
|
this.parentCompany = parentCompany;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
public void setParentCompany(int id, String name, String logoPath) {
|
||||||
* Handle unknown properties and print a message
|
Company parent = new Company();
|
||||||
*
|
parent.setId(id);
|
||||||
* @param key
|
parent.setName(name);
|
||||||
* @param value
|
parent.setLogoPath(logoPath);
|
||||||
*/
|
this.parentCompany = parent;
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "Company{" + "companyId=" + companyId + ", name=" + name + ", description=" + description + ", headquarters=" + headquarters + ", homepage=" + homepage + ", logoPath=" + logoPath + ", parentCompany=" + parentCompany + '}';
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+47
-42
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,30 +17,25 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.config;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.MovieDbException;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.yamj.api.common.exception.ApiExceptionType;
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
public class TmdbConfiguration implements Serializable {
|
public class Configuration extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
/*
|
|
||||||
* Logger
|
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(TmdbConfiguration.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("base_url")
|
@JsonProperty("base_url")
|
||||||
private String baseUrl;
|
private String baseUrl;
|
||||||
@JsonProperty("secure_base_url")
|
@JsonProperty("secure_base_url")
|
||||||
@@ -53,8 +48,9 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
private List<String> profileSizes;
|
private List<String> profileSizes;
|
||||||
@JsonProperty("logo_sizes")
|
@JsonProperty("logo_sizes")
|
||||||
private List<String> logoSizes;
|
private List<String> logoSizes;
|
||||||
|
@JsonProperty("still_sizes")
|
||||||
|
private List<String> stillSizes;
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">//GEN-BEGIN:getterMethods
|
|
||||||
public List<String> getBackdropSizes() {
|
public List<String> getBackdropSizes() {
|
||||||
return backdropSizes;
|
return backdropSizes;
|
||||||
}
|
}
|
||||||
@@ -79,8 +75,10 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
return secureBaseUrl;
|
return secureBaseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// </editor-fold>
|
public List<String> getStillSizes() {
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">//GEN-BEGIN:setterMethods
|
return stillSizes;
|
||||||
|
}
|
||||||
|
|
||||||
public void setBackdropSizes(List<String> backdropSizes) {
|
public void setBackdropSizes(List<String> backdropSizes) {
|
||||||
this.backdropSizes = backdropSizes;
|
this.backdropSizes = backdropSizes;
|
||||||
}
|
}
|
||||||
@@ -104,14 +102,17 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
public void setSecureBaseUrl(String secureBaseUrl) {
|
public void setSecureBaseUrl(String secureBaseUrl) {
|
||||||
this.secureBaseUrl = secureBaseUrl;
|
this.secureBaseUrl = secureBaseUrl;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
public void setStillSizes(List<String> stillSizes) {
|
||||||
|
this.stillSizes = stillSizes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the data from the passed object to this one
|
* Copy the data from the passed object to this one
|
||||||
*
|
*
|
||||||
* @param config
|
* @param config
|
||||||
*/
|
*/
|
||||||
public void clone(TmdbConfiguration config) {
|
public void clone(Configuration config) {
|
||||||
backdropSizes = config.getBackdropSizes();
|
backdropSizes = config.getBackdropSizes();
|
||||||
baseUrl = config.getBaseUrl();
|
baseUrl = config.getBaseUrl();
|
||||||
posterSizes = config.getPosterSizes();
|
posterSizes = config.getPosterSizes();
|
||||||
@@ -123,6 +124,7 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
* Check that the poster size is valid
|
* Check that the poster size is valid
|
||||||
*
|
*
|
||||||
* @param posterSize
|
* @param posterSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidPosterSize(String posterSize) {
|
public boolean isValidPosterSize(String posterSize) {
|
||||||
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
if (StringUtils.isBlank(posterSize) || posterSizes.isEmpty()) {
|
||||||
@@ -135,6 +137,7 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
* Check that the backdrop size is valid
|
* Check that the backdrop size is valid
|
||||||
*
|
*
|
||||||
* @param backdropSize
|
* @param backdropSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidBackdropSize(String backdropSize) {
|
public boolean isValidBackdropSize(String backdropSize) {
|
||||||
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
if (StringUtils.isBlank(backdropSize) || backdropSizes.isEmpty()) {
|
||||||
@@ -147,6 +150,7 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
* Check that the profile size is valid
|
* Check that the profile size is valid
|
||||||
*
|
*
|
||||||
* @param profileSize
|
* @param profileSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidProfileSize(String profileSize) {
|
public boolean isValidProfileSize(String profileSize) {
|
||||||
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
if (StringUtils.isBlank(profileSize) || profileSizes.isEmpty()) {
|
||||||
@@ -159,6 +163,7 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
* Check that the logo size is valid
|
* Check that the logo size is valid
|
||||||
*
|
*
|
||||||
* @param logoSize
|
* @param logoSize
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidLogoSize(String logoSize) {
|
public boolean isValidLogoSize(String logoSize) {
|
||||||
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
if (StringUtils.isBlank(logoSize) || logoSizes.isEmpty()) {
|
||||||
@@ -171,37 +176,37 @@ public class TmdbConfiguration implements Serializable {
|
|||||||
* Check to see if the size is valid for any of the images types
|
* Check to see if the size is valid for any of the images types
|
||||||
*
|
*
|
||||||
* @param sizeToCheck
|
* @param sizeToCheck
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
public boolean isValidSize(String sizeToCheck) {
|
public boolean isValidSize(String sizeToCheck) {
|
||||||
return (isValidPosterSize(sizeToCheck)
|
return isValidPosterSize(sizeToCheck)
|
||||||
|| isValidBackdropSize(sizeToCheck)
|
|| isValidBackdropSize(sizeToCheck)
|
||||||
|| isValidProfileSize(sizeToCheck)
|
|| isValidProfileSize(sizeToCheck)
|
||||||
|| isValidLogoSize(sizeToCheck));
|
|| isValidLogoSize(sizeToCheck);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle unknown properties and print a message
|
* Generate the full image URL from the size and image path
|
||||||
*
|
*
|
||||||
* @param key
|
* @param imagePath
|
||||||
* @param value
|
* @param requiredSize
|
||||||
|
* @return
|
||||||
|
* @throws MovieDbException
|
||||||
*/
|
*/
|
||||||
@JsonAnySetter
|
public URL createImageUrl(String imagePath, String requiredSize) throws MovieDbException {
|
||||||
public void handleUnknown(String key, Object value) {
|
if (!isValidSize(requiredSize)) {
|
||||||
StringBuilder sb = new StringBuilder();
|
throw new MovieDbException(ApiExceptionType.INVALID_IMAGE, "Required size '" + requiredSize + "' is not valid");
|
||||||
sb.append("Unknown property: '").append(key);
|
}
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
StringBuilder sb = new StringBuilder(getBaseUrl());
|
||||||
|
sb.append(requiredSize);
|
||||||
|
sb.append(imagePath);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new URL(sb.toString());
|
||||||
|
} catch (MalformedURLException ex) {
|
||||||
|
throw new MovieDbException(ApiExceptionType.INVALID_URL, "Failed to create image URL", sb.toString(), ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
StringBuilder sb = new StringBuilder("[ImageConfiguration=");
|
|
||||||
sb.append("[baseUrl=").append(baseUrl);
|
|
||||||
sb.append("],[posterSizes=").append(posterSizes.toString());
|
|
||||||
sb.append("],[backdropSizes=").append(backdropSizes.toString());
|
|
||||||
sb.append("],[profileSizes=").append(profileSizes.toString());
|
|
||||||
sb.append("],[logoSizes=").append(logoSizes.toString());
|
|
||||||
sb.append(("]]"));
|
|
||||||
return sb.toString();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class JobDepartment extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
// Properties
|
||||||
|
@JsonProperty("department")
|
||||||
|
private String department;
|
||||||
|
@JsonProperty("job_list")
|
||||||
|
private List<String> jobs;
|
||||||
|
|
||||||
|
public String getDepartment() {
|
||||||
|
return department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getJobs() {
|
||||||
|
return jobs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartment(String department) {
|
||||||
|
this.department = department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJobs(List<String> jobs) {
|
||||||
|
this.jobs = jobs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.CreditType;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class CreditBasic extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
private CreditType creditType;
|
||||||
|
private MediaType mediaType;
|
||||||
|
|
||||||
|
@JsonProperty("credit_id")
|
||||||
|
private String creditId;
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("poster_path")
|
||||||
|
private String artworkPath;
|
||||||
|
|
||||||
|
//cast
|
||||||
|
@JsonProperty("character")
|
||||||
|
private String character;
|
||||||
|
//crew
|
||||||
|
@JsonProperty("department")
|
||||||
|
private String department;
|
||||||
|
@JsonProperty("job")
|
||||||
|
private String job;
|
||||||
|
|
||||||
|
public CreditType getCreditType() {
|
||||||
|
return creditType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreditType(CreditType creditType) {
|
||||||
|
this.creditType = creditType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaType getMediaType() {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("media_type")
|
||||||
|
public void setMediaType(String mediaType) {
|
||||||
|
this.mediaType = MediaType.fromString(mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaType(MediaType mediaType) {
|
||||||
|
this.mediaType = mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreditId() {
|
||||||
|
return creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreditId(String creditId) {
|
||||||
|
this.creditId = creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtworkPath() {
|
||||||
|
return artworkPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtworkPath(String artworkPath) {
|
||||||
|
this.artworkPath = artworkPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCharacter() {
|
||||||
|
return character;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCharacter(String character) {
|
||||||
|
this.character = character;
|
||||||
|
setCreditType(CreditType.CAST);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDepartment() {
|
||||||
|
return department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartment(String department) {
|
||||||
|
this.department = department;
|
||||||
|
setCreditType(CreditType.CREW);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJob() {
|
||||||
|
return job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJob(String job) {
|
||||||
|
this.job = job;
|
||||||
|
setCreditType(CreditType.CREW);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class CreditMovieBasic extends CreditBasic implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("adult")
|
||||||
|
private boolean adult;
|
||||||
|
@JsonProperty("original_title")
|
||||||
|
private String originalTitle;
|
||||||
|
@JsonProperty("release_date")
|
||||||
|
private String releaseDate;
|
||||||
|
@JsonProperty("title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public CreditMovieBasic() {
|
||||||
|
setMediaType(MediaType.MOVIE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isAdult() {
|
||||||
|
return adult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdult(boolean adult) {
|
||||||
|
this.adult = adult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalTitle() {
|
||||||
|
return originalTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalTitle(String originalTitle) {
|
||||||
|
this.originalTitle = originalTitle;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getReleaseDate() {
|
||||||
|
return releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setReleaseDate(String releaseDate) {
|
||||||
|
this.releaseDate = releaseDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class CreditTVBasic extends CreditBasic implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("episode_count")
|
||||||
|
private int episodeCount;
|
||||||
|
@JsonProperty("first_air_date")
|
||||||
|
private String firstAirDate;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
@JsonProperty("original_name")
|
||||||
|
private String originalName;
|
||||||
|
|
||||||
|
public CreditTVBasic() {
|
||||||
|
setMediaType(MediaType.TV);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEpisodeCount() {
|
||||||
|
return episodeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEpisodeCount(int episodeCount) {
|
||||||
|
this.episodeCount = episodeCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFirstAirDate() {
|
||||||
|
return firstAirDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFirstAirDate(String firstAirDate) {
|
||||||
|
this.firstAirDate = firstAirDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalName() {
|
||||||
|
return originalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalName(String originalName) {
|
||||||
|
this.originalName = originalName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class MediaCredit extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("credit_id")
|
||||||
|
private String creditId;
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("profile_path")
|
||||||
|
private String artworkPath;
|
||||||
|
@JsonProperty("name")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
public String getCreditId() {
|
||||||
|
return creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreditId(String creditId) {
|
||||||
|
this.creditId = creditId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getArtworkPath() {
|
||||||
|
return artworkPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtworkPath(String artworkPath) {
|
||||||
|
this.artworkPath = artworkPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class MediaCreditCast extends MediaCredit implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("cast_id")
|
||||||
|
private int castId = 0;
|
||||||
|
@JsonProperty("character")
|
||||||
|
private String character;
|
||||||
|
@JsonProperty("order")
|
||||||
|
private int order;
|
||||||
|
|
||||||
|
public int getCastId() {
|
||||||
|
return castId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCastId(int castId) {
|
||||||
|
this.castId = castId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCharacter() {
|
||||||
|
return character;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCharacter(String character) {
|
||||||
|
this.character = character;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrder(int order) {
|
||||||
|
this.order = order;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.credits;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class MediaCreditCrew extends MediaCredit implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("department")
|
||||||
|
private String department;
|
||||||
|
@JsonProperty("job")
|
||||||
|
private String job;
|
||||||
|
|
||||||
|
public String getDepartment() {
|
||||||
|
return department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDepartment(String department) {
|
||||||
|
this.department = department;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getJob() {
|
||||||
|
return job;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setJob(String job) {
|
||||||
|
this.job = job;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,506 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.discover;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.enumeration.SortBy;
|
||||||
|
import com.omertron.themoviedbapi.tools.Param;
|
||||||
|
import com.omertron.themoviedbapi.tools.TmdbParameters;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate a discover object for use in the MovieDbApi
|
||||||
|
* <p/>
|
||||||
|
* This allows you to just add the search components you are concerned with
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class Discover {
|
||||||
|
|
||||||
|
private final TmdbParameters params = new TmdbParameters();
|
||||||
|
|
||||||
|
private static final int YEAR_MIN = 1900;
|
||||||
|
private static final int YEAR_MAX = 2100;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the parameters
|
||||||
|
* <p/>
|
||||||
|
* This will be used to construct the URL in the API
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TmdbParameters getParams() {
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum value is 1 if included.
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover page(int page) {
|
||||||
|
params.add(Param.PAGE, page);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ISO 639-1 code
|
||||||
|
*
|
||||||
|
* @param language
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover language(String language) {
|
||||||
|
params.add(Param.LANGUAGE, language);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Available options are <br>
|
||||||
|
* vote_average.desc<br>
|
||||||
|
* vote_average.asc<br>
|
||||||
|
* release_date.desc<br>
|
||||||
|
* release_date.asc<br>
|
||||||
|
* popularity.desc<br>
|
||||||
|
* popularity.asc
|
||||||
|
*
|
||||||
|
* @param sortBy
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover sortBy(SortBy sortBy) {
|
||||||
|
params.add(Param.SORT_BY, sortBy.getPropertyString());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the inclusion of adult titles
|
||||||
|
*
|
||||||
|
* @param includeAdult
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover includeAdult(boolean includeAdult) {
|
||||||
|
params.add(Param.ADULT, includeAdult);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Toggle the inclusion of items marked as a video.
|
||||||
|
*
|
||||||
|
* Expected value is a boolean, true or false. Default is true.
|
||||||
|
*
|
||||||
|
* @param includeVideo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover includeVideo(boolean includeVideo) {
|
||||||
|
params.add(Param.INCLUDE_VIDEO, includeVideo);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the results release dates to matches that include this value.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover year(int year) {
|
||||||
|
if (checkYear(year)) {
|
||||||
|
params.add(Param.YEAR, year);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the results so that only the primary release date year has this value
|
||||||
|
*
|
||||||
|
* @param primaryReleaseYear
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover primaryReleaseYear(int primaryReleaseYear) {
|
||||||
|
if (checkYear(primaryReleaseYear)) {
|
||||||
|
params.add(Param.PRIMARY_RELEASE_YEAR, primaryReleaseYear);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that are equal to, or have a vote count higher than this value
|
||||||
|
*
|
||||||
|
* @param voteCountGte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover voteCountGte(int voteCountGte) {
|
||||||
|
params.add(Param.VOTE_COUNT_GTE, voteCountGte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that are equal to, or have a vote count higher than this value
|
||||||
|
*
|
||||||
|
* @param voteCountLte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover voteCountLte(int voteCountLte) {
|
||||||
|
params.add(Param.VOTE_COUNT_LTE, voteCountLte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that are equal to, or have a higher average rating than this value
|
||||||
|
*
|
||||||
|
* @param voteAverageGte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover voteAverageGte(float voteAverageGte) {
|
||||||
|
params.add(Param.VOTE_AVERAGE_GTE, voteAverageGte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that are less than or equal to this value
|
||||||
|
*
|
||||||
|
* @param voteAverageLte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover voteAverageLte(float voteAverageLte) {
|
||||||
|
params.add(Param.VOTE_AVERAGE_LTE, voteAverageLte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum release to include.
|
||||||
|
* <p/>
|
||||||
|
* Expected format is YYYY-MM-DD.
|
||||||
|
*
|
||||||
|
* @param releaseDateGte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover releaseDateGte(String releaseDateGte) {
|
||||||
|
params.add(Param.RELEASE_DATE_GTE, releaseDateGte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum release to include.
|
||||||
|
* <p/>
|
||||||
|
* Expected format is YYYY-MM-DD.
|
||||||
|
*
|
||||||
|
* @param releaseDateLte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover releaseDateLte(String releaseDateLte) {
|
||||||
|
params.add(Param.RELEASE_DATE_LTE, releaseDateLte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with certifications for a specific country.
|
||||||
|
* <p/>
|
||||||
|
* When this value is specified, 'certificationLte' is required.
|
||||||
|
* <p/>
|
||||||
|
* A ISO 3166-1 is expected
|
||||||
|
*
|
||||||
|
* @param certificationCountry
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover certificationCountry(String certificationCountry) {
|
||||||
|
params.add(Param.CERTIFICATION_COUNTRY, certificationCountry);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with this certification and lower.
|
||||||
|
* <p/>
|
||||||
|
* Expected value is a valid certification for the specified 'certificationCountry'.
|
||||||
|
*
|
||||||
|
* @param certificationLte
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover certificationLte(String certificationLte) {
|
||||||
|
params.add(Param.CERTIFICATION_LTE, certificationLte);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with this certification.
|
||||||
|
*
|
||||||
|
* Expected value is a valid certification for the specified 'certificationCountry'.
|
||||||
|
*
|
||||||
|
* @param certification
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover certification(String certification) {
|
||||||
|
params.add(Param.CERTIFICATION, certification);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that have this person id added as a cast member.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id of a person).
|
||||||
|
*
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
||||||
|
*
|
||||||
|
* @param withCast
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCast(String withCast) {
|
||||||
|
params.add(Param.WITH_CAST, withCast);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include media that have these person IDs added as cast members.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withCast
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCast(WithBuilder withCast) {
|
||||||
|
return withCast(withCast.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that have this person id added as a crew member.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id of a person).
|
||||||
|
*
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'.
|
||||||
|
*
|
||||||
|
* @param withCrew
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCrew(String withCrew) {
|
||||||
|
params.add(Param.WITH_CREW, withCrew);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include media that have these person IDs added as crew members.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withCrew
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCrew(WithBuilder withCrew) {
|
||||||
|
return withCrew(withCrew.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter movies to include a specific company.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id of a company).
|
||||||
|
*
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
||||||
|
*
|
||||||
|
* @param withCompanies
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCompanies(String withCompanies) {
|
||||||
|
params.add(Param.WITH_COMPANIES, withCompanies);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter movies to include a specific company.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withCompanies
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withCompanies(WithBuilder withCompanies) {
|
||||||
|
return withCompanies(withCompanies.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with the specified genres.
|
||||||
|
* <p/>
|
||||||
|
* Expected value is an integer (the id of a genre).
|
||||||
|
* <p/>
|
||||||
|
* Multiple values can be specified.
|
||||||
|
* <p/>
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'
|
||||||
|
*
|
||||||
|
* @param withGenres
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withGenres(String withGenres) {
|
||||||
|
params.add(Param.WITH_GENRES, withGenres);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with the specified genres.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withGenres
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withGenres(WithBuilder withGenres) {
|
||||||
|
return withGenres(withGenres.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with the specified genres.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id of a genre).
|
||||||
|
*
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'.
|
||||||
|
*
|
||||||
|
* @param withKeywords
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withKeywords(String withKeywords) {
|
||||||
|
params.add(Param.WITH_KEYWORDS, withKeywords);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies with the specified genres.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withKeywords
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withKeywords(WithBuilder withKeywords) {
|
||||||
|
return withKeywords(withKeywords.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that have these person id's added as a cast or crew member.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id or ids of a person).
|
||||||
|
*
|
||||||
|
* Comma separated indicates an 'AND' query, while a pipe (|) separated value indicates an 'OR'.
|
||||||
|
*
|
||||||
|
* @param withPeople
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withPeople(String withPeople) {
|
||||||
|
params.add(Param.WITH_PEOPLE, withPeople);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Only include movies that have these person id's added as a cast or crew member.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withPeople
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withPeople(WithBuilder withPeople) {
|
||||||
|
return withPeople(withPeople.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the air dates that match this year
|
||||||
|
*
|
||||||
|
* Expected value is a year.
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover firstAirDateYear(int year) {
|
||||||
|
if (checkYear(year)) {
|
||||||
|
params.add(Param.FIRST_AIR_DATE_YEAR, year);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the air dates to years that are greater than or equal to this year
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover firstAirDateYearGte(int year) {
|
||||||
|
if (checkYear(year)) {
|
||||||
|
params.add(Param.FIRST_AIR_DATE_GTE, year);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter the air dates to years that are less than or equal to this year
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover firstAirDateYearLte(int year) {
|
||||||
|
if (checkYear(year)) {
|
||||||
|
params.add(Param.FIRST_AIR_DATE_LTE, year);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter TV shows to include a specific network.
|
||||||
|
*
|
||||||
|
* Expected value is an integer (the id of a network).
|
||||||
|
*
|
||||||
|
* They can be comma separated to indicate an 'AND' query.
|
||||||
|
*
|
||||||
|
* @param withNetworks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withNetworks(String withNetworks) {
|
||||||
|
params.add(Param.WITH_NETWORKS, withNetworks);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filter TV shows to include a specific network.
|
||||||
|
*
|
||||||
|
* Use the WithBuilder to generate the list,e.g.
|
||||||
|
*
|
||||||
|
* new WithBuilder(1).and(2).and(3)
|
||||||
|
*
|
||||||
|
* @param withNetworks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Discover withNetworks(WithBuilder withNetworks) {
|
||||||
|
return withNetworks(withNetworks.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* check the year is between the min and max
|
||||||
|
*
|
||||||
|
* @param year
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean checkYear(int year) {
|
||||||
|
return year >= YEAR_MIN && year <= YEAR_MAX;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.discover;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class to create a String for the "with???" parameters of the Discover method
|
||||||
|
*
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class WithBuilder {
|
||||||
|
|
||||||
|
StringBuilder value = new StringBuilder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the first ID in the string
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public WithBuilder(int id) {
|
||||||
|
value.append(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create the first ID in the string
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
*/
|
||||||
|
public WithBuilder(String id) {
|
||||||
|
value.append(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the string to pass to the method
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String build() {
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate the string to pass to the method
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return build();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an "AND ID"
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WithBuilder and(int id) {
|
||||||
|
value.append(",").append(id);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an "AND ID"
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WithBuilder and(String id) {
|
||||||
|
value.append(",").append(id);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an "OR ID"
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WithBuilder or(int id) {
|
||||||
|
value.append("|").append(id);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an "OR ID"
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public WithBuilder or(String id) {
|
||||||
|
value.append("|").append(id);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.keyword;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonRootName;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractIdName;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
@JsonRootName("keyword")
|
||||||
|
public class Keyword extends AbstractIdName implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
// Nothing to override from the base class.
|
||||||
|
}
|
||||||
+30
-33
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,28 +17,24 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.list;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper for the MovieDbList function
|
* Wrapper for the ListItem function
|
||||||
|
*
|
||||||
* @author stuart.boston
|
* @author stuart.boston
|
||||||
|
* @param <T> Type of list
|
||||||
*/
|
*/
|
||||||
public class MovieDbList {
|
public class ListItem<T> extends AbstractJsonMapping implements Serializable {
|
||||||
/*
|
|
||||||
* Logger
|
private static final long serialVersionUID = 4L;
|
||||||
*/
|
|
||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieDbList.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("id")
|
@JsonProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
@JsonProperty("created_by")
|
@JsonProperty("created_by")
|
||||||
@@ -48,7 +44,7 @@ public class MovieDbList {
|
|||||||
@JsonProperty("favorite_count")
|
@JsonProperty("favorite_count")
|
||||||
private int favoriteCount;
|
private int favoriteCount;
|
||||||
@JsonProperty("items")
|
@JsonProperty("items")
|
||||||
private List<MovieDb> items = Collections.EMPTY_LIST;
|
private List<T> items = Collections.emptyList();
|
||||||
@JsonProperty("item_count")
|
@JsonProperty("item_count")
|
||||||
private int itemCount;
|
private int itemCount;
|
||||||
@JsonProperty("iso_639_1")
|
@JsonProperty("iso_639_1")
|
||||||
@@ -57,8 +53,11 @@ public class MovieDbList {
|
|||||||
private String name;
|
private String name;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String posterPath;
|
private String posterPath;
|
||||||
|
@JsonProperty("status_code")
|
||||||
|
private String statusCode;
|
||||||
|
@JsonProperty("status_message")
|
||||||
|
private String statusMessage;
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Getter Methods">
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -75,7 +74,7 @@ public class MovieDbList {
|
|||||||
return favoriteCount;
|
return favoriteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<MovieDb> getItems() {
|
public List<T> getItems() {
|
||||||
return items;
|
return items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,9 +93,15 @@ public class MovieDbList {
|
|||||||
public String getPosterPath() {
|
public String getPosterPath() {
|
||||||
return posterPath;
|
return posterPath;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
//<editor-fold defaultstate="collapsed" desc="Setter Methods">
|
public String getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatusMessage() {
|
||||||
|
return statusMessage;
|
||||||
|
}
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
@@ -113,7 +118,7 @@ public class MovieDbList {
|
|||||||
this.favoriteCount = favoriteCount;
|
this.favoriteCount = favoriteCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItems(List<MovieDb> items) {
|
public void setItems(List<T> items) {
|
||||||
this.items = items;
|
this.items = items;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -132,20 +137,12 @@ public class MovieDbList {
|
|||||||
public void setPosterPath(String posterPath) {
|
public void setPosterPath(String posterPath) {
|
||||||
this.posterPath = posterPath;
|
this.posterPath = posterPath;
|
||||||
}
|
}
|
||||||
//</editor-fold>
|
|
||||||
|
|
||||||
/**
|
public void setStatusCode(String statusCode) {
|
||||||
* Handle unknown properties and print a message
|
this.statusCode = statusCode;
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setStatusMessage(String statusMessage) {
|
||||||
|
this.statusMessage = statusMessage;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.list;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Holger Brandl
|
||||||
|
*/
|
||||||
|
public class ListItemStatus extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("status_code")
|
||||||
|
private int statusCode;
|
||||||
|
@JsonProperty("item_present")
|
||||||
|
private boolean itemPresent;
|
||||||
|
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isItemPresent() {
|
||||||
|
return itemPresent;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setItemPresent(boolean itemPresent) {
|
||||||
|
this.itemPresent = itemPresent;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.list;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.StatusCode;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
|
||||||
|
public class ListStatusCode extends StatusCode {
|
||||||
|
|
||||||
|
@JsonProperty("list_id")
|
||||||
|
private String listId;
|
||||||
|
|
||||||
|
public String getListId() {
|
||||||
|
return listId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setListId(String listId) {
|
||||||
|
this.listId = listId;
|
||||||
|
}
|
||||||
|
}
|
||||||
+49
-80
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2004-2013 Stuart Boston
|
* Copyright (c) 2004-2015 Stuart Boston
|
||||||
*
|
*
|
||||||
* This file is part of TheMovieDB API.
|
* This file is part of TheMovieDB API.
|
||||||
*
|
*
|
||||||
@@ -17,130 +17,99 @@
|
|||||||
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
* along with TheMovieDB API. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
package com.omertron.themoviedbapi.model;
|
package com.omertron.themoviedbapi.model.list;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonAnySetter;
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Wrapper for the MovieDbList function
|
||||||
*
|
*
|
||||||
* @author Stuart
|
* @author stuart.boston
|
||||||
*/
|
*/
|
||||||
public class MovieList implements Serializable {
|
public class UserList extends AbstractJsonMapping implements Serializable {
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
/*
|
@JsonProperty("id")
|
||||||
* Logger
|
private String id;
|
||||||
*/
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(MovieList.class);
|
|
||||||
/*
|
|
||||||
* Properties
|
|
||||||
*/
|
|
||||||
@JsonProperty("description")
|
@JsonProperty("description")
|
||||||
private String description;
|
private String description;
|
||||||
@JsonProperty("favorite_count")
|
@JsonProperty("favorite_count")
|
||||||
private int favoriteCount;
|
private int favoriteCount;
|
||||||
@JsonProperty("id")
|
|
||||||
private String id;
|
|
||||||
@JsonProperty("item_count")
|
@JsonProperty("item_count")
|
||||||
private int itemCount;
|
private int itemCount;
|
||||||
@JsonProperty("iso_639_1")
|
@JsonProperty("iso_639_1")
|
||||||
private String language;
|
private String language;
|
||||||
|
@JsonProperty("list_type")
|
||||||
|
private String listType;
|
||||||
@JsonProperty("name")
|
@JsonProperty("name")
|
||||||
private String name;
|
private String name;
|
||||||
@JsonProperty("poster_path")
|
@JsonProperty("poster_path")
|
||||||
private String posterPath;
|
private String posterPath;
|
||||||
@JsonProperty("list_type")
|
|
||||||
private String listType;
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Getter methods">
|
|
||||||
public String getDescription() {
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getFavoriteCount() {
|
|
||||||
return favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getItemCount() {
|
|
||||||
return itemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getLanguage() {
|
|
||||||
return language;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPosterPath() {
|
|
||||||
return posterPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getListType() {
|
|
||||||
return listType;
|
|
||||||
}
|
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
// <editor-fold defaultstate="collapsed" desc="Setter methods">
|
|
||||||
public void setDescription(String description) {
|
|
||||||
this.description = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFavoriteCount(int favoriteCount) {
|
|
||||||
this.favoriteCount = favoriteCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setId(String id) {
|
public void setId(String id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getFavoriteCount() {
|
||||||
|
return favoriteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFavoriteCount(int favoriteCount) {
|
||||||
|
this.favoriteCount = favoriteCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getItemCount() {
|
||||||
|
return itemCount;
|
||||||
|
}
|
||||||
|
|
||||||
public void setItemCount(int itemCount) {
|
public void setItemCount(int itemCount) {
|
||||||
this.itemCount = itemCount;
|
this.itemCount = itemCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getLanguage() {
|
||||||
|
return language;
|
||||||
|
}
|
||||||
|
|
||||||
public void setLanguage(String language) {
|
public void setLanguage(String language) {
|
||||||
this.language = language;
|
this.language = language;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setName(String name) {
|
public String getListType() {
|
||||||
this.name = name;
|
return listType;
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosterPath(String posterPath) {
|
|
||||||
this.posterPath = posterPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setListType(String listType) {
|
public void setListType(String listType) {
|
||||||
this.listType = listType;
|
this.listType = listType;
|
||||||
}
|
}
|
||||||
// </editor-fold>
|
|
||||||
|
|
||||||
/**
|
public String getName() {
|
||||||
* Handle unknown properties and print a message
|
return name;
|
||||||
*
|
|
||||||
* @param key
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
@JsonAnySetter
|
|
||||||
public void handleUnknown(String key, Object value) {
|
|
||||||
StringBuilder sb = new StringBuilder();
|
|
||||||
sb.append("Unknown property: '").append(key);
|
|
||||||
sb.append("' value: '").append(value).append("'");
|
|
||||||
LOG.trace(sb.toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void setName(String name) {
|
||||||
public String toString() {
|
this.name = name;
|
||||||
return "MovieList{" + "description=" + description + ", favoriteCount=" + favoriteCount + ", id=" + id + ", itemCount=" + itemCount + ", language=" + language + ", name=" + name + ", posterPath=" + posterPath + '}';
|
}
|
||||||
|
|
||||||
|
public String getPosterPath() {
|
||||||
|
return posterPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosterPath(String posterPath) {
|
||||||
|
this.posterPath = posterPath;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.media;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.HashCodeBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Stuart
|
||||||
|
*/
|
||||||
|
public class AlternativeTitle implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("iso_3166_1")
|
||||||
|
private String country;
|
||||||
|
@JsonProperty("title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
public String getCountry() {
|
||||||
|
return country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCountry(String country) {
|
||||||
|
this.country = country;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj instanceof AlternativeTitle) {
|
||||||
|
final AlternativeTitle other = (AlternativeTitle) obj;
|
||||||
|
return new EqualsBuilder()
|
||||||
|
.append(country, other.country)
|
||||||
|
.append(title, other.title)
|
||||||
|
.isEquals();
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return new HashCodeBuilder()
|
||||||
|
.append(country)
|
||||||
|
.append(title)
|
||||||
|
.toHashCode();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,115 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.media;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.omertron.themoviedbapi.enumeration.MediaType;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Basic media information
|
||||||
|
*
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class MediaBasic extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
private MediaType mediaType;
|
||||||
|
@JsonProperty("backdrop_path")
|
||||||
|
private String backdropPath;
|
||||||
|
@JsonProperty("poster_path")
|
||||||
|
private String posterPath;
|
||||||
|
@JsonProperty("popularity")
|
||||||
|
private float popularity;
|
||||||
|
@JsonProperty("vote_average")
|
||||||
|
private float voteAverage;
|
||||||
|
@JsonProperty("vote_count")
|
||||||
|
private int voteCount;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public MediaType getMediaType() {
|
||||||
|
return mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("media_type")
|
||||||
|
public void setMediaType(String mediaType) {
|
||||||
|
this.mediaType = MediaType.fromString(mediaType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMediaType(MediaType mediaType) {
|
||||||
|
this.mediaType = mediaType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBackdropPath() {
|
||||||
|
return backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBackdropPath(String backdropPath) {
|
||||||
|
this.backdropPath = backdropPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPosterPath() {
|
||||||
|
return posterPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPosterPath(String posterPath) {
|
||||||
|
this.posterPath = posterPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.media;
|
||||||
|
|
||||||
|
import com.omertron.themoviedbapi.model.credits.MediaCreditCrew;
|
||||||
|
import com.omertron.themoviedbapi.model.credits.MediaCreditCast;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author stuart.boston
|
||||||
|
*/
|
||||||
|
public class MediaCreditList extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id = 0;
|
||||||
|
@JsonProperty("cast")
|
||||||
|
private List<MediaCreditCast> cast = Collections.emptyList();
|
||||||
|
@JsonProperty("guest_stars")
|
||||||
|
private List<MediaCreditCast> guestStars = Collections.emptyList();
|
||||||
|
@JsonProperty("crew")
|
||||||
|
private List<MediaCreditCrew> crew = Collections.emptyList();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaCreditCast> getCast() {
|
||||||
|
return cast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCast(List<MediaCreditCast> cast) {
|
||||||
|
this.cast = cast;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaCreditCrew> getCrew() {
|
||||||
|
return crew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCrew(List<MediaCreditCrew> crew) {
|
||||||
|
this.crew = crew;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<MediaCreditCast> getGuestStars() {
|
||||||
|
return guestStars;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGuestStars(List<MediaCreditCast> guestStars) {
|
||||||
|
this.guestStars = guestStars;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2004-2015 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.media;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonSetter;
|
||||||
|
import com.omertron.themoviedbapi.interfaces.Identification;
|
||||||
|
import com.omertron.themoviedbapi.model.AbstractJsonMapping;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Stuart.Boston
|
||||||
|
*/
|
||||||
|
public class MediaState extends AbstractJsonMapping implements Serializable, Identification {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 4L;
|
||||||
|
|
||||||
|
@JsonProperty("id")
|
||||||
|
private int id;
|
||||||
|
@JsonProperty("favorite")
|
||||||
|
private boolean favorite;
|
||||||
|
@JsonProperty("watchlist")
|
||||||
|
private boolean watchlist;
|
||||||
|
private float rated;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isFavorite() {
|
||||||
|
return favorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFavorite(boolean favorite) {
|
||||||
|
this.favorite = favorite;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isWatchlist() {
|
||||||
|
return watchlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWatchlist(boolean watchlist) {
|
||||||
|
this.watchlist = watchlist;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getRated() {
|
||||||
|
return rated;
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonSetter("rated")
|
||||||
|
public void setRated(RatedValue rated) {
|
||||||
|
this.rated = rated.getValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user