Skip to content

etoews/google-photos-sync-check

Repository files navigation

Google Photos Sync Check

CircleCI

Google Photos Sync Check is a utility to check that the albums you have in Google Photos (GP) are in sync with the albums you have locally on disk.

This utility is part of my personal workflow for how I use GP. GP is my primary storage for all of my photos/videos whereas my home server is my backup storage.

Absolutely all of my photos/videos go into albums. Periodically I download all new albums I've uploaded to GP from my phone and other devices using Google Takeout. I use this utility to make sure I haven't missed anything and that it's all in sync. 🔁

Enable the API

In order to use this utility, follow the instructions in Enable the Google Photos Library API.

Authenticate

Follow the instructions to Request an OAuth 2.0 client ID for the Google Photos API.

As part of that process you'll download a client_secret_xxxxx.json file. Name it client_secret.json and save it to this dir.

HttpAccessTokenRefreshError

If you get a oauth2client.client.HttpAccessTokenRefreshError: invalid_grant: Bad Request error when executing the script, delete the client_token.json file and execute the script again.

Run

pipenv install --dev --ignore-pipfile
pipenv shell
python google-photos-sync-check.py --verbose refresh_db
python google-photos-sync-check.py --verbose sync_check ~/Pictures

Test

pipenv shell
python -m pytest --cov=.

Notable

Development:

Python:

  • Python 3
  • Pyenv
  • Pipenv

Python lang features:

  • f strings
  • list comprehensions
  • generators
  • argparse
  • sets
  • context manager
  • glob
  • lambda
  • logging
  • signal handler
  • TODO: global exception handler
  • TODO: types
  • memoize

Database:

  • SQLite
  • SQLiteOnline
  • SQLAlchemy
    • indexes
    • relationships
    • collection_class
    • sessions

Testing:

  • PyTest
  • PyTest-Cov
  • PyLint
  • CircleCI
  • TODO: Memory profile

Library:

  • Pipfile
  • Google API Python Client
  • Jinja

Websites:

Related work:

Clean

Post Google Takeout cleanup.

pipenv shell
python scripts/google-takeout-cleanup.py --dry-run ~/Pictures

About

Check if your local photos are properly sync'd with your Google Photos

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published