Opened 15 years ago

Closed 15 years ago

#7128 closed defect (fixed)

mythweather Current Conditions not working with NWS xml script

Reported by: Matt W <mwood23@…> Owned by: paulh
Priority: minor Milestone: 0.22
Component: Plugin - MythWeather Version: head
Severity: medium Keywords:
Cc: Ticket locked: no

Description

This report details a few issues with the use of the National Weather Service XML feed in MythWeather?.

Specifically:

1) The script nwsxml.pl in the current SVN is not properly parsing data returned by the National Weather Service XML feed. 2) The weather-screens.xml file currently contains a reference that causes the Current Conditions screen to completely ignore NWS as a usable source. 3) The scripts/README file makes reference to the weather-screens.xml but has a typo/error with regard to the flag passed to the scripts in question (-T instead of -t)


Detailed information:

1) the script nwsxml.pl is not properly parsing data returned, and is trying to fill array values with data that is not available, resulting in a concatenation error:

mythtv2:~/src/mythtv/trunk/mythplugins/mythweather/mythweather/scripts/us_nws$ ./nwsxml.pl -u ENG KSFO
cclocation::San Francisco Intl Airport, CA
station_id::KSFO
latitude::37.62
longitude::-122.36
observation_time::Last Updated on Sep 22 2009, 10:56 am PDT
observation_time_rfc822::Tue, 22 Sep 2009 10:56:00 -0700
weather::A Few Clouds
temperature_string::68.0 F (20.0 C)
temp::68.0
relative_humidity::68
wind_string::Northwest at 8.1 MPH (7 KT)
wind_dir::Northwest
wind_degrees::310
wind_speed::8.1
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
wind_gust::
pressure_string::1016.1 mb
pressure::30.01
dewpoint_string::57.0 F (13.9 C)
dewpoint::57.0
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
heat_index_string::
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
heat_index::
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
windchill_string::
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
windchill::
visibility::10.00
weather_icon::pcloudy.png
Use of uninitialized value in string eq at ./nwsxml.pl line 131.
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 151.
appt::
Use of uninitialized value in concatenation (.) or string at ./nwsxml.pl line 143.
wind_spdgst::8.1 () mph

In a crude attempt to get this working, I removed the script's references to these missing fields so that I could at least see it in the Current Conditions page. Which brings us to #2 ...

2) The weather-screens.xml file contains a reference in the Current Conditions block that is not provided by the nwsxml.pl script (working or otherwise). This causes the Current Conditions screen to completely ignore NWS as a usable source. The reference in question is:

        <datum name="copyright" />

and this field is not mentioned in the nwsxml.pl script. Once this line is commented out, the Current Conditions screen will use NWS as a source once MythWeather?'s Screen Setup is re-run. I believe there is syntax to make these fields optional or mandatory but I'm not sure if that code is fully implemented yet. Which brings us to ...

3) the scripts/README file contains this copy in reference to weather-screens.xml:

The text of the name within the weather-ui.xml file (with prepending flag removed) must match exactly the string returned by the -T flag; as well as the token returned when retrieving data.

Actually, '-T' is the flag that shows default timeout values. The flag '-t' is used to provide the usable strings as provided by a given script. The README should probably be updated with this minor change.

Here is the version data:

mythbackend: MythTV Version : 21972 MythTV Branch : trunk Network Protocol : 48 Library API : 0.22.20090919-1 QT Version : 4.4.3

mythfrontend: MythTV Version : 21972 MythTV Branch : trunk Network Protocol : 48 Library API : 0.22.20090919-1 QT Version : 4.4.3

mythweather SVN info: Revision: 21972 Node Kind: directory Schedule: normal Last Changed Author: robertm Last Changed Rev: 21971 Last Changed Date: 2009-09-21 07:50:06 -0700 (Mon, 21 Sep 2009)

Thank you!

Attachments (1)

7128.diff (9.2 KB) - added by Joe Ripley <vitaminjoe@…> 15 years ago.
Add copyright notices, update README, remove warnings

Download all attachments as: .zip

Change History (6)

Changed 15 years ago by Joe Ripley <vitaminjoe@…>

Attachment: 7128.diff added

Add copyright notices, update README, remove warnings

comment:1 Changed 15 years ago by Joe Ripley <vitaminjoe@…>

Attached is a patch that attempts to fix all of the errors pointed out by Matt. It adds copyright notices to all of the grabber scripts. The patch also adds some sanity checking to some variables in the nwsxml.pl script. This should prevent those ugly concatenation warnings from popping up.

Test and make sure the data is working and accurate.

Thanks!

-- Joe Ripley vitaminjoe@…

comment:2 Changed 15 years ago by Matt W <mwood23@…>

Joe--

thanks for jumping on this so fast! So far today I have only been able to test from remote, pushing the mythfrontend over a tunneled X connection, but it looks good. I applied the patch, redid the make (install), cleaned out the db of any mythweather data, and restarted mythfrontend. fwiw, I will do more thorough testing tonight when I'm actually in front of the tv :) thanks again!

comment:3 in reply to:  1 Changed 15 years ago by Matthew W <mwood23@…>

Replying to Joe Ripley <vitaminjoe@gmail.com>:

Attached is a patch that attempts to fix all of the errors pointed out by Matt. It adds copyright notices to all of the grabber scripts. The patch also adds some sanity checking to some variables in the nwsxml.pl script. This should prevent those ugly concatenation warnings from popping up.

Test and make sure the data is working and accurate.

Joe--

I tested this from home quite a bit and it looks good. The font is a bit large for the conditions description so sometimes it is truncated with "..." but that's probably an issue to solve with themes. fwiw, I recommend you make the changes in the patch part of SVN.

thanks again!

comment:4 Changed 15 years ago by paulh

Owner: changed from Isaac Richards to paulh
Status: newassigned
Version: unknownhead

comment:5 Changed 15 years ago by paulh

Resolution: fixed
Status: assignedclosed

(In [22117]) Fix MythWeather?'s current conditions screen not working with the NWS script. Thanks to Matt W for reporting the problems and Joe Ripley for the patch to fix them. Fixes #7128.

Note: See TracTickets for help on using tickets.