laurentalacoque / TouchSelfie-extended

Open Source Photobooth based on the official Raspberry Pi 7" Touchscreen
54 stars 33 forks source link

News! Now fully compatible with Google Photos API

Original version of TouchSelfie was based on the, now deprecated, PICASA web API. The Picasa Web API is discontinued since January 2019. This version of TouchSelfie handles the new API with the following conditions:

Difference with previous Picasa Web API

TouchSelfie

Open Source Photobooth forked and improved from wyolum/TouchSelfie

For hardware construction, see Make Magazine article

Take a shortcut:

Installing (extracted and adapted from Make Magazine)

Complete Video Howto

For a very nice How-To of how to set up your photobooth, don't miss the video below! Many thanks to Caroline Dunn for her great teaching skills.

Caroline Dunn's TouchSelfie installation howto

Get the necessary packages

# update system
sudo apt-get update

# Install ImageTk, Image from PIL
sudo apt-get install python-imaging
sudo apt-get install python-imaging-tk

# Install google data api and upgrade it
sudo apt-get install python-gdata
sudo pip install --upgrade google-api-python-client
sudo pip install --upgrade oauth2client

# Install ImageMagick for the 'Animation' mode
sudo apt-get install imagemagick

# Install CUPS for the Printing function(optional)
sudo apt-get install cups
sudo apt-get install python-cups

# Setting up  CUPS/printer(optional)
https://www.techradar.com/how-to/computing/how-to-turn-the-raspberry-pi-into-a-wireless-printer-server-1312717
Test device:
Canon Selphy CP1300 with the Canon SELPHY CP900 - CUPS+Gutenprint v5.2.11  driver over USB

If google chrome is not on your system, the following might be necessary:

sudo apt-get install luakit
sudo update-alternatives --config x-www-browser

Optional: create a Google project and enable the APIs

This is only needed if you plan to use the 'send email' or 'upload images to cloud' features of TouchSelfie. Here's an article that will help you creating a project and downloading its credentials

Configure the program

  1. run setup.sh script, this will:

    • guide you through the feature selection (email feature, upload feature)
    • Google Photos album selection
    • and will create a photobooth.sh launcher
  2. setup.sh creates a configuration file scripts/configuration.json, you can edit this file to change configuration parameters, such as:

    • the logo file to put on your pictures
    • email subject and body
    • wether or not to archive snapshots locally
    • where to store pictures locally
  3. Optionally you can change lower-level configuration options in the file scripts/constants.py such as:

    • captured image sizes
    • hardware dependent things

Changes from wyolum/TouchSelfie

Zero password

Send mails even from protected networks

Easier setup

Hardware buttons support

Print selfies immediately

New effects

example animation

Effects Palette

Higher resolution pictures

Better snap preview mode

User interface improvements

user interface

new keyboard

A note on security and confidentiality

The Original TouchSelfie script used to store you google account and password in a .credentials file.

Considering it was a security risk, I prefered to code an alternate email-sending procedure that wouldn't require your password to get things done.

This is achieved via OAuth2 mechanism that only requires that you accept (once) that this application can access to your email. This way is safer since there's no way for the application to do anything other than what you accepted it to do.

To simplify the setup process, the setup assistant points you to a google credentials download page where email authorization is enabled by default. You can change this.

If you configured TouchSelfie to not send emails, you don't need to authorize access to your mail box, just change this during the credentials download process. This way, the application will only require basic authorization to your account.

No, but don't take my word!

This is the beauty of opensource: everybody can read the source code and check if it's harmfull. Plus, with Github, you can't hide anything: every versions of this code is archived and I can't delete them: you will always be able to verify that I didn't do anything harmfull in the past.

Maybe you don't have the competency to verify the sourcecode, but others have and I trust they will alert the world if they find something nasty (or just file an Issue!).

Hint for future verifyiers: the scripts/oaut2services.py contains all the code that accesses the Google Accounts. As you will see in the __init__ method of the OAuthServices class, the only scope that is requested it the https://www.googleapis.com/auth/gmail.send that restricts the permission of the application to only sending emails on your behalf. (See this official doc)

No, but again, don't take my word for it ;) take a look at scripts/oauth2services.py where all Google account access are done. In the __init__ method of the OAuthServices class, the only scope(s) that are requested for the photo library are:

See official doc for the Google Photos API scopes.

Your Security and My Quota.

By retrieving yourself application credentials, you basically authorize yourself to access your own google account and you can revoke this whenever you want. Also, Application Credentials have a daily limit of free use, If I were to provide you my own credentials, a group of users would consume this quota in no time, leaving everybody with a bad experience.