Difference between revisions of "MythWeather Grabber Script Format"

From MythTV Official Wiki
Jump to: navigation, search
(shamelessly stolen from mythvideo_grabber_script_format)
 
(added optional data fields)
Line 78: Line 78:
 
visibility::10-20
 
visibility::10-20
 
</pre>
 
</pre>
 +
 +
== Valid Data Types ==
 +
 +
{| cellpadding="4" border="1"
 +
| style="background:silver" | '''cclocation'''
 +
| Descriptive name of location
 +
| Text
 +
|-
 +
| style="background:silver" | '''relative_humidity'''
 +
| Percent humidity
 +
| Integer
 +
|-
 +
| style="background:silver" | '''pressure'''
 +
| Barometric pressure
 +
| Float
 +
|-
 +
| style="background:silver" | '''wind_spdgst'''
 +
| Wing speed (gust)
 +
| Integer
 +
|-
 +
| style="background:silver" | '''wind_dir'''
 +
| Wind direction
 +
| Cardinal
 +
|-
 +
| style="background:silver" | '''visibility'''
 +
|
 +
| Integer/Range
 +
|-
 +
| style="background:silver" | '''appt'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''temp'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''weather'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''weather_icon'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''observation_time'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''copyright'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''3dlocation'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''6dlocation'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''date-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''icon-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''low-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''high-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''updatetime'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''18icon-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''temp-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''pop-<n>'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''swlocation'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''alerts'''
 +
| can have multiple lines
 +
|
 +
|-
 +
| style="background:silver" | '''forecastdate'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''tempforecast'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''condforecast'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''todaypic'''
 +
|
 +
|
 +
|-
 +
| style="background:silver" | '''location'''
 +
|
 +
|
 +
}
  
 
[[Category:Developer Documentation]]
 
[[Category:Developer Documentation]]

Revision as of 06:56, 25 December 2009

MythWeather grabber scripts are small executable perl, python, or binary applications which query online sources of weather and return it in a format parseable by MythWeather. This page documents the current format required of the grabber scripts to function.

The Version Command (-v)

All grabber scripts must return an identifying string when run with the '-v' argument. The command returns a comma separated list of the script name, script version, author, and author's email, and output must end with a newline character.

#./bbccurrentxml.pl -v
BBC-Current-XML,0.2,Stuart Morgan,stuart@tase.co.uk


The Timeout Command (-T)

All grabber scripts must return two timeout values when run with the '-T' argument. The command returns a comma separated list of information lifetime, and web response timeout, in seconds.

#./bbccurrentxml.pl -T
7200,30


The Field List Command (-t)

All grabber scripts must return a list of available data fields, one per line, when run with the '-t' argument.

#./bbccurrentxml.pl -t
cclocation
station_id
copyright
observation_time
weather
temp
relative_humidity
wind_dir
pressure
visibility
weather_icon
appt
wind_spdgst


The Location Search Command (-l <location>)

All grabber scripts must return a list of possible location matches, one per line, when run with the '-l' argument. The matches are an identifying string to be used with the data string, and a description, separated by a double colon.

#./bbccurrentxml.pl -l Cincinnati
407::Cincinnati, Ohio
3231::Cincinnati/Northern Kentucky International, Kentucky


The Directory Option (-d)

use unknown... for radar image downloads?


The Data Command (-u <unit system> <location string>)

A grabber script with called without any of the above options must take a unit system, and a location, and return data for each of the fields listed by the '-t' command. The Location will be that provided by the '-l' commands, and the unit system will be one of 'SI' or 'ENG'. Data is returned, one value per line, separated from the identifying string by a double colon.

#./bbccurentxml.pl -u ENG 407
appt::NA
copyright::From bbc.co.uk
station_id::407
cclocation::Cincinnati, United States of America
observation_time::Thursday at 13:00 EST
weather::Grey cloud
weather_icon::cloudy.png
temp::43
wind_dir::E
wind_spdgst::9 (NA)
relative_humidity::65
pressure::30.5321117
visibility::10-20

Valid Data Types

cclocation Descriptive name of location Text
relative_humidity Percent humidity Integer
pressure Barometric pressure Float
wind_spdgst Wing speed (gust) Integer
wind_dir Wind direction Cardinal
visibility Integer/Range
appt
temp
weather
weather_icon
observation_time
copyright
3dlocation
6dlocation
date-<n>
icon-<n>
low-<n>
high-<n>
updatetime
18icon-<n>
temp-<n>
pop-<n>
swlocation
alerts can have multiple lines
forecastdate
tempforecast
condforecast
todaypic
location

}