Camera Upload Script


Hey Everyone,
I’m loving the new Camera Upload feature!  I was about to share a script I wrote to do something similar but then the guys at Plex beat me to it!  Well, anyway until Plex adds support for Videos and Android I guess it can still be of some use.
Here's what I've been doing:
- ISyncr
I have an Android tablet and a Motorola Razr M, both of which I installed ISyncr from Google Play.  ISyncr allows you to synchronize your ITunes library on a Mac or on Windows with an Android device, wirelessly and automatically.  The great thing about it is that it also allows you to upload both Videos and Pictures to your desktop AND delete them off your phone at the same time.
- IPhoto
iPhoto will import photos and videos if you dump them in the "~/iPhoto Library.photolibrary/Auto Import" directory.  Note, iPhoto needs to be open in order for this to run so make sure it's in your "Logon Items".
- Script
The two scripts will take the files from your uploaded (using iSyncr) movies and pictures directories, move them to a backup location called "$NASDIR" (which could be the directory your Plex server uses for pictures or movies) and then dump them in iPhoto's import directory.  When iPhoto is open, it will import them automatically.  Also when your Plex server scans your photo directories it will see the new photos and add them.
You could run this without the iPhoto import and just dump the photos into Plex's Photo and Movie directories.  Or do both.  The "$NASDIR" variable could be where your photos are all backed up before dumping them into iPhoto.
You can set iSyncr to run on a schedule and put these two scripts in cron:

15,45 * * * * /Users/Les/bin/import.iphoto >> /Users/Les/logs/iphoto.log 2>&1

00,30 * * * * /Users/Les/bin/import.movies >> /Users/Les/logs/movies.log 2>&1

Go outside, take some pictures with your phone, walk into the house and everything happens automatically!
DISCLAIMER: Please test this script before running on your machine! Triple check your variables and double backup your files before using these scripts!
- Les
import.iphoto.txt (1.63 KB)
import.movies.txt (1.64 KB)