mirror of
https://github.com/mitb-archive/filebot
synced 2025-01-11 05:48:01 -05:00
* API requires 2-letter language codes, so translate non-2-letter language code locales to standard 2-letter codes
This commit is contained in:
parent
75d58e4fe8
commit
b6b01264ed
@ -32,6 +32,7 @@ import java.util.regex.Pattern;
|
|||||||
|
|
||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
|
|
||||||
|
import net.filebot.Language;
|
||||||
import net.filebot.ResourceManager;
|
import net.filebot.ResourceManager;
|
||||||
import net.filebot.web.TMDbClient.MovieInfo.MovieProperty;
|
import net.filebot.web.TMDbClient.MovieInfo.MovieProperty;
|
||||||
import net.filebot.web.TMDbClient.Person.PersonProperty;
|
import net.filebot.web.TMDbClient.Person.PersonProperty;
|
||||||
@ -346,8 +347,18 @@ public class TMDbClient implements MovieIdentificationService {
|
|||||||
if (parameters != null) {
|
if (parameters != null) {
|
||||||
data.putAll(parameters);
|
data.putAll(parameters);
|
||||||
}
|
}
|
||||||
if (locale != null && !locale.getLanguage().isEmpty()) {
|
|
||||||
data.put("language", locale.getLanguage());
|
if (locale != null && locale.getLanguage().length() > 0) {
|
||||||
|
String code = locale.getLanguage();
|
||||||
|
|
||||||
|
// require 2-letter language code
|
||||||
|
if (code.length() != 2) {
|
||||||
|
Language lang = Language.getLanguage(locale);
|
||||||
|
if (lang != null) {
|
||||||
|
code = lang.getISO2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
data.put("language", code);
|
||||||
}
|
}
|
||||||
data.put("api_key", apikey);
|
data.put("api_key", apikey);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user