1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-11-17 06:45:06 -05:00

* make movie detection resilient against unavailable local movie index

This commit is contained in:
Reinhard Pointner 2012-07-20 04:04:55 +00:00
parent 7c44c29b11
commit d0f32dd0f7

View File

@ -433,12 +433,19 @@ public class MediaDetection {
private static synchronized List<Entry<String, Movie>> getMovieIndex() throws IOException { private static synchronized List<Entry<String, Movie>> getMovieIndex() throws IOException {
if (movieIndex == null) { if (movieIndex == null) {
try {
Movie[] movies = releaseInfo.getMovieList(); Movie[] movies = releaseInfo.getMovieList();
movieIndex = new ArrayList<Entry<String, Movie>>(movies.length); movieIndex = new ArrayList<Entry<String, Movie>>(movies.length);
for (Movie movie : movies) { for (Movie movie : movies) {
movieIndex.add(new SimpleEntry<String, Movie>(normalizePunctuation(movie.getName()).toLowerCase(), movie)); movieIndex.add(new SimpleEntry<String, Movie>(normalizePunctuation(movie.getName()).toLowerCase(), movie));
} }
} catch (Exception e) {
// can't load movie index, just try again next time
Logger.getLogger(MediaDetection.class.getClass().getName()).log(Level.SEVERE, "Failed to load movie index: " + e.getMessage(), e);
return emptyList();
} }
}
return movieIndex; return movieIndex;
} }