Giter VIP home page Giter VIP logo

gphotocli's Introduction

Google Photo CLI

GPhoto streamlines the photo uploading process and helps you keep your photo library organized. Say goodbye to manual photo uploads and hello to efficient photo management with GPhoto.

Features

  • No Duplicate Processing - GPhoto uses a cache with keys based on hash files to ensure that the same files are not processed repeatedly, saving you time and storage.
  • No Duplicate Album Names - GPhoto fetches album names from Google and compares them to ensure there are no duplicates, helping you keep your photo library organized and easy to navigate.
  • Automatic Token Refresh - GPhoto automatically refreshes the token if an error occurs during the photo upload process, ensuring a seamless and uninterrupted uploading experience.
  • Secure Local Storage - All authentication data and cache is securely stored locally to ensure your privacy and security. GPhoto does not collect any information from you.

Installation

Please make sure you have the following requirements installed below:

  • PHP 8.1 with curl, inotify, pcntl, and bcmatch extensions.

Download the latest release from the releases page or clone this repository.

Note

For now only tested on Linux environment.

Usage

Before using this application, you need to create a Google Cloud Platform project and enable the Google Photos Library API and create a OAuth 2.0 Client ID.

The authentication file should look like this :

{
    "web": {
        "client_id": "xxxxxxx.apps.googleusercontent.com",
        "project_id": "xxxxxxx",
        "auth_uri": "https://accounts.google.com/o/oauth2/auth",
        "token_uri": "https://oauth2.googleapis.com/token",
        "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
        "client_secret": "xxxxxxx",
        "redirect_uris": [
            "http://localhost:3000"
        ]
    }
}

1. Authorization Token

php gphoto auth:create foo --auth=./path/to/auth.json --host=http://localhost:3000

The expired token can be renewed with the following command

php gphoto auth:reload foo

Make sure you register http://localhost:3000 on Authorised redirect URIs and no service uses this port.

2. Photos

2.1 Upload Single File

php gphoto upload:photo ./path/to/photo.png --auth=foo

or you can use --album to upload to a specific album.

php gphoto upload:photo ./path/to/MyPicture.png --auth=foo --album="My Album"

2.2 Upload Multiple Files

To upload multiple files, you need to create a directory that contains all photos with the following structure:

. Pictures
├── MyPicture 1.jpg
├── MyPicture 2.jpg
├── MyPicture 3.jpg
└── MyPicture 4.jpg
php gphoto upload:photo ./path/to/Pictures --auth=foo

or you can use --album to upload to a specific album.

php gphoto upload:photo ./path/to/Pictures --auth=foo --album="My Album"

3. Albums

3.1 Upload Single Album

To upload a single album, you need to create a directory that contains all photos with the following structure:

. MyAlbum
├── MyPicture 1.jpg
├── MyPicture 2.jpg
├── MyPicture 3.jpg
├── MyPicture 4.jpg
└── MyPicture 5.jpg
php gphoto upload:album ./path/to/MyAlbum --auth=foo

This will upload all files in the MyAlbum directory to Google Photos and create an album with the MyAlbum name.

3.2 Upload Multiple Albums

To upload multiple albums, you need to create a directory that contains all albums with the following structure:

. MyAlbumCollection
├── MyAlbum 1
│   ├── MyPicture 1.jpg
│   ├── MyPicture 2.jpg
│   ├── MyPicture 3.jpg
│   └── MyPicture 4.jpg
│
└── MyAlbum 2
    ├── MyPicture 1.jpg
    ├── MyPicture 2.jpg
    ├── MyPicture 3.jpg
    └── MyPicture 4.jpg
php gphoto upload:album ./path/to/MyAlbumCollection --auth=foo --multiple

This will upload all files in the MyAlbumCollection directory to Google Photos and create an album with MyAlbum 1 and MyAlbum 2 names.

Credits

License

The MIT License (MIT). Please see License File for more information.

gphotocli's People

Contributors

supianidz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.