1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00

Internal support for language+country locale-specific TheMovieDB data

This commit is contained in:
Reinhard Pointner 2016-09-10 01:33:40 +08:00
parent b2d2df1883
commit 098491bb7f
2 changed files with 18 additions and 5 deletions

View File

@ -390,7 +390,10 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
// require 2-letter language code
String language = locale.getLanguage();
if (language.length() == 2) {
return language;
if (locale.getCountry().length() == 2) {
return locale.getLanguage() + '-' + locale.getCountry(); // e.g. es-MX
}
return locale.getLanguage(); // e.g. en
}
Language lang = Language.getLanguage(locale);

View File

@ -57,7 +57,7 @@ public class TMDbClientTest {
}
@Test
public void searchByNameGermanResults() throws Exception {
public void searchByNameGerman() throws Exception {
List<Movie> result = db.searchMovie("East of Eden", Locale.GERMAN);
Movie movie = result.get(0);
@ -66,6 +66,17 @@ public class TMDbClientTest {
assertEquals(Arrays.asList("Jenseits von Eden (1955)", "East of Eden (1955)"), movie.getEffectiveNames());
}
@Test
public void searchByNameMexican() throws Exception {
List<Movie> result = db.searchMovie("Suicide Squad", new Locale("es", "MX"));
Movie movie = result.get(0);
assertEquals("Escuadrón suicida", movie.getName());
assertEquals(2016, movie.getYear());
assertEquals(-1, movie.getImdbId());
assertEquals(297761, movie.getTmdbId());
}
@Test
public void searchByIMDB() throws Exception {
Movie movie = db.getMovieDescriptor(new Movie(418279), Locale.ENGLISH);
@ -92,15 +103,14 @@ public class TMDbClientTest {
public void getAlternativeTitles() throws Exception {
Map<String, List<String>> titles = db.getAlternativeTitles(16320); // Serenity
assertEquals("[衝出寧靜號]", titles.get("TW").toString());
assertEquals("[萤火虫, 宁静号]", titles.get("CN").toString());
assertEquals("[宁静号]", titles.get("HK").toString());
}
@Test
public void getArtwork() throws Exception {
Artwork a = db.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
assertEquals("[backdrops, 1920x1080]", a.getTags().toString());
assertEquals("https://image.tmdb.org/t/p/original/424MxHQe5Hfu92hTeRvZb5Giv0X.jpg", a.getUrl().toString());
assertEquals("http://image.tmdb.org/t/p/original/mQPg3iZyztfzFNwrW40nCUtXy2l.jpg", a.getUrl().toString());
}
@Test