1

I'm using Google Photos API to access albums.
Users can have in an album anything from a single photo to thousands of photos.
Is there a way to get something like an ETag to know if an album has changed since a previous known state?

Currently, the only way I could find is to iterate over all the images, and having to do that in 100 photos each time can take a lot of calls just to find out at the end that nothing has changed.

Ido Ran
  • 10,584
  • 17
  • 80
  • 143
  • 1
    If the number of photos in the album is changed, you can know it by the property of `mediaItemsCount`. If the cover photo is changed, you can know it by the property of `coverPhotoBaseUrl`. If several photos in a album are changed without increasing and decreasing the number of photos, unfortunately, in the current stage, I think that it is required to confirm the creationTime, filename and so on using the method of mediaItems.list. in the current stage, I'm checking the update of albums by above processes. If this was not the direction you want, I apologize. – Tanaike Jul 21 '19 at 23:16
  • 1
    yes, it is my direction. I guess in my case I'll assume people mostly add photos to albums so I can try to compare the number of items, as you said, if it is different I'll try to fetch the first page (100 photos) and see if the there are new images equal to the change. I can also assume that if the the number of photos is the same and the first 100 photos are the same (I'll cache some of the metadata about the first 100 photos) than the whole album is the same. – Ido Ran Jul 23 '19 at 06:01
  • Thank you for replying. I think that it's a nice idea. If your issue was resolved, can you post it as an answer and accept it? By this, it will be useful for other users who have the same issue. – Tanaike Jul 23 '19 at 06:35
  • better yet, post your answer and I'll accept it (I can add my suggestion too) – Ido Ran Jul 24 '19 at 08:47
  • Thank you for replying. I posted it as an answer. Could you please confirm it? – Tanaike Jul 24 '19 at 22:25

1 Answers1

1
  • You want to know whether the album of Google Photos has been changed.

I could understand like above. Unfortunately, in the current stage, there are no metadata like the modified date when the contents in the album were changed. So in my case, I use the following workaround. Please think of this as just one of several workarounds.

Workaround:

  • If the number of photos in the album is changed, it can be known by the property of mediaItemsCount.

  • If the cover photo is changed, it can be known by the property of coverPhotoBaseUrl.

  • If several photos in a album are changed without increasing and decreasing the number of photos, unfortunately, in the current stage, I think that it is required to confirm the creationTime, filename and so on using the method of mediaItems.list.

By confirming from above in order, I can know about the change of the album.

References:

Tanaike
  • 181,128
  • 11
  • 97
  • 165