Gentoo Archives: gentoo-commits

From: "Doug Goldstein (cardoe)" <cardoe@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-plugins/mythweather/files: mythweather-0.21_p20069-nws-parse-fix.patch
Date: Tue, 10 Nov 2009 15:58:44
Message-Id: E1N7t7B-0001X1-P3@stork.gentoo.org
1 cardoe 09/11/10 15:58:41
2
3 Added: mythweather-0.21_p20069-nws-parse-fix.patch
4 Log:
5 Patch from Jerry McDonald <gentoo@××××××××××.com> from bug #287001 fixing the parsing error in the NWS script in 0.21. Fixed permissions on the scripts in 0.21 and 0.22
6 (Portage version: 2.1.7.4/cvs/Linux x86_64)
7
8 Revision Changes Path
9 1.1 media-plugins/mythweather/files/mythweather-0.21_p20069-nws-parse-fix.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-plugins/mythweather/files/mythweather-0.21_p20069-nws-parse-fix.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-plugins/mythweather/files/mythweather-0.21_p20069-nws-parse-fix.patch?rev=1.1&content-type=text/plain
13
14 Index: mythweather-0.21_p20069-nws-parse-fix.patch
15 ===================================================================
16 diff -Burp a/mythweather/mythweather/scripts/us_nws/nwsxml.pl b/mythweather/mythweather/scripts/us_nws/nwsxml.pl
17 --- a/mythweather/mythweather/scripts/us_nws/nwsxml.pl 2008-02-11 11:38:20.000000000 -0500
18 +++ b/mythweather/mythweather/scripts/us_nws/nwsxml.pl 2009-09-29 17:59:08.000000000 -0400
19 @@ -99,11 +99,17 @@ foreach (@types) {
20 $xml->{$key} = int($xml->{'wind_mph'} * 1.609344 + .5);
21 }
22 } elsif (/wind_gust/) {
23 - if ($units =~ /ENG/ || $xml->{'wind_gust_mph'} eq 'NA') {
24 - $key = 'wind_gust_mph';
25 + if (defined($xml->{'wind_gust_mph'})) {
26 + if ($units =~ /ENG/ || $xml->{'wind_gust_mph'} eq 'NA') {
27 + $key = 'wind_gust_mph';
28 + } else {
29 + $key = 'wind_gust_kph';
30 + $xml->{$key} = int($xml->{'wind_gust_mph'} * 1.609344 + .5);
31 + }
32 } else {
33 - $key = 'wind_gust_kph';
34 - $xml->{$key} = int($xml->{'wind_gust_mph'} * 1.609344 + .5);
35 + $xml->{'wind_gust_mph'} = 'NA';
36 + $xml->{'wind_gust_kph'} = 'NA';
37 + $key = 'wind_gust';
38 }
39 } elsif (/visibility/) {
40 if ($units =~ /ENG/) {
41 @@ -128,14 +134,17 @@ foreach (@types) {
42 } elsif (/cclocation/) {
43 $key = 'location';
44 } elsif (/appt$/) {
45 - if ($xml->{windchill_f} eq 'NA') {
46 - $key = 'heat_index_f' if ($units =~ /ENG/);
47 - $key = 'heat_index_c' if ($units =~ /SI/);
48 - } else {
49 - $key = 'windchill_f' if ($units =~ /ENG/);
50 - $key = 'windchill_c' if ($units =~ /SI/);
51 - };
52 -
53 + if (defined($xml->{windchill_f})) {
54 + if ($xml->{windchill_f} eq 'NA') {
55 + $key = 'heat_index_f' if ($units =~ /ENG/);
56 + $key = 'heat_index_c' if ($units =~ /SI/);
57 + } else {
58 + $key = 'windchill_f' if ($units =~ /ENG/);
59 + $key = 'windchill_c' if ($units =~ /SI/);
60 + };
61 + } else {
62 + $key = 'appt';
63 + }
64 } elsif (/wind_spdgst/) {
65 # relying on this being after speed and gust
66 $key = "wind_spdgst";
67 @@ -148,5 +157,11 @@ foreach (@types) {
68 } else {
69 $key = $label;
70 }
71 - printf $label . "::" . $xml->{$key}. "\n";
72 + print $label . "::";
73 + if (defined($xml->{$key})) {
74 + print $xml->{$key};
75 + } else {
76 + print "NA";
77 + }
78 + print "\n";
79 }