1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00
This commit is contained in:
Reinhard Pointner 2014-10-29 15:23:36 +00:00
parent 81be3817a9
commit a9266eddc4

View File

@ -258,16 +258,24 @@ public final class WebServices {
@Override @Override
public synchronized List<SubtitleDescriptor> getSubtitleList(SearchResult searchResult, String languageName) throws Exception { public synchronized List<SubtitleDescriptor> getSubtitleList(SearchResult searchResult, String languageName) throws Exception {
Movie id = getIMDbID(searchResult);
if (id != null) {
return super.getSubtitleList(getIMDbID(searchResult), languageName); return super.getSubtitleList(getIMDbID(searchResult), languageName);
} }
return emptyList();
}
@Override @Override
public URI getSubtitleListLink(SearchResult searchResult, String languageName) { public URI getSubtitleListLink(SearchResult searchResult, String languageName) {
try { try {
return super.getSubtitleListLink(getIMDbID(searchResult), languageName); Movie id = getIMDbID(searchResult);
} catch (Exception e) { if (id != null) {
throw new RuntimeException(e); return super.getSubtitleListLink(id, languageName);
} }
} catch (Exception e) {
Logger.getLogger(WebServices.class.getName()).log(Level.WARNING, e.getMessage());
}
return null;
} }
public Movie getIMDbID(SearchResult result) throws Exception { public Movie getIMDbID(SearchResult result) throws Exception {
@ -280,9 +288,15 @@ public final class WebServices {
} }
if (result instanceof Movie) { if (result instanceof Movie) {
Movie m = (Movie) result; Movie m = (Movie) result;
return m.getImdbId() > 0 ? m : movieIndex.getMovieDescriptor(m, Locale.ENGLISH); if (m.getImdbId() > 0)
return m;
// fetch extended movie info
m = movieIndex.getMovieDescriptor(m, Locale.ENGLISH);
if (m.getImdbId() > 0)
return m;
} }
throw new IllegalArgumentException(String.format("'%s' not found", result)); return null;
} }
} }