mirror of
https://forge.murkfall.net/bluesaxman/weatherget.git
synced 2026-03-13 02:54:22 -06:00
Added C to F conversion, because I don't want to change it in every script.
This commit is contained in:
10
weather.sh
10
weather.sh
@@ -92,6 +92,10 @@ sub getdir {
|
|||||||
return "↑";
|
return "↑";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub c2f {
|
||||||
|
return ($_[0] * (9/5)) + 32;
|
||||||
|
}
|
||||||
|
|
||||||
my @weather = split(":",checksources) or print "Not Available\n\n#FF0000" and exit 33;
|
my @weather = split(":",checksources) or print "Not Available\n\n#FF0000" and exit 33;
|
||||||
|
|
||||||
my $type = $weather[0];
|
my $type = $weather[0];
|
||||||
@@ -112,9 +116,9 @@ else {$type=$type."...";}
|
|||||||
|
|
||||||
my $loc = substr(($weather[4] or "??????????"), 0, 9);
|
my $loc = substr(($weather[4] or "??????????"), 0, 9);
|
||||||
|
|
||||||
my $format = '%10.10s - %5.5s %03dC %s %03dmph';
|
my $format = '%10.10s - %5.5s %03dF %s %03dmph';
|
||||||
printf( $format, $loc, $type, $temp, $wdir, $wind);
|
printf( $format, $loc, $type, c2f($temp), $wdir, $wind);
|
||||||
print "\n";
|
print "\n";
|
||||||
printf( $format, $loc, $type, $temp, $wdir, $wind);
|
printf( $format, $loc, $type, c2f($temp), $wdir, $wind);
|
||||||
print "\n";
|
print "\n";
|
||||||
print $color."\n";
|
print $color."\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user