Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Why does PhotoEntry.getViewCount() always return null?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Bmeist  
View profile  
 More options Sep 18 2012, 3:38 pm
From: Bmeist <br...@tigernet.com>
Date: Tue, 18 Sep 2012 12:38:27 -0700 (PDT)
Local: Tues, Sep 18 2012 3:38 pm
Subject: Why does PhotoEntry.getViewCount() always return null?

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...");

      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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Mike Erickson  
View profile  
 More options Sep 18 2012, 7:11 pm
From: Mike Erickson <miketheg...@google.com>
Date: Tue, 18 Sep 2012 16:11:53 -0700 (PDT)
Local: Tues, Sep 18 2012 7:11 pm
Subject: Re: Why does PhotoEntry.getViewCount() always return null?

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=...",
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/p...",
            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


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Paul Howard  
View profile  
 More options Sep 18 2012, 8:17 pm
From: Paul Howard <paulhowa...@hotmail.com>
Date: Tue, 18 Sep 2012 20:16:16 -0400
Local: Tues, Sep 18 2012 8:16 pm
Subject: RE: [PWA API] Re: Why does PhotoEntry.getViewCount() always return null?

This is true for a number of different fields throughout the Picasa API. I
do this loop when going from user to album to photo to etc... I never rely
on the atom feed data only the atom entry data. Seems a bit of a poor
design, but it has saved me hours of wracking around like this.

Paul.

From: google-picasa-data-api@googlegroups.com
[mailto:google-picasa-data-api@googlegroups.com] On Behalf Of Mike Erickson
Sent: Tuesday, September 18, 2012 7:12 PM
To: google-picasa-data-api@googlegroups.com
Subject: [PWA API] Re: Why does PhotoEntry.getViewCount() always return
null?

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/album
id/%s?v=2
<https://picasaweb.google.com/data/feed/api/user/default/albumid/%25s?...
nd=photo> &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/albu
mid/%s/photoid/%s?v=2
<https://picasaweb.google.com/data/entry/api/user/default/albumid/%25s...
id/%25s?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/a
lbumid/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
google-picasa-data-api@googlegroups.com.
To unsubscribe from this group, send email to
google-picasa-data-api+unsubscribe@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/google-picasa-data-api?hl=en.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bmeist  
View profile  
 More options Sep 19 2012, 2:10 pm
From: Bmeist <br...@tigernet.com>
Date: Wed, 19 Sep 2012 11:10:03 -0700 (PDT)
Local: Wed, Sep 19 2012 2:10 pm
Subject: Re: Why does PhotoEntry.getViewCount() always return null?

Hey Mike, thanks very much!  Any solution that works is a good one in my
book :)  I will give this a shot.

--Brian.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic