1

I like Google Photos but I've noticed that it is lacking some basic metrics like how many media items are in my account. Also I wanted to see which of my media items are not included in any of my albums. I ended up creating a simple console app using Google Photos REST API. It uses GET /albums, then POST /mediaItems:search?albumId={id} to get each album's media items and then cross references them with a full list of media items returned by GET /mediaItems.

It worked reasonably well however I've noticed a problem with the shared items. For a shared album owned by account A, if a media item is added from another account B then its id won't be found in the list of the media items of the account A (which is not unreasonable). If such a shared media item is saved in account A its id won't match the id of the original shared media item added to the shared album (returned by POST /mediaItems:search?albumId={id}). W/out an indicator of some sort to identify if a media item belongs to another account it's challenging to filter them out. I expected to see the contributorInfo as part of the MediaItem but that attribute is not returned.

If I try to add a saved copy of the same shared item into an album using UI I get a notification message that it's already there so obviously Google Photos UI does have that info. Does anyone have any clever ideas on how to match a saved copy of a shared media item with the original? The code is available at https://github.com/pavelfomin/gphoto-manager

pavel
  • 2,964
  • 2
  • 14
  • 14

1 Answers1

1

I ended up using ignore media items list in https://github.com/pavelfomin/gphoto-manager that I populate locally with the media items I want to ignore:

Usage: com.droidablebee.gphoto.GooglePhotoApplication [options] -token=<access token> [-Dsuppress-warnings] [-Dignore-media-items-file=<file with media items to ignore>]
            --albums           list all albums, sorted by name
            --album-items      list all items per album (use with care for large number of media items)
            --items            list all items (use with care for large number of media items)
            --items-no-album   list all items not included in any album
            <access token>     OAuth 2 Access Token can be obtained from https://developers.google.com/oauthplayground
                               use 'https://www.googleapis.com/auth/photoslibrary.readonly' as the requested scope
            suppress-warnings  suppress all warnings, including album media count / items mismatch 

Ideally, I'd use Google Photos REST API to filter out the shared items but that does not seem to be possible at the moment.

pavel
  • 2,964
  • 2
  • 14
  • 14