mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-24 00:38:52 -05:00
* update TVRageClient (switch to services.tvrage.com and remove cache because its really fast anyway)
This commit is contained in:
parent
a500aacf80
commit
9f047e67a5
@ -16,21 +16,16 @@ import java.util.List;
|
|||||||
import javax.swing.Icon;
|
import javax.swing.Icon;
|
||||||
import javax.xml.parsers.ParserConfigurationException;
|
import javax.xml.parsers.ParserConfigurationException;
|
||||||
|
|
||||||
import net.sf.ehcache.Cache;
|
|
||||||
import net.sf.ehcache.CacheManager;
|
|
||||||
import net.sf.ehcache.Element;
|
|
||||||
import net.sourceforge.filebot.ResourceManager;
|
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.xml.sax.SAXException;
|
import org.xml.sax.SAXException;
|
||||||
|
|
||||||
|
import net.sourceforge.filebot.ResourceManager;
|
||||||
|
|
||||||
|
|
||||||
public class TVRageClient implements EpisodeListProvider {
|
public class TVRageClient implements EpisodeListProvider {
|
||||||
|
|
||||||
private static final String host = "www.tvrage.com";
|
private static final String host = "services.tvrage.com";
|
||||||
|
|
||||||
private final Cache cache = CacheManager.getInstance().getCache("web");
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -74,20 +69,12 @@ public class TVRageClient implements EpisodeListProvider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public List<Episode> getEpisodeList(SearchResult searchResult) throws IOException, SAXException, ParserConfigurationException {
|
public List<Episode> getEpisodeList(SearchResult searchResult) throws IOException, SAXException, ParserConfigurationException {
|
||||||
int showId = ((TVRageSearchResult) searchResult).getShowId();
|
int showId = ((TVRageSearchResult) searchResult).getShowId();
|
||||||
|
|
||||||
URL episodeListUrl = new URL("http", host, "/feeds/episode_list.php?sid=" + showId);
|
URL episodeListUrl = new URL("http", host, "/feeds/episode_list.php?sid=" + showId);
|
||||||
|
|
||||||
// try to load from cache
|
|
||||||
Element cacheEntry = cache.get(episodeListUrl.toString());
|
|
||||||
|
|
||||||
if (cacheEntry != null) {
|
|
||||||
return (List<Episode>) cacheEntry.getValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
Document dom = getDocument(episodeListUrl);
|
Document dom = getDocument(episodeListUrl);
|
||||||
|
|
||||||
String seriesName = selectString("Show/name", dom);
|
String seriesName = selectString("Show/name", dom);
|
||||||
@ -109,9 +96,6 @@ public class TVRageClient implements EpisodeListProvider {
|
|||||||
episodes.add(new Episode(seriesName, seasonNumber, episodeNumber, title));
|
episodes.add(new Episode(seriesName, seasonNumber, episodeNumber, title));
|
||||||
}
|
}
|
||||||
|
|
||||||
// populate cache
|
|
||||||
cache.put(new Element(episodeListUrl.toString(), episodes));
|
|
||||||
|
|
||||||
return episodes;
|
return episodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user