public void fill(MovieInfo info) {
Map<ImdbField, String> q = new HashMap<ImdbField, String>();
if (info.releaseName != null) q.put(ImdbField.TITLE, info.releaseName);
if (info.releaseDate != null) q.put(ImdbField.YEAR, info.releaseDate);
ImdbapiDotCom imdbapiDotCom = new ImdbapiDotCom(q);
Pattern commaDelimiter = Pattern.compile("\\s*,\\s*");
String actors = imdbapiDotCom.get(ImdbField.ACTORS);
if (actors != null) {
info.starring = Arrays.asList(commaDelimiter.split(actors));
}
String genres = imdbapiDotCom.get(ImdbField.GENRE);
if (genres != null) {
info.genres = Arrays.asList(commaDelimiter.split(genres));
}
info.plotEn = imdbapiDotCom.get(ImdbField.PLOT);
String poster = imdbapiDotCom.get(ImdbField.POSTER);
if (poster != null) {
info.cover = getCover(poster);
}
String rating = imdbapiDotCom.get(ImdbField.RATING);
if (rating != null) {
info.rankingImdb = Float.valueOf(rating);
}
String runtime = imdbapiDotCom.get(ImdbField.RUNTIME);
if (runtime != null) {
int length = 0;
if (runtime.contains("hr")) {
String[] hr = runtime.split("hr");
length += 60 * Integer.valueOf(hr[0].trim());
if (hr.length > 1) runtime = hr[1];
}
if (runtime.contains("mins")) {
String[] mins = runtime.split("mins");
length += Integer.valueOf(mins[0].trim());
}
info.length = length;
}
info.nameEn = imdbapiDotCom.get(ImdbField.TITLE);
String votes = imdbapiDotCom.get(ImdbField.VOTES);
if (votes != null) {
info.rankingNumImdb =
Integer.valueOf(votes);
}
Calendar calendar = new GregorianCalendar(ResourceManager.getLocale());
String year = imdbapiDotCom.get(ImdbField.YEAR);
if (year != null) {
int y = Integer.valueOf(year);
calendar.set(y, 0, 1); // January 1st of the year
info.date = calendar.getTime();
}
String id = imdbapiDotCom.get(ImdbField.ID);
if (id != null) {
StringBuffer linkImdb = new StringBuffer("http://www.imdb.com/title/");
linkImdb.append(id).append('/');
try {
info.linkImdb = new URL(linkImdb.toString());