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

Improved logging

This commit is contained in:
Reinhard Pointner 2016-03-11 20:05:46 +00:00
parent ee11696457
commit 0a8234fdf8

View File

@ -91,6 +91,13 @@ public class TMDbClient implements MovieIdentificationService {
// e.g. {"id":16320,"title":"冲出宁静号","release_date":"2005-09-30","original_title":"Serenity"} // e.g. {"id":16320,"title":"冲出宁静号","release_date":"2005-09-30","original_title":"Serenity"}
return streamJsonObjects(response, "results").map(it -> { return streamJsonObjects(response, "results").map(it -> {
int id = -1, year = -1; int id = -1, year = -1;
try {
id = getDecimal(it, "id").intValue();
year = matchInteger(getString(it, "release_date")); // release date is often missing
} catch (Exception e) {
debug.warning(format("Missing data: release_date => %s", it));
return null;
}
String title = getString(it, "title"); String title = getString(it, "title");
String originalTitle = getString(it, "original_title"); String originalTitle = getString(it, "original_title");
@ -98,10 +105,6 @@ public class TMDbClient implements MovieIdentificationService {
title = originalTitle; title = originalTitle;
} }
try {
id = getDecimal(it, "id").intValue();
year = matchInteger(getString(it, "release_date")); // release date is often missing
Set<String> alternativeTitles = new LinkedHashSet<String>(); Set<String> alternativeTitles = new LinkedHashSet<String>();
if (originalTitle != null) { if (originalTitle != null) {
alternativeTitles.add(originalTitle); alternativeTitles.add(originalTitle);
@ -122,10 +125,6 @@ public class TMDbClient implements MovieIdentificationService {
alternativeTitles.remove(title); alternativeTitles.remove(title);
return new Movie(title, alternativeTitles.toArray(new String[0]), year, -1, id, locale); return new Movie(title, alternativeTitles.toArray(new String[0]), year, -1, id, locale);
} catch (Exception e) {
debug.warning(format("Bad data: %s", it));
return null;
}
}).filter(Objects::nonNull).collect(toList()); }).filter(Objects::nonNull).collect(toList());
} }