diff options
author | Daniel Friesel <derf@finalrewind.org> | 2011-03-07 17:37:11 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2011-03-07 17:37:11 +0100 |
commit | ad56a62ae06c72d188d435dd45961a3c487f7839 (patch) | |
tree | 3b4f195eb03721abb157ef8316a3b574ad72061e /bin/vweather | |
parent | be6a8fc3771d002862e645eeec84e30791badd02 (diff) |
-> Module::Build and Derf::Visual
Diffstat (limited to 'bin/vweather')
-rwxr-xr-x | bin/vweather | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/bin/vweather b/bin/vweather index 0c7f337..b04a203 100755 --- a/bin/vweather +++ b/bin/vweather @@ -7,6 +7,7 @@ use warnings; use 5.010; use autodie; +use Derf::Visual::WeatherIcons; use GD; use Getopt::Std; use Term::ANSIColor; @@ -15,7 +16,7 @@ use Weather::Google; my %opt; my $alpha; my $dump; -my $share = $0; +my $iconstore = Derf::Visual::WeatherIcons->new(); my $weather = Weather::Google->new( 'Essen, Germany', @@ -86,11 +87,11 @@ sub show_weather_png { $high , $red); if ($dump) { - say "${share}/weather/${icon}"; + say $icon; } - if (-e "${share}/weather/${icon}") { - my $tmp = GD::Image->newFromPng("${share}/weather/${icon}", 1); + if ($iconstore->exists($icon)) { + my $tmp = GD::Image->newFromPngData($iconstore->get($icon), 1); $im->copy($tmp, $x_offset + $offset_icon, $y_offset, 0, 0, 16, 16); } } @@ -107,17 +108,6 @@ getopts('a:cdfg', \%opt); $alpha = $opt{'a'} // 40; $dump = $opt{'d'} // 0; -if (-l $share) { - my $link = readlink($share); - $share =~ s{ [^/]+ $ }{}x; - $link =~ s{ / bin / vweather $ }{}x; - $share .= "${link}/share"; -} -else { - $share =~ s{ / bin / vweather $ }{}x; - $share .= '/share'; -} - if ($opt{'c'}) { show_weather_console(); } |