ordigi/elodie/plugins/googlephotos
Cédric Leporcq 21ed551a54 Discard python 2.7 compatibility 2021-07-31 08:09:10 +02:00
..
Readme.markdown Add a plugin to upload photos to Google Photos (#319) 2019-07-12 01:44:57 -07:00
__init__.py Add a plugin to upload photos to Google Photos (#319) 2019-07-12 01:44:57 -07:00
googlephotos.py Discard python 2.7 compatibility 2021-07-31 08:09:10 +02:00
requirements.txt Add a plugin to upload photos to Google Photos (#319) 2019-07-12 01:44:57 -07:00

Readme.markdown

Google Photos Plugin for Elodie

Build Status Coverage Status Scrutinizer Code Quality

This plugin uploads all photos imported using Elodie to Google Photos. It was created after Google Photos and Google Drive synchronization was deprecated. It aims to replicate my workflow using Google Photos, Google Drive and Elodie.

I didn't intend on it, but it turned out that with this plugin you can use Google Photos with Google Drive, iCloud Drive, Dropbox or no cloud storage service while still using Google Photos for viewing and experiencing your photo library.

The hardest part of using this plugin is setting it up. Let's get started.

Installation and Setup

Google Photos

Let's start by making sure you have a Google Photos account. If you don't, you should start by creating your Google Photos account.

Google APIs

Once you've got your Google Photos account created we can enable Google Photos' APIs for your account.

In order to enable Google APIs you need what's called a project. Don't worry about what it is, just create one so you can enable the Google Photos API for it.

  1. Go to Google's developer console.

  2. If you have a project already then you can skip this step.

    If you don't already have a project or would like to create one just for this purpose then you should create it now. In the top bar there's a project selector which will open a dialog with a button to create a new project.

  3. Now you'll need to enable the Google Photos API for your project. You should be able to follow that link and click the Enable API button. Make sure the project from the prior step is selected.

  4. Once you've enabled the Google Photos API you will need to create an OAuth client ID.

    1. Select other as the type of client.
    2. Set up a consent screen if needed. Only you'll be seeing this so put whatever you want into the required fields. Most everything can be left blank.
    3. Download the credentials when prompted or click the download icon on the credentials page.

Configure the Google Photos Plugin for Elodie

Now that you're set up with your Google Photos account, have enabled the APIs and configured your OAuth client we're ready to enable this plugin for Elodie.

  1. Move the credentials file you downloaded to a permanent location and update your config.ini file. You'll need to add a [Plugins] section.

       [Plugins]
       plugins=GooglePhotos
    
       [PluginGooglePhotos]
       secrets_file=/full/path/to/saved/secrets_file.json
       auth_file=/full/path/to/save/auth_file.json
    

    I put secrets_file.json (the one you downloaded) in my ~/.elodie directory. auth_file.json will be automatically created so make sure the path is writable by the user running ./elodie.py.

  2. If you did everything exactly correct you should be able to authenticate Elodie to start uploading to Google Photos.

    1. Start by importing a new photo by running ./elodie.py import.
    2. Run ./elodie.py batch which should open your browser.
    3. Login and tell Google Photos to allow Elodie the requested permissions to your Google Photos account.
    4. At some point you'll likely see a scary warning screen. This is because your OAuth client is not approved but go ahead and click on Advanced and Go to {Your OAuth client name (unsafe).
    5. Return to your terminal and close your browser tab if you'd like.

Assuming you did not see any errors you can go back to your browser and load up Google Photos. If your photos show up in Google Photos then you got everything to work a lot easier than I did.

Automating It All

I'm not going to go into how you can automate this process but much of it is covered by various blog posts I've done in the past.

Credits

Elodie is an open source project with many contributors and users who have reported lots of bugs and feature requests.

Google Photos is an amazing product. Kudos to the team for making it so magical.