#!/usr/bin/perl -w
#
# Scrape images from iPhone.
#

while (1) {

print "Polling...\n";
system('scp root@tchow_iphone.wv.cc.cmu.edu:/User/Media/DCIM/100APPLE/\\*.THM im_tmp');
system('ssh root@tchow_iphone.wv.cc.cmu.edu rm /User/Media/DCIM/100APPLE/\\*');
system('find im_tmp -iname \\*THM -exec convert {} -scale 16x1000 -crop 16x16+0+0 -depth 8 {}.pgm \\;');
system('mv im_tmp/*.pgm images');
system('rm im_tmp/*.THM');

print "   done.\n";

sleep(1);

}

