Geekery

Apr. 10th, 2004 02:46 pm
pasithea: glowing girl (Default)
[personal profile] pasithea
People keep asking what I'm doing when I'm idle and I realized that the screen for Maya actually looks pretty neat most of the time I'm working in it, so... I wrote a little desktop grabber thingy for MacOS. You'll have to find/download ncftp to get it to work and change the path to it accordingly. The rest is pretty straight-forward. SIPS comes free with OSX-10.3 but may not be in earlier OSX's. I copied it from 10.3 to 10.2.8 and it runs just fine. You could also replace it with ImageMagick. Other than that, here's the whole script.

#!/bin/sh

#Define some variables.
NCFTPDIR="$HOME/ical_synch/ncftp"
USER="user_name"
PASS="user_password"
SERVER="twu.net";                  #Where to put the file.
WEBDIR="public_html/photos/webcam"; #Directory on website to put file.
FILENAME="desktop";             #Image name without suffix. (includes path)
XSIZE=800;                            #Number of pixels across.
YSIZE=600;                            #Number of pixels down.

/usr/sbin/screencapture $FILENAME.pdf
/usr/bin/sips -s format jpeg $FILENAME.pdf -s formatOptions low -z $YSIZE $XSIZE -o $FILENAME.jpg
/bin/rm $FILENAME.pdf

$NCFTPDIR/ncftpput -u $USER -p $PASS $SERVER $WEBDIR $FILENAME.jpg
/bin/rm $FILENAME.jpg


And then of course, you also want a cronjob to run it every 5 minutes:

1,6,11,16,21,26,31,36,41,46,51,56 * * * * /Users/sammi/deskgrab/deskgrab.sh


You can go to http://circle.twu.net/photos/webcam/desktop.html and see it run. You can also hit 'view source' and get the script (It's just a meta refresh)

So... that's it. I love Macs! :) Next time someone asks, they can just look there instead. (Unless I'm doing physical animation in which case I'll have the webcam turned on, maybe. :)

(Okay, maybe I am an attention whore)

(no subject)

Date: 2004-04-12 03:56 am (UTC)
zeeth_kyrah: A glowing white and blue anthropomorphic horse stands before a pink and blue sky. (Default)
From: [personal profile] zeeth_kyrah
I believe Snapperhead takes a fresh snapshot each time the HTTP server recieves a hit, which would definitely slow things down if you got a lot of upstream traffic.

February 2012

S M T W T F S
   1234
567891011
12 131415161718
19202122232425
26272829   

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 1st, 2026 04:01 am
Powered by Dreamwidth Studios