mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-11 05:48:01 -05:00
Internal support for language+country locale-specific TheMovieDB data
This commit is contained in:
parent
b2d2df1883
commit
098491bb7f
@ -390,7 +390,10 @@ public class TMDbClient implements MovieIdentificationService, ArtworkProvider {
|
|||||||
// require 2-letter language code
|
// require 2-letter language code
|
||||||
String language = locale.getLanguage();
|
String language = locale.getLanguage();
|
||||||
if (language.length() == 2) {
|
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);
|
Language lang = Language.getLanguage(locale);
|
||||||
|
@ -57,7 +57,7 @@ public class TMDbClientTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void searchByNameGermanResults() throws Exception {
|
public void searchByNameGerman() throws Exception {
|
||||||
List<Movie> result = db.searchMovie("East of Eden", Locale.GERMAN);
|
List<Movie> result = db.searchMovie("East of Eden", Locale.GERMAN);
|
||||||
Movie movie = result.get(0);
|
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());
|
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
|
@Test
|
||||||
public void searchByIMDB() throws Exception {
|
public void searchByIMDB() throws Exception {
|
||||||
Movie movie = db.getMovieDescriptor(new Movie(418279), Locale.ENGLISH);
|
Movie movie = db.getMovieDescriptor(new Movie(418279), Locale.ENGLISH);
|
||||||
@ -92,15 +103,14 @@ public class TMDbClientTest {
|
|||||||
public void getAlternativeTitles() throws Exception {
|
public void getAlternativeTitles() throws Exception {
|
||||||
Map<String, List<String>> titles = db.getAlternativeTitles(16320); // Serenity
|
Map<String, List<String>> titles = db.getAlternativeTitles(16320); // Serenity
|
||||||
|
|
||||||
assertEquals("[衝出寧靜號]", titles.get("TW").toString());
|
assertEquals("[宁静号]", titles.get("HK").toString());
|
||||||
assertEquals("[萤火虫, 宁静号]", titles.get("CN").toString());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void getArtwork() throws Exception {
|
public void getArtwork() throws Exception {
|
||||||
Artwork a = db.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
|
Artwork a = db.getArtwork(16320, "backdrops", Locale.ROOT).get(0);
|
||||||
assertEquals("[backdrops, 1920x1080]", a.getTags().toString());
|
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
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user