Improved error reporting for people that do `--db TheTVDB --lang ITA`

This commit is contained in:
Reinhard Pointner 2016-02-08 17:27:17 +00:00
parent e43e5f9f17
commit ec0f9293c7
1 changed files with 6 additions and 0 deletions

View File

@ -83,6 +83,12 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
public String getLanguageCode(Locale locale) {
String code = locale.getLanguage();
// sanity check
if (code.length() != 2) {
// see http://thetvdb.com/api/BA864DEE427E384A/languages.xml
throw new IllegalArgumentException("Expecting 2-letter language code: " + code);
}
// Java language code => TheTVDB language code
if (code.equals("iw")) // Hebrew
return "he";