Pages

2015-06-14

Three years ago I wrote the original script to upload video to Google Drive as a trigger from Motion. Unfortunately Google recently removed support for the old security model and you now have to use OAuth 2.0. Also the gdata libraries have been superseded by the Google API Python Client. A few people have written alternatives to my original script quicker than I did, but here's my new version.

Note: I'm not using any third party libraries like PyDrive for example, this script goes straight to the Google APIs. (PyDrive has not been touched for a long time by its author and is missing features).

New feature: Public Snapshot

Motion comes with a feature to periodically take a snapshot regardless of whether motion has been detected. This is a nice feature if you want to have a web site with the latest view from your webcam. You can use Google Drive to host this image rather than installing a web server on your Pi and opening firewalls etc.

Create a public folder in your Google Drive:

Create a new folder called 'public'

Double click on it

Go to the sharing menu (person icon with + sign)

Click "Advanced" and then "Change..."

Set it to "On - Public on the Web"

Configure your uploader.cfg so docs/snapshot-folder is set to this folder 'public'.

Configure motion.conf to take a snapshot every n seconds named lastsnap.jpg and upload it: