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