mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-23 16:28:51 -05:00
* update API keys
This commit is contained in:
parent
3755792a47
commit
9c9929466c
@ -274,7 +274,7 @@ public class Main {
|
||||
e.getWindow().setVisible(false);
|
||||
HistorySpooler.getInstance().commit();
|
||||
|
||||
if (useDonationReminder()) {
|
||||
if (!isAppStore()) {
|
||||
showDonationReminder();
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import static net.filebot.util.StringUtilities.*;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.io.File;
|
||||
import java.util.Locale;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.prefs.BackingStoreException;
|
||||
import java.util.prefs.Preferences;
|
||||
@ -39,6 +40,18 @@ public final class Settings {
|
||||
return ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT).getString(key);
|
||||
}
|
||||
|
||||
public static String getApiKey(String name) {
|
||||
ResourceBundle bundle = ResourceBundle.getBundle(Settings.class.getName(), Locale.ROOT);
|
||||
if (isAppStore()) {
|
||||
try {
|
||||
return bundle.getString("apikey.private." + name);
|
||||
} catch (MissingResourceException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return bundle.getString("apikey." + name);
|
||||
}
|
||||
|
||||
public static boolean isUnixFS() {
|
||||
return Boolean.parseBoolean(System.getProperty("unixfs"));
|
||||
}
|
||||
@ -59,8 +72,8 @@ public final class Settings {
|
||||
return Boolean.parseBoolean(System.getProperty("useCreationDate"));
|
||||
}
|
||||
|
||||
public static boolean useDonationReminder() {
|
||||
return !("mas".equals(getApplicationDeployment()) || "usc".equals(getApplicationDeployment()));
|
||||
public static boolean isAppStore() {
|
||||
return "mas".equals(getApplicationDeployment()) || "usc".equals(getApplicationDeployment());
|
||||
}
|
||||
|
||||
public static boolean isMacSandbox() {
|
||||
|
@ -14,8 +14,13 @@ script.dev: https://raw.githubusercontent.com/filebot/scripts/devel/%s.groovy
|
||||
# google analytics
|
||||
analytics.WebPropertyID: UA-25379256-3
|
||||
|
||||
# database api keys
|
||||
thetvdb.apikey: 58B4AA94C59AD656
|
||||
themoviedb.apikey: 5a6edae568130bf10617b6d45be99f13
|
||||
fanart.tv.apikey: 780b986b22c35e6f7a134a2f392c2deb
|
||||
acoustid.apikey: 0B3qZnQc
|
||||
# api keys for webservices
|
||||
apikey.thetvdb: 694FAD89942D3827
|
||||
apikey.tvrage: 5AhRvLfKAP10unE9Vnfr
|
||||
apikey.themoviedb: 66308fb6e3fd850dde4c7d21df2e8306
|
||||
apikey.fanart.tv: 780b986b22c35e6f7a134a2f392c2deb
|
||||
apikey.acoustid: 0B3qZnQc
|
||||
|
||||
# api keys used by the appstore distribution
|
||||
apikey.private.thetvdb: 5F6E873A88CF70D9
|
||||
apikey.private.tvrage: mugksCbTg35PLBIhCXdG
|
||||
|
@ -47,22 +47,22 @@ import net.filebot.web.VideoHashSubtitleService;
|
||||
public final class WebServices {
|
||||
|
||||
// episode dbs
|
||||
public static final TVRageClient TVRage = new TVRageClient();
|
||||
public static final TVRageClient TVRage = new TVRageClient(getApiKey("tvrage"));
|
||||
public static final AnidbClient AniDB = new AnidbClientWithLocalSearch(getApplicationName().toLowerCase(), 5);
|
||||
|
||||
// extended TheTVDB module with local search
|
||||
public static final TheTVDBClientWithLocalSearch TheTVDB = new TheTVDBClientWithLocalSearch(getApplicationProperty("thetvdb.apikey"));
|
||||
public static final TheTVDBClientWithLocalSearch TheTVDB = new TheTVDBClientWithLocalSearch(getApiKey("thetvdb"));
|
||||
|
||||
// movie dbs
|
||||
public static final OMDbClient OMDb = new OMDbClient();
|
||||
public static final TMDbClient TheMovieDB = new TMDbClient(getApplicationProperty("themoviedb.apikey"));
|
||||
public static final TMDbClient TheMovieDB = new TMDbClient(getApiKey("themoviedb"));
|
||||
|
||||
// subtitle dbs
|
||||
public static final OpenSubtitlesClient OpenSubtitles = new OpenSubtitlesClient(String.format("%s %s", getApplicationName(), getApplicationVersion()));
|
||||
|
||||
// misc
|
||||
public static final FanartTVClient FanartTV = new FanartTVClient(Settings.getApplicationProperty("fanart.tv.apikey"));
|
||||
public static final AcoustIDClient AcoustID = new AcoustIDClient(Settings.getApplicationProperty("acoustid.apikey"));
|
||||
public static final FanartTVClient FanartTV = new FanartTVClient(Settings.getApiKey("fanart.tv"));
|
||||
public static final AcoustIDClient AcoustID = new AcoustIDClient(Settings.getApiKey("acoustid"));
|
||||
public static final XattrMetaInfoProvider XattrMetaData = new XattrMetaInfoProvider();
|
||||
|
||||
public static EpisodeListProvider[] getEpisodeListProviders() {
|
||||
|
@ -1,5 +1,6 @@
|
||||
package net.filebot.web;
|
||||
|
||||
import static java.util.Collections.*;
|
||||
import static net.filebot.util.XPathUtilities.*;
|
||||
import static net.filebot.web.EpisodeUtilities.*;
|
||||
import static net.filebot.web.WebRequest.*;
|
||||
@ -8,8 +9,10 @@ import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.swing.Icon;
|
||||
|
||||
@ -22,7 +25,13 @@ import org.xml.sax.SAXException;
|
||||
|
||||
public class TVRageClient extends AbstractEpisodeListProvider {
|
||||
|
||||
private final String host = "services.tvrage.com";
|
||||
private String host = "services.tvrage.com";
|
||||
|
||||
private String apikey;
|
||||
|
||||
public TVRageClient(String apikey) {
|
||||
this.apikey = apikey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
@ -41,8 +50,7 @@ public class TVRageClient extends AbstractEpisodeListProvider {
|
||||
|
||||
@Override
|
||||
public List<SearchResult> fetchSearchResult(String query, Locale locale) throws IOException, SAXException {
|
||||
URL searchUrl = new URL("http", host, "/feeds/full_search.php?show=" + encode(query, true));
|
||||
Document dom = getDocument(searchUrl);
|
||||
Document dom = request("/feeds/full_search.php", singletonMap("show", query));
|
||||
|
||||
List<Node> nodes = selectNodes("Results/show", dom);
|
||||
List<SearchResult> searchResults = new ArrayList<SearchResult>(nodes.size());
|
||||
@ -61,9 +69,7 @@ public class TVRageClient extends AbstractEpisodeListProvider {
|
||||
@Override
|
||||
public List<Episode> fetchEpisodeList(SearchResult searchResult, SortOrder sortOrder, Locale locale) throws IOException, SAXException {
|
||||
TVRageSearchResult series = (TVRageSearchResult) searchResult;
|
||||
|
||||
URL episodeListUrl = new URL("http", host, "/feeds/full_show_info.php?sid=" + series.getSeriesId());
|
||||
Document dom = getDocument(episodeListUrl);
|
||||
Document dom = request("/feeds/full_show_info.php", singletonMap("sid", series.getSeriesId()));
|
||||
|
||||
String seriesName = selectString("Show/name", dom);
|
||||
SimpleDate seriesStartDate = SimpleDate.parse(selectString("Show/started", dom), "MMM/dd/yyyy");
|
||||
@ -106,6 +112,15 @@ public class TVRageClient extends AbstractEpisodeListProvider {
|
||||
return episodes;
|
||||
}
|
||||
|
||||
public Document request(String resource, Map<String, Object> parameters) throws IOException, SAXException {
|
||||
Map<String, Object> param = new LinkedHashMap<String, Object>(parameters);
|
||||
if (apikey != null) {
|
||||
param.put("key", apikey);
|
||||
}
|
||||
URL url = new URL("http", host, resource + "?" + encodeParameters(param, true));
|
||||
return getDocument(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public URI getEpisodeListLink(SearchResult searchResult) {
|
||||
return URI.create(((TVRageSearchResult) searchResult).getLink() + "/episode_list/all");
|
||||
|
@ -1,6 +1,5 @@
|
||||
package net.filebot.web;
|
||||
|
||||
import static net.filebot.Settings.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
@ -15,7 +14,7 @@ import org.junit.Test;
|
||||
|
||||
public class TMDbClientTest {
|
||||
|
||||
private final TMDbClient tmdb = new TMDbClient(getApplicationProperty("themoviedb.apikey"));
|
||||
private final TMDbClient tmdb = new TMDbClient("66308fb6e3fd850dde4c7d21df2e8306");
|
||||
|
||||
@Test
|
||||
public void searchByName() throws Exception {
|
||||
|
@ -1,46 +1,39 @@
|
||||
|
||||
package net.filebot.web;
|
||||
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
|
||||
public class TVRageClientTest {
|
||||
|
||||
|
||||
/**
|
||||
* 145 episodes / 7 seasons
|
||||
*/
|
||||
private static TVRageSearchResult buffySearchResult = new TVRageSearchResult("Buffy the Vampire Slayer", 2930, "http://www.tvrage.com/Buffy_The_Vampire_Slayer");
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void search() throws Exception {
|
||||
List<SearchResult> results = tvrage.search("Buffy");
|
||||
|
||||
|
||||
TVRageSearchResult result = (TVRageSearchResult) results.get(0);
|
||||
|
||||
|
||||
assertEquals(buffySearchResult.getName(), result.getName());
|
||||
assertEquals(buffySearchResult.getSeriesId(), result.getSeriesId());
|
||||
assertEquals(buffySearchResult.getLink(), result.getLink());
|
||||
}
|
||||
|
||||
|
||||
private TVRageClient tvrage = new TVRageClient();
|
||||
|
||||
|
||||
|
||||
private TVRageClient tvrage = new TVRageClient("5AhRvLfKAP10unE9Vnfr");
|
||||
|
||||
@Test
|
||||
public void getEpisodeList() throws Exception {
|
||||
List<Episode> list = EpisodeUtilities.filterBySeason(tvrage.getEpisodeList(buffySearchResult), 7);
|
||||
|
||||
|
||||
assertEquals(22, list.size());
|
||||
|
||||
|
||||
Episode chosen = list.get(21);
|
||||
|
||||
|
||||
assertEquals("Buffy the Vampire Slayer", chosen.getSeriesName());
|
||||
assertEquals("1997-03-10", chosen.getSeriesStartDate().toString());
|
||||
assertEquals("Chosen", chosen.getTitle());
|
||||
@ -49,16 +42,15 @@ public class TVRageClientTest {
|
||||
assertEquals(null, chosen.getAbsolute());
|
||||
assertEquals("2003-05-20", chosen.getAirdate().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListAll() throws Exception {
|
||||
List<Episode> list = tvrage.getEpisodeList(buffySearchResult);
|
||||
|
||||
|
||||
assertEquals(143, list.size());
|
||||
|
||||
|
||||
Episode first = list.get(0);
|
||||
|
||||
|
||||
assertEquals("Buffy the Vampire Slayer", first.getSeriesName());
|
||||
assertEquals("Welcome to the Hellmouth (1)", first.getTitle());
|
||||
assertEquals("1", first.getEpisode().toString());
|
||||
@ -66,11 +58,10 @@ public class TVRageClientTest {
|
||||
assertEquals(null, first.getAbsolute());
|
||||
assertEquals("1997-03-10", first.getAirdate().toString());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void getEpisodeListLinkAll() throws Exception {
|
||||
assertEquals(tvrage.getEpisodeListLink(buffySearchResult).toString(), "http://www.tvrage.com/Buffy_The_Vampire_Slayer/episode_list/all");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user