LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Wanted: Batch Email Script for Snapfish photo-uploads (https://www.linuxquestions.org/questions/linux-software-2/wanted-batch-email-script-for-snapfish-photo-uploads-386879/)

mpm 11-26-2005 11:56 PM

Wanted: Batch Email Script for Snapfish photo-uploads
 
I'm uploading 400+ photos to Snapfish.com 12 at a time, keeping a text file open in vim to bookmark which ones I've uploaded, and clearing the last 12 out of the main directory with gthumb so I don't have to scroll manually through hundreds of files every upload, it's much easier to process one screenful when forced to suffer the upload-by-file process. The 12 cent prints are worth it, but almost not.

I'm fairly sure there's a way to do it with mutt, pine or sendmail to mail in photos from a given folder as attachments, say in groups of 5 photos per email. I've never uploaded to Snapfish via email before as it seemed like a rather unwieldy and inefficient interface, but since it's the only open-interface I've found so far that Snapfish offers, it's where my thoughts are focused.

Flickr is doable via a python script I know, but the prints are 20 cents each which is double Snapfish's 10 cents per print if you pre-pay for 1000. Shutterfly's api is more accessible I think, as I noticed that the php opensource app called 'Gallery' lets you crossload them from your webspace to Shutterfly's, but again, they're 19 cents each!

Any good python/bash/perl scripters want to help us?

this is what I've got so far, but I

need help:
adding a counter
& getting mutt to not request confirmation in order to send it off...


#! /bin/bash
mutt -s photos `for f in *jpg; do echo -a $f; done` mail@gmail.com

the idea is that I would set up a filter in gmail that autofowarded mail from mpm@localhost.localhost to snapfish...

best,
mpm
ubuntu/kubuntu user

p.s. I noticed that someone asked about this similar issue about a month ago, yet I decided to start fresh as they had no responses as of yet. Their post is threadid 378384. I'd post a direct link, but as I have yet to reach the 5 posts status won't risk it :-)

mpm 05-28-2006 11:48 PM

snapfish email uploader
 
I figured it out eventually.
(crossposted from my weblog http://heliolith.com/archives/2006/0...fish-on-linux/

I’m a fan of Snapfish, mainly because I can get digital prints at $0.10 per 4 x 6 if I prepay for 1000 prints ($100.00). Even after shipping, it works out a little cheaper than Costco or other local cheap digital developers. I like the prints truly developed like traditional film, not printed, as it feels and looks just a bit better.

Anyway, I was flustered by the lack of uploading software for Snapfish available for Linux. I can’t stand the web interface where you have to browse/attach each photo in batches of 10 or whatever, that is such an awful UI for more than a handful of files. Failing to google anything up as nice as a python script based on the Snapfish API (I don’t think they’ve made their API available even), I settled on an email-based solution.

But email really didn’t seem like an efficient way of uploading, especially not if I was going to have to manually compose and attach photos to each email then send them.

Enter mutt & putmail. These are the only two packages you need to make this work.
(You could of course use postfix or sendmail as your smtp senders, but I went with putmail as it seemed simple and light). Install them & set it up so you can send a test email succesfully to yourself. rather than using my domain-less home box as the sender, I set it up to route through gmail’s free smtp service.

Here’s my ~/.putmail/putmailrc:

[config]
server = smtp.gmail.com
email = fubar@gmail.com
username = fubar
password = F00bar
port = 587
tls = true

You’ll also need to set “set sendmail=”/usr/local/bin/putmail.py” in your ~/.muttrc file. Once that’s up and running, just make a script in ~/bin or wherever you keep them with as many lines as you need to cover the variations in filenames (or use fancier regex if you know it).

Here’s the bare essential line:

#! /bin/bash
for file in *JPG; do mutt -s $file -a $file save@mysnapfish.com < /dev/null ; done
for file in *jpg; do mutt -s $file -a $file save@mysnapfish.com < /dev/null ; done

In English, this says, for each file with the *jpg ending in this directory, do invoke mutt to send it to save@snapfish.com with the subject line the same as the filename, and get your standard input from the void (essentially bypass mutt’s asking you questions and prompting you to type a message for each email). Don’t forget to chmod +x your script, whatever you call it, mine is simply ‘muttfish.’

Make sure you check your email preferences at snapfish’s site so they put the files where you want them and also, that you authorize Snapfish to receive from the email address you’ll be sending them from. Then make a copy of the photos you’ll want to upload into a temp directory, and run the script there.

I like to use gthumb’s catalog feature (Alt+E+A, enter) to add everything I want to upload from various directories to a temporary album, then make a copy of that catalog’s contents (select all) to a temporary directory.

I’ve since begun using mutt fulltime as my main email client, even though I like gmail’s UI, learning the features & conveniences of keyboard bindings in mutt, and the gpg integration is very nice. Someday I’ll get it set up with an imap account and email will function as it should. Hope this helps you.


All times are GMT -5. The time now is 01:04 PM.