// Create predicates.
Predicate typePredicate =
new Predicate("Type", PredicateOperator.IN, new String[] {"IMAGE", "VIDEO"});
selector.setPredicates(new Predicate[] {typePredicate});
MediaPage page = null;
do {
// Get all images.
page = mediaService.get(selector);
// Display images.
if (page != null && page.getEntries() != null) {
for (Media media : page.getEntries()) {
Map<MediaSize, Dimensions> dimensions = Maps.toMap(media.getDimensions());
System.out.println("Media with id '" + media.getMediaId() +
(!dimensions.isEmpty()
? "', dimensions '" + dimensions.get(MediaSize.FULL).getWidth() + "x"
+ dimensions.get(MediaSize.FULL).getHeight()
: "") + "', and MIME type '"
+ media.getMediaType() + "' was found.");
}
} else {
System.out.println("No images/videos were found.");
}
offset += PAGE_SIZE;
selector.getPaging().setStartIndex(offset);
} while (offset < page.getTotalNumEntries());
}