mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-25 01:08:52 -05:00
* fall back to year field if exact release date in unavailable
This commit is contained in:
parent
d1b80b825c
commit
7305b0f939
@ -231,6 +231,11 @@ public class IMDbClient implements MovieIdentificationService {
|
||||
Date released = Date.parse(data.get("released"), "dd MMM yyyy");
|
||||
if (released != null) {
|
||||
fields.put(MovieProperty.release_date, released.format("yyyy-MM-dd"));
|
||||
} else {
|
||||
Date year = Date.parse(data.get("year"), "yyyy");
|
||||
if (year != null) {
|
||||
fields.put(MovieProperty.release_date, year.format("yyyy-MM-dd"));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> genres = new ArrayList<String>();
|
||||
|
@ -1,20 +1,18 @@
|
||||
|
||||
package net.sourceforge.filebot.web;
|
||||
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
import net.sourceforge.filebot.web.TMDbClient.MovieInfo;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class IMDbClientTest {
|
||||
|
||||
private final IMDbClient imdb = new IMDbClient();
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie1() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Avatar", null);
|
||||
@ -25,7 +23,6 @@ public class IMDbClientTest {
|
||||
assertEquals(499549, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie2() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("The Illusionist", null);
|
||||
@ -36,7 +33,6 @@ public class IMDbClientTest {
|
||||
assertEquals(443543, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie3() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Amélie", null);
|
||||
@ -47,7 +43,6 @@ public class IMDbClientTest {
|
||||
assertEquals(211915, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie4() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Heat", null);
|
||||
@ -58,7 +53,6 @@ public class IMDbClientTest {
|
||||
assertEquals(113277, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie5() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Det sjunde inseglet", null);
|
||||
@ -69,7 +63,6 @@ public class IMDbClientTest {
|
||||
assertEquals(50976, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovie6() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Drive 2011", null);
|
||||
@ -80,7 +73,6 @@ public class IMDbClientTest {
|
||||
assertEquals(780504, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void searchMovieRedirect() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("(500) Days of Summer (2009)", null);
|
||||
@ -92,7 +84,6 @@ public class IMDbClientTest {
|
||||
assertEquals(1022603, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMovieDescriptor1() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(499549, null);
|
||||
@ -102,7 +93,6 @@ public class IMDbClientTest {
|
||||
assertEquals(499549, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMovieDescriptor2() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(211915, null);
|
||||
@ -112,7 +102,6 @@ public class IMDbClientTest {
|
||||
assertEquals(211915, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMovieDescriptor3() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(75610, null);
|
||||
@ -122,7 +111,6 @@ public class IMDbClientTest {
|
||||
assertEquals(75610, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMovieDescriptor4() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(369702, null);
|
||||
@ -132,7 +120,6 @@ public class IMDbClientTest {
|
||||
assertEquals(369702, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getMovieDescriptor5() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(1020960, null);
|
||||
@ -142,7 +129,6 @@ public class IMDbClientTest {
|
||||
assertEquals(1020960, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getAkaMovieDescriptor() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(106559, Locale.ENGLISH);
|
||||
@ -152,7 +138,6 @@ public class IMDbClientTest {
|
||||
assertEquals(106559, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getAkaMovieDescriptorExtra() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(470761, Locale.ENGLISH);
|
||||
@ -162,4 +147,12 @@ public class IMDbClientTest {
|
||||
assertEquals(470761, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getImdbApiMovieInfoReleasedNA() throws Exception {
|
||||
MovieInfo movie = imdb.getImdbApiMovieInfo(new Movie(null, -1, 1287357, -1));
|
||||
assertEquals("Sommersonntag", movie.getName());
|
||||
assertEquals(2008, movie.getReleased().getYear());
|
||||
assertEquals("2008-01-01", movie.getReleased().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user