Your solution looks like a sensible one. Unfortunately, Matthew, Gary, and I are all traveling, so we have no way of testing this. However, to make sure it does not get forgotten, I've started issue #290 <https://github.com/weewx/weewx/issues/290>.
Thanks for your contribution! -tk On Fri, Dec 1, 2017 at 11:44 PM, John Smith <[email protected]> wrote: > I wanted to create a yesterday report similar to the today report, which > worked ok, but it kept generating images even though I had stale_age for > the report. I fixed this by adopting the stale_age code from > cheetahgenerator.py and putting in a slightly modifies imagegenerator.py > > I've no idea how to do pull requests so here is a diff > > --- imagegenerator.py.old 2017-11-23 00:36:48.000000000 +1100 > +++ imagegenerator.py 2017-12-02 16:21:22.767704720 +1100 > @@ -83,7 +83,19 @@ > # Check whether this plot needs to be done at all: > if skipThisPlot(plotgen_ts, ai, img_file) : > continue > - > + > + # skip files that are fresh, but only if staleness is > defined > + stale = to_int(plot_options.get('stale_age')) > + if stale is not None: > + t_now = time.time() > + try: > + last_mod = os.path.getmtime(img_file) > + if t_now - last_mod < stale: > + syslog.syslog(syslog.LOG_DEBUG, > "imagegenerator: Skip '%s': last_mod=%s age=%s stale=%s" % (img_file, > last_mod, t_now - last_mod, stale)) > + continue > + except os.error: > + pass > + > > This is my first attempt at python coding so please be kind :) > > -- > You received this message because you are subscribed to the Google Groups > "weewx-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "weewx-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
