Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/perl -w
- my $jpg;
- print "$ARGV[0]\n";
- #argument 1 is the name of the volcano to watch
- #argument 2 is the time to sleep in seconds between webcam updates
- #you need a sub directory of the same name in which to save the jpegs too
- #THERE IS NO ERROR CHECKING
- #to capture tolbachik tun: perl photoGrab.pl tolbachik 60
- my $volc = $ARGV[0];
- while(1)
- {
- for(my $i=0; $i<360; $i++)
- {
- @timeData = localtime(time);
- $month = $timeData[4] +1;
- $year = $timeData[5] +1900;
- if($volc eq "stromboli")
- {
- system("wget http://www.ct.ingv.it//sezioniesterne/webcam/WebcamEolie.php");
- #open the file and search for the string match
- open (TEST_DATA, "WebcamEolie.php");
- while (<TEST_DATA>)
- {
- if($_ =~ m/^Ultimo aggiornamento/)
- {
- #change Sqt to pic some other webcam view
- #Sqt = close up thermal
- #Sqv = close up visual
- #there is also Spt, Spv, Vvt and Vlv
- m/(Sqt\/\d{8}\/\d{4}\/Sqt\d{4}.jpg)/;
- print ("$1\n");
- $jpg = $1;
- }
- }
- close(TEST_DATA);
- unlink ("WebcamEolie.php");
- system("wget http://www.ct.ingv.it/dati/webcams/$jpg");
- }
- if($volc eq "etna")
- {
- system("wget http://www.ct.ingv.it//sezioniesterne/webcam/WebcamEtna.php");
- #open the file and search for the string match
- open (TEST_DATA, "WebcamEtna.php");
- while (<TEST_DATA>)
- {
- if($_ =~ m/^Ultimo aggiornamento/)
- {
- #change Sqt to pic some other webcam view
- #Sqt = close up thermal
- #Sqv = close up visual
- #there is also Spt, Spv, Vvt and Vlv
- m/(Env\/\d{8}\/\d{4}\/Env\d{4}.jpg)/;
- print ("$1\n");
- $jpg = $1;
- }
- }
- close(TEST_DATA);
- unlink ("WebcamEtna.php");
- system("wget http://www.ct.ingv.it/dati/webcams/$jpg");
- }
- if($volc eq "colimo")
- {
- #I think this was colimo, but it was offline at the time i added it and never tested it
- #system("wget http://www.opentopia.com/images/data/cams/9360/big.jpg");
- }
- if($volc eq "tolbachik")
- {
- system("wget http://www.emsd.ru/video/Tolbachik/img_1.jpg");
- #TODO add timestamp to jpeg image, note the timestamp is local time, it should really be changed to the timezone you are capturing the image from
- #system("./addTimeStamp.sh img_1.jpg $timeData[2]_$timeData[1]_$timeData[0]_$timeData[3]_$month_$year")
- }
- if($volc eq "whiteIsland")
- {
- system("wget http://www.geonet.org.nz/p/volcano/cameras/latest/whiteislandcraterfloor.jpg");
- }
- if($volc eq "tongariro")
- {
- system("wget http://www.geonet.org.nz/p/volcano/cameras/latest/tongariro.jpg");
- }
- #move the image into sub_folder and add timestamp to filename.
- system("mv *.jpg ./$volc/$year$month$timeData[3]_$timeData[2]_$timeData[1]_$timeData[0].jpg");
- #time in seconds to sleep before grabbing the next picture
- #for tolbachick every 60 seconds, whiteIsland and tongario every 900 seconds
- sleep $ARGV[1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement