GithubHelp home page GithubHelp logo

google_photos's Introduction

Google photos utilities

These are some quick and dirty utilities to dump metadata for a user's Google Photos and to scan metadata for potential duplicates. There is also a sinatra web app for viewing the potential duplicates.

Follow these instructions to run the utilities.

Enable the Drive API

First, you need to enable the Drive API for your app. You can do this in your app's API project in the Google developers Console.

  1. Create an API project in the Google developers Console.
  2. Select the Services tab in your API project, and enable the Drive API.
  3. Select the API Access tab in your API project, and click Create an OAuth 2.0 client ID.
  4. In the Branding Information section, provide a name for your application (e.g. "Photo metadata dumper"), and click Next. Providing a product logo is optional.
  5. In the Client ID Settings section, do the following:
    1. Select Installed application for the Application type (or Web application for the JavaScript sample).
    2. Select Other for the Installed application type.
    3. Click Create Client ID.
  6. In the API Access page, locate the section Client ID for installed applications, and click "Download JSON" and save the file as client_secrets.json in your home directory.

Install the Google Client Library

To run the code, you'll need to install the Google API clientlibrary.

bundle install

Run the Metadata Dumper

After you have set up your Google API project, installed the Google API client library, and set up the sample source code, the sample is ready to run. The command-line samples provide a link you'll need to visit in order to authorize the sample.

bundle exec ruby print_photos_json.rb photos.json_list
  1. Browse to the provided URL in your web browser to authorize access to your photos and enter the specified access code.
  2. The application will then output the photos metadata as a list of JSON lines to the specified file.

Run the duplication heuristics

Group photos which have the name, date, location, camera model, and aspect ratio (ignoring rotation), preferring the photo with the highest resolution. ruby dump_dups.rb photos.json_list resize > resizes.json

View a web page to verify the duplicates are correct

Start the web server cd sinatra ruby ./server.rb

Go to (e.g.) http://localhost:4567/show/resizes.json and make sure the detected duplicates are valid.
Since I have only tried these heuristics against my own collection, it's important that you make sure they work on your correctly as well before going on to the next step.

Delete the duplicates

ruby remove_dups.rb resizes.json

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.