* better exception handling for movie artwork script

This commit is contained in:
Reinhard Pointner 2012-03-23 17:45:50 +00:00
parent 8ea81bfa68
commit 408ca82262
2 changed files with 11 additions and 2 deletions

View File

@ -166,8 +166,13 @@ public class TMDbClient implements MovieIdentificationService {
// resolve imdbid to tmdbid
Document dom = fetchResource("Movie.imdbLookup", String.format("tt%07d", imdbid), locale);
String tmdbid = selectString("//movie/id", dom);
if (tmdbid == null || tmdbid.isEmpty()) {
throw new IllegalArgumentException("Unable to lookup tmdb entry: " + String.format("tt%07d", imdbid));
}
// get complete movie info via tmdbid lookup
dom = fetchResource("Movie.getInfo", selectString("//movie/id", dom), locale);
dom = fetchResource("Movie.getInfo", tmdbid, locale);
// select info from xml
Node node = selectNode("//movie", dom);

View File

@ -74,5 +74,9 @@ args.eachMediaFolder { dir ->
}
println "$dir => $movie"
fetchMovieArtworkAndNfo(dir, movie)
try {
fetchMovieArtworkAndNfo(dir, movie)
} catch(e) {
println "${e.class.simpleName}: ${e.message}"
}
}