Another enhancement to Galleon’s weather app

closeHey, just so you know ... this post is now about 16 years and 8 months old. Please keep that in mind as it very well may contain broken links and/or outdated information.

Last month after fixing a problem in Galleon’s weather application it was pointed out to me that my fix displayed the 100-mile radar map whereas originally Galleon had shown the 600-mile map.

Well, I decided to take a crack at coming up with a solution for that as well. This gave me an opportunity to dive a bit deeper into the java code and also learn how to use the TiVo HME SDK simulator. It was a fun little project (even though I hate regular expressions sometimes ;-)). The end result?

weather-app-12-786646

As you can see from the screencap above, I added a new control to the configuration dialog that allows you to select the range of local radar image displayed based on the three major maps available from weather.com for a location.

Note that some locations don’t have all three ranges available (90210, as an example, doesn’t have a 100-mile range map). If you select an unavailable range, the default range map will be displayed instead (whatever you would get by going to www.weather.com/weather/map/zip).

At a high level, here’s what my enhancement (to determineLocalRadar() in WeatherData.java) does:

  • grabs the HTML page at www.weather.com/weather/map/zip
  • searches the text and looks for “Doppler_Radar_range
  • builds a new URL to get the proper page with the local radar image (www.weather.com/weather/map/zip/?mapdest=Doppler_Radar _range_Mile:location)
  • grabs the HTML for that second page and finds the URL of the actual map image
  • downloads the map image like before

Additionally, I had to make small related changes to Weather.java, WeatherConfiguration.java, and WeatherOptionsPanel.java (in order to add the control to the page, retrieve the settings from configure.xml, etc.). I also fixed a bug that (I think) was causing the current weather and 5-day forecast data to not always refresh properly (at least for me during my testing).

Known issue: apparently the weather app only loads its values from configure.xml when it first starts up. As a result, if you make a change to any of the settings (city, state, zip, etc.) it won’t take effect until you restart Galleon. The same goes for the new range setting: if you change it in the GUI be sure to restart the application so you’ll see the new range map on your TiVo.

Since this was an actual enhancement to the application, I took the liberty of bumping the version number to 1.2. To install, just download my new weather.jar file, put it in Galleon’s apps directory, and then restart Galleon. If you prefer to compile it yourself, you can grab a zip file with my code, or check out the diff results.

If you run into any problems, or have anything else to say about this enhancement, let me know in the comments section!

Leave a Reply

Your email address will not be published. Required fields are marked *