Better!

I discovered that my little photoblog script was grabbing a fairly low quality thumbnail of the actual image that I sent so I fixed up the script to grab the “Original” quality image. It’s still terrible, but at least it’s as good as it can be. The script is a bit more complicated now since Sprint makes me jump through several hundred thousand hoops to get at the pictures, along with the fact that the servlet (I assume) that actually serves up the pictures is braindead but it (the script, remember?) seems to work just fine.

For the heck of it, here’s the script that gets called from procmail to find, download and archive the images.

I know I am a terrible Bash scripter and you could have done it in one line of Perl for $250,000 less and in 14 seconds but you didn’t.

#!/bin/bash
TMPDIR=/home/jason/tmp/picmail
DESTDIR=/usr/local/orion/applications/vonnieda/web/images/dc/PhotoBlog
DESTEXTRAFILE=/usr/local/orion/applications/vonnieda/web/images/webcam.jpg
rm -rf $TMPDIR
mkdir -p $TMPDIR
URL=`grep “^http.*MMS$”`
IMAGEURL=`wget -P $TMPDIR -O – $URL | grep “/mi/” | sed -e “s/.*(http.*.jpeg).*/1/”`
wget -P $TMPDIR — $URL $IMAGEURL
IMAGEFILE=`ls $TMPDIR/*.jpeg* | head -1`
cp -f $IMAGEFILE $DESTDIR/`date +%s`.jpg
cp -f $IMAGEFILE $DESTEXTRAFILE

One thought on “Better!”

Comments are closed.