NodeList all = new NodeList();
movie.collectInto(all, infoCollector);
String movieId = ((Tag)movie).getAttribute("id");
MovieItem item = null;
if (all.size() > 0) {
item = createMovieItem(movieId);
int i=0;
//save off the title and image
item.setTitle(NodeUtils.getTextData(infoCollector.getNode(i++)));
//get the icon
ImageTag icon = (ImageTag)infoCollector.getNode(i++);
item.setIconUrl(icon.getImageURL().replace("&&", "&"));
//strip off the query params
int index = item.getIconUrl().indexOf('?');
if (index != -1) {
item.setIconUrl(item.getIconUrl().substring(0, index)+ "?wid=130&hei=182&cvt=jpeg");
item.setIconWidth(130);
item.setIconHeight(182);
}
if (item.getIconUrl().startsWith("//")) {
item.setIconUrl("http:" + item.getIconUrl());
}
//the mpaa rating
item.setMpaa(NodeUtils.getTextData(infoCollector.getNode(i++)));
//the release year
item.setYear(NodeUtils.getTextData(infoCollector.getNode(i++)));
//rating
int rating = -1;
boolean myRating = false;
Node ratingNode = infoCollector.getNode(i++);
if (ratingNode != null) {
String ratingStr = ((Tag)ratingNode).getAttribute("src");
Matcher matcher = ratingPattern.matcher(ratingStr);
if (matcher.matches()) {
myRating = "rt".equals(matcher.group(1));
rating = Integer.parseInt(matcher.group(2));
}
item.setRating(rating);
}
if (myRating) {
item.setMyRating(rating);
}
//summary
item.setSummary(NodeUtils.getTextData(infoCollector.getNode(i++)));
item.addDetailFlag(MovieItem.DETAIL_SEARCH);
}
return item;
}