I have a solution,although you might not think it's a good solution. The
problem is that the view count is only correctly returned for PhotoEntry
requests that are requested directly. So although the AlbumFeed contains
PhotoEntry objects, those objects will not work for you.
But you can do this:
String albumId = "5789637314433011089";
feedURL = new URL(
String.format("https://picasaweb.google.com/data/feed/api/user/default/albumid/%s?v=2&kind=photo",
albumId));
AlbumFeed albumFeed = myService.getFeed(feedURL, AlbumFeed.class);
for (PhotoEntry photo : albumFeed.getPhotoEntries()) {
String photoId = photo.getGphotoId();
URL photoEntryUrl = new URL(
String.format("https://picasaweb.google.com/data/entry/api/user/default/albumid/%s/photoid/%s?v=2",
albumId, photoId));
PhotoEntry photoEntry = myService.getEntry(photoEntryUrl,
PhotoEntry.class);
System.out.println("View count = " + photoEntry.getViewCount());
}
The thing to notice is that the URL for the nested request is
.../data/entry/api... instead of .../data/feed/api...
I hope that helps, at least a little.
-Mike
On Tuesday, September 18, 2012 12:38:27 PM UTC-7, Bmeist wrote:
>
> Greetings, I cannot seem to get anything other than null to return from
> PhotoEntry.getViewCount(). All of my photos have view counts shown on the
> picasaweb interface. Also, hasViewCountExt() returns false for all of
> them. If I paste the URL into a browser and view the source, I can see the
> correct view count. Thanks very much for any advice!
>
> URL feedURL = new URL("
> https://picasaweb.google.com/data/feed/api/user/118157739053519600454/albumid/5783763403683349537/photoid/5783763444234578498?v=2
> ");
>
> Query query = new Query(feedURL);
> query.setStringCustomParameter("kind", "photo");
>
> int numPhotos = feed.getPhotoEntries().size();
> AlbumFeed feed = picasaService.query(query, AlbumFeed.class);
> for (int i = 0; i < numPhotos; i++) {
> PhotoEntry photo = (PhotoEntry) feed.getPhotoEntries().get(i);
> System.out.println("view count = " + photo.getViewCount());
> }
>
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Picasa Web Albums API" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-picasa-data-api/-/tt7qtN-BIGUJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-picasa-data-api?hl=en.