summaryrefslogtreecommitdiff
path: root/weather/weather.pl
blob: 2d9a10a9742dde3a6c74eded8e4aa62d0a513717 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/perl
use Forecast::IO;
use Data::Dumper;

my $lat  = 55.6;
my $long = 13.0;
my $key = "1f154a62adc6843a77cc29de6ac1cc4b";

my $forecast = Forecast::IO->new(
    key       => $key,
    longitude => $long,
    latitude  => $lat,
);
if(!$ARGV[0] || $ARGV[0] eq 'daily'){
$query='daily';
$text='The daily forecast is ';
}elsif($ARGV[0] eq 'hourly'){
$query='hourly';
$text='It will be ';
}elsif($ARGV[0] eq 'currently'){
$query='currently';
$text='Currently, the weather is ';
}



system "~/Dropbox/speech/tts.sh \"$text $forecast->{$query}->{summary}\"";
print "$forecast->{$query}->{summary}";
print "\n";

#my @daily_data_points = @{ $forecast->{daily}->{data} };
#
## Use your imagination about how to use this data.
## in the meantime, inspect it by dumping it.
#for (@daily_data_points) {
#    print Dumper($_);
#}