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-10 11:05 pm (UTC)
From: [identity profile] kibbles.livejournal.com
Did you see Snapperhead? Similar thing, and they have the code out there so you can peek and compare.

And all my PC friends wanna do it but can't figure out how!

(no subject)

Date: 2004-04-11 12:30 am (UTC)
From: [identity profile] dv-girl.livejournal.com
That was the name of that program you use that I couldn't remember the name of! :)

I looked for you to ask what it was, didn't see you, got frustrated and wrote my own. :)

(no subject)

Date: 2004-04-11 12:35 am (UTC)
From: [identity profile] kibbles.livejournal.com
I would imagine yours is less stress on the processor, wouldn't slow everything down like Snapperhead does?

I have to think. Thinking is reserved for some time in May, when Dan has vacation and I have 2 seconds to myself!

(no subject)

Date: 2004-04-11 01:05 am (UTC)
From: [identity profile] dv-girl.livejournal.com
It doesn't slow down my machine but I have a dual-processor G4 tower with like 512M of ram and stuff. I don't know if it'd slow down a less powerful machine or not.
I don't _think_ it would but that's no garuntee. :)

(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.

(no subject)

Date: 2004-04-11 01:28 am (UTC)
From: [identity profile] saberwind.livejournal.com
Looking at that link. I like the squirrelgirl you seem to beworking with. :}

Hope your day will be happy!

February 2012

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

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 31st, 2025 11:52 pm
Powered by Dreamwidth Studios