[mythtv-commits] Ticket #560: Increase mythweather load-up time significantly

MythTV mythtv at cvs.mythtv.org
Tue Nov 1 20:11:46 EST 2005


#560: Increase mythweather load-up time significantly
-------------------------------+--------------------------------------------
 Reporter:  mythtv at hburch.com  |       Owner:  ijr 
     Type:  enhancement        |      Status:  new 
 Priority:  minor              |   Milestone:      
Component:  mythweather        |     Version:  head
 Severity:  medium             |  -------------------------------+--------------------------------------------
 Currently, weather information is downloaded on demand.  This makes the
 start-up time quite expansive (about 8 seconds on my machine).

 This "patch" (more on that later) creates a new program: mythweatherupdate
 that downloads the weather data and stores it in GetConfDir()/MythWeather.
 Mythweather, instead of needing to download the data when starting-up, can
 utilize the cache when it exists.  This decreases the load time for
 weather data from 5-10 seconds under a second.  Backwards compatability is
 maintained (that is, if mythweatherupdate is not periodically run, weather
 data will still be displayed).

 == Details ==

 A new class, WeatherData, was created to hold the weather data.  This
 allows mythweatherupdate to access the data without needing to create a
 Weather object, which would attempt to create UI objects.

 Backward compatability is maintained.  If mythweatherupdate is not
 periodically run, for whatever reason, mythweather caches the weather data
 it downloads.  If the cache is less than 90 minutes old, it will be
 reused.  Otherwise, the data is downloaded and the cache refreshed.  90
 minutes was chosen for compatibility with hourly updates.

 Another change is that the animated radar image is created lazily.  That
 is, it is not created until the page changes to
 AnimatedImage->GetContext().  The creation of this image takes a noticable
 amount of time on my machine (~0.7 seconds), making the load time
 significantly longer.  If you passively watch mythweather, this time is
 difficult to notice (it stays on the screen before the radar image
 slightly longer), but it can be noticable if you use left/right to change
 screen.  In any case, you now pay the lag only if you have to.

 Because this is such a major rewrite, the "patch" is actually a tar ball
 of all the source code.  Changes to mythweather through patch set 7527
 (currently, the last change) are included.

 == Caveats ==

 This is a relatively large rewrite of mythweather.  Although little code
 in the mythweather proper changed, it has been reshuffled and one class
 between two classes.  I tried to be conservative in changing things, which
 has some consequences (one of which is that, unfortunately, resulted in
 Weather and WeatherData being friends).

 For cleanness, mythweatherupdate is dynamically linked against
 libmythweather.so. This means that it must be invoked with the plugin
 directory in LD_LIBRARY_PATH
 (LD_LIBRARY_PATH=/usr/local/lib/mythtv/plugins mythweatherupdate).  The
 old way was to recompile the source files in mythweather directly into
 mythweatherupdate.  It would be easy to change this back, but I was not
 happy with that.  The other alternative would be to soft link to
 libmythweather.so from $PREFIX/lib.  Not difficult to change.  Uncertain
 which would be most appealing to the maintainers (they may have a better
 idea that those), I left it as this, which is easy to change to either of
 the other two options.

 == Conclusions ==

 This enhancement "patch" makes mythweather almost instataneous to access,
 enabling one to quickly check the weather.

 (Sorry for the long ticket)

-- 
Ticket URL: <http://svn.mythtv.org/trac/ticket/560>
MythTV <http://www.mythtv.org/>
MythTV


More information about the mythtv-commits mailing list