1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-08-13 17:03:45 -04: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

@ -332,7 +332,7 @@ public class MediaDetection {
// 1. term: try to match movie pattern 'name (year)' or use filename as is
terms.add(reduceMovieName(getName(movieFile)));
// 2. term: first meaningful parent folder
// 2. term: first meaningful parent folder
File movieFolder = guessMovieFolder(movieFile);
if (movieFolder != null) {
terms.add(reduceMovieName(getName(movieFolder)));
@ -433,12 +433,19 @@ public class MediaDetection {
private static synchronized List<Entry<String, Movie>> getMovieIndex() throws IOException {
if (movieIndex == null) {
Movie[] movies = releaseInfo.getMovieList();
movieIndex = new ArrayList<Entry<String, Movie>>(movies.length);
for (Movie movie : movies) {
movieIndex.add(new SimpleEntry<String, Movie>(normalizePunctuation(movie.getName()).toLowerCase(), movie));
try {
Movie[] movies = releaseInfo.getMovieList();
movieIndex = new ArrayList<Entry<String, Movie>>(movies.length);
for (Movie movie : movies) {
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;
}