diff --git a/source/net/sourceforge/filebot/media/ReleaseInfo.java b/source/net/sourceforge/filebot/media/ReleaseInfo.java index e625f08c..3492998a 100644 --- a/source/net/sourceforge/filebot/media/ReleaseInfo.java +++ b/source/net/sourceforge/filebot/media/ReleaseInfo.java @@ -24,6 +24,7 @@ import java.util.zip.GZIPInputStream; import net.sourceforge.filebot.web.CachedResource; import net.sourceforge.filebot.web.Movie; +import net.sourceforge.filebot.web.TheTVDBClient.TheTVDBSearchResult; import net.sourceforge.tuned.ByteBufferInputStream; @@ -174,6 +175,11 @@ public class ReleaseInfo { } + public synchronized TheTVDBSearchResult[] getSeriesList() throws IOException { + return seriesListResource.get(); + } + + public FileFilter getDiskFolderFilter() { return new FolderEntryFilter(compile(getBundle(getClass().getName()).getString("pattern.diskfolder.entry"))); } @@ -183,6 +189,7 @@ public class ReleaseInfo { protected final CachedResource releaseGroupResource = new PatternResource(getBundle(getClass().getName()).getString("url.release-groups")); protected final CachedResource queryBlacklistResource = new PatternResource(getBundle(getClass().getName()).getString("url.query-blacklist")); protected final CachedResource movieListResource = new MovieResource(getBundle(getClass().getName()).getString("url.movie-list")); + protected final CachedResource seriesListResource = new SeriesResource(getBundle(getClass().getName()).getString("url.series-list")); protected static class PatternResource extends CachedResource { @@ -223,6 +230,29 @@ public class ReleaseInfo { } + protected static class SeriesResource extends CachedResource { + + public SeriesResource(String resource) { + super(resource, TheTVDBSearchResult[].class, 24 * 60 * 60 * 1000); // 24h update interval + } + + + @Override + public TheTVDBSearchResult[] process(ByteBuffer data) throws IOException { + Scanner scanner = new Scanner(new GZIPInputStream(new ByteBufferInputStream(data)), "UTF-8").useDelimiter("\t|\n"); + + List tvshows = new ArrayList(); + while (scanner.hasNext()) { + int sid = scanner.nextInt(); + String name = scanner.next(); + tvshows.add(new TheTVDBSearchResult(name, sid)); + } + + return tvshows.toArray(new TheTVDBSearchResult[0]); + } + } + + protected static class FolderEntryFilter implements FileFilter { private final Pattern entryPattern; diff --git a/source/net/sourceforge/filebot/media/ReleaseInfo.properties b/source/net/sourceforge/filebot/media/ReleaseInfo.properties index 256fd507..07b54266 100644 --- a/source/net/sourceforge/filebot/media/ReleaseInfo.properties +++ b/source/net/sourceforge/filebot/media/ReleaseInfo.properties @@ -12,6 +12,7 @@ url.query-blacklist: http://filebot.sourceforge.net/data/query-blacklist.txt # list of all movies (id, name, year) url.movie-list: http://filebot.sourceforge.net/data/movies.txt.gz +url.series-list: http://filebot.sourceforge.net/data/tvshows.txt.gz # disk folder matcher pattern.diskfolder.entry: ^BDMV$|^HVDVD_TS$|^VIDEO_TS$|^AUDIO_TS$|^VCD$ diff --git a/source/net/sourceforge/filebot/web/AnidbClient.java b/source/net/sourceforge/filebot/web/AnidbClient.java index 4a696caa..0d54aa4a 100644 --- a/source/net/sourceforge/filebot/web/AnidbClient.java +++ b/source/net/sourceforge/filebot/web/AnidbClient.java @@ -167,7 +167,7 @@ public class AnidbClient extends AbstractEpisodeListProvider { } - protected synchronized List getAnimeTitles() throws Exception { + public synchronized List getAnimeTitles() throws Exception { URL url = new URL("http", host, "/api/animetitles.dat.gz"); ResultCache cache = getCache();