SHOW:
|
|
- or go back to the newest paste.
1 | #! /bin/perl -w | |
2 | my $jpg; | |
3 | print "$ARGV[0]\n"; | |
4 | ||
5 | #argument 1 is the name of the volcano to watch | |
6 | #argument 2 is the time to sleep in seconds between webcam updates | |
7 | #you need a sub directory of the same name in which to save the jpegs too | |
8 | #THERE IS NO ERROR CHECKING | |
9 | #to capture tolbachik tun: perl photoGrab.pl tolbachik 60 | |
10 | my $volc = $ARGV[0]; | |
11 | while(1) | |
12 | { | |
13 | - | for(my $i=0; $i<360; $i++) |
13 | + | for(my $i=0; $i<360; $i++) |
14 | { | |
15 | @timeData = localtime(time); | |
16 | ||
17 | $month = $timeData[4] +1; | |
18 | $year = $timeData[5] +1900; | |
19 | - | if($volc eq "stromboli") |
19 | + | if($volc eq "stromboli") |
20 | { | |
21 | - | system("wget http://www.ct.ingv.it//sezioniesterne/webcam/WebcamEolie.php"); |
21 | + | system("wget http://www.ct.ingv.it//sezioniesterne/webcam/WebcamEolie.php"); |
22 | #open the file and search for the string match | |
23 | - | open (TEST_DATA, "WebcamEolie.php"); |
23 | + | open (TEST_DATA, "WebcamEolie.php"); |
24 | - | while () |
24 | + | while (<TEST_DATA>) |
25 | { | |
26 | if($_ =~ m/^Ultimo aggiornamento/) | |
27 | { | |
28 | #change Sqt to pic some other webcam view | |
29 | #Sqt = close up thermal | |
30 | #Sqv = close up visual | |
31 | #there is also Spt, Spv, Vvt and Vlv | |
32 | m/(Sqt\/\d{8}\/\d{4}\/Sqt\d{4}.jpg)/; | |
33 | print ("$1\n"); | |
34 | $jpg = $1; | |
35 | } | |
36 | } | |
37 | close(TEST_DATA); | |
38 | unlink ("WebcamEolie.php"); | |
39 | system("wget http://www.ct.ingv.it/dati/webcams/$jpg"); | |
40 | } | |
41 | if($volc eq "etna") | |
42 | { | |
43 | system("wget http://www.ct.ingv.it//sezioniesterne/webcam/WebcamEtna.php"); | |
44 | #open the file and search for the string match | |
45 | open (TEST_DATA, "WebcamEtna.php"); | |
46 | - | while () |
46 | + | while (<TEST_DATA>) |
47 | { | |
48 | if($_ =~ m/^Ultimo aggiornamento/) | |
49 | { | |
50 | #change Sqt to pic some other webcam view | |
51 | #Sqt = close up thermal | |
52 | #Sqv = close up visual | |
53 | #there is also Spt, Spv, Vvt and Vlv | |
54 | m/(Env\/\d{8}\/\d{4}\/Env\d{4}.jpg)/; | |
55 | print ("$1\n"); | |
56 | $jpg = $1; | |
57 | } | |
58 | } | |
59 | close(TEST_DATA); | |
60 | unlink ("WebcamEtna.php"); | |
61 | system("wget http://www.ct.ingv.it/dati/webcams/$jpg"); | |
62 | } | |
63 | ||
64 | if($volc eq "colimo") | |
65 | { | |
66 | #I think this was colimo, but it was offline at the time i added it and never tested it | |
67 | #system("wget http://www.opentopia.com/images/data/cams/9360/big.jpg"); | |
68 | } | |
69 | if($volc eq "tolbachik") | |
70 | { | |
71 | system("wget http://www.emsd.ru/video/Tolbachik/img_1.jpg"); | |
72 | #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 | |
73 | #system("./addTimeStamp.sh img_1.jpg $timeData[2]_$timeData[1]_$timeData[0]_$timeData[3]_$month_$year") | |
74 | } | |
75 | if($volc eq "whiteIsland") | |
76 | { | |
77 | system("wget http://www.geonet.org.nz/p/volcano/cameras/latest/whiteislandcraterfloor.jpg"); | |
78 | } | |
79 | ||
80 | if($volc eq "tongariro") | |
81 | { | |
82 | system("wget http://www.geonet.org.nz/p/volcano/cameras/latest/tongariro.jpg"); | |
83 | } | |
84 | ||
85 | #move the image into sub_folder and add timestamp to filename. | |
86 | system("mv *.jpg ./$volc/$year$month$timeData[3]_$timeData[2]_$timeData[1]_$timeData[0].jpg"); | |
87 | ||
88 | #time in seconds to sleep before grabbing the next picture | |
89 | #for tolbachick every 60 seconds, whiteIsland and tongario every 900 seconds | |
90 | sleep $ARGV[1]; | |
91 | } | |
92 | } |