From 397cec83d5cab8432268425ac6e086f9ca52bc72 Mon Sep 17 00:00:00 2001 From: Reinhard Pointner Date: Sun, 29 Jul 2012 08:49:13 +0000 Subject: [PATCH] * ignore invalid movies --- source/net/sourceforge/filebot/web/TMDbClient.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/source/net/sourceforge/filebot/web/TMDbClient.java b/source/net/sourceforge/filebot/web/TMDbClient.java index 21a1316f..51b92139 100644 --- a/source/net/sourceforge/filebot/web/TMDbClient.java +++ b/source/net/sourceforge/filebot/web/TMDbClient.java @@ -105,10 +105,15 @@ public class TMDbClient implements MovieIdentificationService { @Override public Movie getMovieDescriptor(int imdbid, Locale locale) throws IOException { + String id = String.format("tt%07d", imdbid); try { - MovieInfo info = getMovieInfo(String.format("tt%07d", imdbid), locale, false); + MovieInfo info = getMovieInfo(id, locale, false); return new Movie(info.getName(), info.getReleased().getYear(), info.getImdbId(), info.getId()); } catch (FileNotFoundException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Movie not found: " + id); + return null; + } catch (NullPointerException e) { + Logger.getLogger(getClass().getName()).log(Level.WARNING, "Movie data missing: " + id); return null; } } @@ -422,7 +427,11 @@ public class TMDbClient implements MovieIdentificationService { public Date getReleased() { // e.g. 2005-09-30 - return Date.parse(get(MovieProperty.release_date), "yyyy-MM-dd"); + try { + return Date.parse(get(MovieProperty.release_date), "yyyy-MM-dd"); + } catch (Exception e) { + return null; + } }