Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google has announced a Google Photos API #23

Closed
NoLooseEnds opened this issue May 11, 2018 · 13 comments · Fixed by #32
Closed

Google has announced a Google Photos API #23

NoLooseEnds opened this issue May 11, 2018 · 13 comments · Fixed by #32

Comments

@NoLooseEnds
Copy link

NoLooseEnds commented May 11, 2018

More info:

Maybe that could help this project.

Or possibly merge with rclone (https://forum.rclone.org/t/google-photos-api/5593/10)?

@jhult
Copy link

jhult commented May 16, 2018

@jhult
Copy link

jhult commented May 16, 2018

Important note:

Note: All media items uploaded to Google Photos through the API are stored in full resolution at original quality. If your uploads exceed 25MB per user, your application should remind the user that these uploads will count towards storage in their Google Account.

Some users of this library may not desire this.

@jhult
Copy link

jhult commented May 16, 2018

As per the rclone discussion (mentioned above), the retrieval of items (photos and videos) via the new API appears to be limited. There does not appear to be a way (currently) to retrieve the original image. Exif info and perhaps other info is stripped.

Before making a request to the baseUrl (when it is an image or a thumbnail for a video), profilePictureBaseUrl or coverPhotoBaseUrl, you must specify the dimensions that your application plans to display (so that the image can be scaled appropriately).

@simonedegiacomi
Copy link
Owner

Hi, sorry for the long wait!
I've read some parts of the API documentation and see two advantages in using the API in the tool:

  1. At the moment the tool can break every time Google makes some changes to the web interface, the API is definitely more reliable;
  2. Using the API each user should enable the API for his account and use a token, which should be more secure. Currently the authentication works storing the cookies in a plain text file (which can give full access to all your Google account to someone if stolen);

Since with the API there are also some drawbacks (limited space and need to create an authentication token) maybe it can be added to the tool the possibility to choose which method to use to upload the images.
The real question is if someone would really benefit of those advantages.

@NoLooseEnds regarding to rclone, I didn't know about that tool, so I don't really know how it should handle the photo mapping from the local folder to Google photos.
@jhult about the Exif info, I think that a solution could be to recreate them using the json object that the API sends with the base and product urls.

@nmrshll
Copy link
Contributor

nmrshll commented Sep 2, 2018

Hi there,

Shameless self-promotion here: I've worked lately on porting the uploader + google photos client library on top of the new google photos API. I think it's going to be more reliable / resilient to changes on google's side, and that we can work around all the drawbacks of using it:

  • need to create an Oauth token: for the server side there is the official /x/oauth2 lib, and while it's usually a pain for client-only apps (desktop, cli, mobile...) I've worked on a library to make it simple at https://github.com/nmrshll/oauth2-noserver.
  • paid / limited storage: only photos over 16MPx count towards paid storage, so downsizing on the client-side is definitely an option here for users who would want the library to store unlimited photos for free

I've split the work into two new projects, one for the CLI uploader, and one to use as a library to build go programs on top:

@nmrshll
Copy link
Contributor

nmrshll commented Sep 2, 2018

So would it make sense to you to deprecate this project in favor of tools to work on top of the official API ?
I've made a PR for that (here), I only wanted to get your opinion about it first.

@simonedegiacomi
Copy link
Owner

Hi, great job! I like your idea to split the project in two repos.
I completely agree with you that the API would provide a more reliable library.
As @ammgws replied to the pull request, we need to take into account that the API uses the user quota.
I'll accept the pull request but i'll also add to the readme a note to specify that the new projects do not use the unlimited storage (if the photos are not less than 16mpx) yet.
In my opinion then there are 2 ways to add this functionality to the new projects: the first is to include this library in the new cli and add a flag to specify which library to use to upload the photos. The second would be to, as you said, compress the image on the client. I also would like to know your opinion, then I may contribute to implement one of the two ways.

@nmrshll
Copy link
Contributor

nmrshll commented Sep 3, 2018 via email

@simonedegiacomi
Copy link
Owner

It's true, compression on the client side seems to be a definitive and easier solution.
For now who need the server side compression could use this project.

@andrea689
Copy link
Contributor

I have tested https://github.com/nmrshll/gphotos-uploader-cli and the space available decrease even when the images are less than 16Mpx!!
In my opinion you should not deprecate this library.

@simonedegiacomi
Copy link
Owner

You're right. I've tried to upload some images with resolution lower than 16 Mpx and I've trusted the properties showed by Google Drive (which still reports a size of x bytes but with 0 bytes of storage used). A deeper look at the storage usage showed that the images are using space.
You can also notice this if you go on your Google Photos settings and click the recover space button.

Did you @nmrshll already noticed this?

(by the way, there's a feature request on the official issues page of the Google Photos API relative to the type of upload, maybe consider giving it a "star" to improve visibility)

@ammgws
Copy link
Contributor

ammgws commented Sep 10, 2018

Can you reclaim the space afterwards?

@simonedegiacomi
Copy link
Owner

Yes, it seems that the recover space functionality works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants