* make sure to ignore illegal imdbids
This commit is contained in:
parent
ba02c192d3
commit
6bea36f30e
|
@ -1174,7 +1174,10 @@ public class MediaDetection {
|
|||
Set<Integer> collection = new LinkedHashSet<Integer>();
|
||||
|
||||
while (imdbMatch.find()) {
|
||||
collection.add(Integer.parseInt(imdbMatch.group()));
|
||||
int imdbid = Integer.parseInt(imdbMatch.group());
|
||||
if (imdbid > 0) {
|
||||
collection.add(imdbid);
|
||||
}
|
||||
}
|
||||
|
||||
return collection;
|
||||
|
|
|
@ -24,13 +24,13 @@ import java.util.regex.Pattern;
|
|||
|
||||
import javax.swing.Icon;
|
||||
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
import net.filebot.ResourceManager;
|
||||
import net.filebot.web.TMDbClient.MovieInfo;
|
||||
import net.filebot.web.TMDbClient.MovieInfo.MovieProperty;
|
||||
import net.filebot.web.TMDbClient.Person;
|
||||
import net.filebot.web.TMDbClient.Trailer;
|
||||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
|
@ -118,6 +118,10 @@ public class IMDbClient implements MovieIdentificationService {
|
|||
|
||||
@Override
|
||||
public Movie getMovieDescriptor(int imdbid, Locale locale) throws Exception {
|
||||
if (imdbid <= 0) {
|
||||
throw new IllegalArgumentException("id must not be " + imdbid);
|
||||
}
|
||||
|
||||
try {
|
||||
return scrapeMovie(parsePage(new URL("http", host, String.format("/title/tt%07d/", imdbid))), locale);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
|
|
@ -397,6 +397,10 @@ public class OpenSubtitlesClient implements SubtitleProvider, VideoHashSubtitleS
|
|||
|
||||
@Override
|
||||
public Movie getMovieDescriptor(int imdbid, Locale locale) throws Exception {
|
||||
if (imdbid <= 0) {
|
||||
throw new IllegalArgumentException("id must not be " + imdbid);
|
||||
}
|
||||
|
||||
Movie result = getCache().getData("getMovieDescriptor", imdbid, locale, Movie.class);
|
||||
if (result != null) {
|
||||
return result;
|
||||
|
|
|
@ -150,6 +150,10 @@ public class TMDbClient implements MovieIdentificationService {
|
|||
}
|
||||
|
||||
public Movie getMovieDescriptor(int imdbtmdbid, Locale locale, boolean byIMDB) throws IOException {
|
||||
if (imdbtmdbid <= 0) {
|
||||
throw new IllegalArgumentException("id must not be " + imdbtmdbid);
|
||||
}
|
||||
|
||||
String id = byIMDB ? String.format("tt%07d", imdbtmdbid) : String.valueOf(imdbtmdbid);
|
||||
try {
|
||||
MovieInfo info = getMovieInfo(id, locale, false, false);
|
||||
|
|
|
@ -194,6 +194,10 @@ public class TheTVDBClient extends AbstractEpisodeListProvider {
|
|||
}
|
||||
|
||||
public TheTVDBSearchResult lookupByIMDbID(int imdbid, Locale locale) throws Exception {
|
||||
if (imdbid <= 0) {
|
||||
throw new IllegalArgumentException("id must not be " + imdbid);
|
||||
}
|
||||
|
||||
TheTVDBSearchResult cachedItem = getCache().getData("lookupByIMDbID", imdbid, locale, TheTVDBSearchResult.class);
|
||||
if (cachedItem != null) {
|
||||
return cachedItem;
|
||||
|
|
Loading…
Reference in New Issue