1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-13 12:55:00 -05:00

Support for non-default TheTVDBv2 API mirrors (possibly useful in China where *.thetvdb.com is blocked)

This commit is contained in:
Reinhard Pointner 2019-03-07 17:26:57 +07:00
parent 4979de00f7
commit 63f5775ada

View File

@ -33,12 +33,26 @@ import net.filebot.ResourceManager;
public class TheTVDBClient extends AbstractEpisodeListProvider implements ArtworkProvider {
private static URL getEndpoint() {
try {
return new URL(System.getProperty("net.filebot.TheTVDB.url", "https://api.thetvdb.com/"));
} catch (Exception e) {
throw new IllegalStateException(e);
}
}
private static final Locale DEFAULT_LOCALE = Locale.ENGLISH;
private String apikey;
private final URL api;
private final String apikey;
public TheTVDBClient(URL api, String apikey) {
this.api = api;
this.apikey = apikey;
}
public TheTVDBClient(String apikey) {
this.apikey = apikey;
this(getEndpoint(), apikey);
}
@Override
@ -68,7 +82,7 @@ public class TheTVDBClient extends AbstractEpisodeListProvider implements Artwor
}
protected URL getEndpoint(String path) throws Exception {
return new URL("https://api.thetvdb.com/" + path);
return new URL(api, path);
}
private Map<String, String> getRequestHeader(Locale locale) {