* index original title as well as engish AKA title
This commit is contained in:
parent
1f59bf0047
commit
27696998c5
|
@ -61,13 +61,15 @@ parallel(osdb.collect{ row ->
|
|||
return {
|
||||
// update new data
|
||||
if (!imdb_ids.contains(row[0])) {
|
||||
def mov = net.sourceforge.filebot.WebServices.IMDb.getMovieDescriptor(row[0] as int, null)
|
||||
if (mov != null && mov.name.length() > 0 && mov.year > 0) {
|
||||
println "Adding $mov"
|
||||
imdb << [row[0], mov.name, mov.year]
|
||||
} else {
|
||||
println "Blacklisting $row"
|
||||
imdb << [row[0], null]
|
||||
// get original title and english title
|
||||
[Locale.ROOT, Locale.ENGLISH].collect{ locale -> net.sourceforge.filebot.WebServices.IMDb.getMovieDescriptor(row[0] as int, locale) }.unique{ it as String }.each { mov ->
|
||||
if (mov != null && mov.name.length() > 0 && mov.year > 0) {
|
||||
println "Adding $mov"
|
||||
imdb << [row[0], mov.name, mov.year]
|
||||
} else {
|
||||
println "Blacklisting $row"
|
||||
imdb << [row[0], null]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +82,7 @@ imdb.collect{ it.join('\t') }.join('\n').saveAs(imdb_tsv)
|
|||
def movies = imdb.findAll{ it.size() >= 3 && !it[1].startsWith('"') }
|
||||
|
||||
def movieSorter = new TreeMap(String.CASE_INSENSITIVE_ORDER)
|
||||
movies.each{ movieSorter.put(it[1]+it[2], it) }
|
||||
movies.each{ movieSorter.put([it[1], it[2], it[0]].join('\t'), it) }
|
||||
movies = movieSorter.values().collect{ it.join('\t') }
|
||||
|
||||
gz(movies_out, movies)
|
||||
|
|
|
@ -5,6 +5,7 @@ package net.sourceforge.filebot.web;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -18,7 +19,7 @@ public class IMDbClientTest {
|
|||
public void searchMovie() throws Exception {
|
||||
List<Movie> results = imdb.searchMovie("Avatar", null);
|
||||
|
||||
Movie movie = (Movie) results.get(0);
|
||||
Movie movie = results.get(0);
|
||||
|
||||
assertEquals("Avatar", movie.getName());
|
||||
assertEquals(2009, movie.getYear());
|
||||
|
@ -31,7 +32,7 @@ public class IMDbClientTest {
|
|||
List<Movie> results = imdb.searchMovie("battle angel alita", null);
|
||||
|
||||
assertEquals(1, results.size());
|
||||
Movie movie = (Movie) results.get(0);
|
||||
Movie movie = results.get(0);
|
||||
|
||||
assertEquals("Gunnm", movie.getName());
|
||||
assertEquals(1993, movie.getYear());
|
||||
|
@ -48,4 +49,14 @@ public class IMDbClientTest {
|
|||
assertEquals(499549, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void getAkaMovieDescriptor() throws Exception {
|
||||
Movie movie = imdb.getMovieDescriptor(106559, Locale.ENGLISH);
|
||||
|
||||
assertEquals("Green Snake", movie.getName());
|
||||
assertEquals(1993, movie.getYear());
|
||||
assertEquals(106559, movie.getImdbId(), 0);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue