Louis,
I came up with a much simpler solution: I changed the cheetah generator
slightly so that *any* file can use the YYYY, MM, DD syntax.
So, now the syntax can be used under the [[ToDate]] section. For example:
[[ToDate]]
[[[today]]]
template = YYYY-MM-DD.html.tmpl
YYYY, MM, DD will be replaced by the "current" time.
NB: The tag 'today' is arbitrary. It's just there to separate the various
templates.
NB: This will slowly fill public_html with day files as time marches on.
Commit 5ce0894
<https://github.com/weewx/weewx/commit/5ce08946d9e43482334eb65bcecc92e6dfc503fc>
.
-tk
On Mon, Nov 28, 2016 at 9:29 AM, Thomas Keffer <[email protected]> wrote:
> BTW, if your problem is just a simple matter of getting the filename
> right, you could write a sed script that runs through skin.conf, changing a
> file name to today's date. Then run the script just after midnight every
> day.
>
> Something like (NOT TESTED):
>
> DD=$(date +%d)
> MM=$(date +%m)
> YY=$(date +%Y)
>
> sed </home/weewx/skins/Standard/skin.start
> >/home/weewx/skins/Standard/skin.conf
> "/TODAY/s/TODAY/$YY-$MM-$DD/"
>
> Where skin.start is a version of skin.conf, except it has a subsection
> that looks like
>
> [[ToDate]]
> # Report that will be written to a file with today's date as its
> name
> [[[today]]]
> template = TODAY.html.tmpl
>
> After running the sec script, this would become a skin.conf file with
> subsection
>
> [[ToDate]]
> # Report that will be written to a file with today's date as its
> name
> [[[today]]]
> template = 2016-11-28.html.tmpl
>
> -tk
>
> On Mon, Nov 28, 2016 at 9:11 AM, Thomas Keffer <[email protected]> wrote:
>
>> Well, the good news is that the Cheetah generator looks to see if the
>> file has already been generated. If it has, then, unless it's for the
>> current date, it skips it. So, you'd have to generate all those (hundreds?,
>> thousands?) of files only once.
>>
>> -tk
>>
>> On Mon, Nov 28, 2016 at 9:07 AM, Louis De Lange <[email protected]>
>> wrote:
>>
>>> Thanks, Tom.
>>>
>>> Yes I have already figured that this can generate lots of files, and
>>> that is not what I want. I only need to generate a file for the current
>>> day, but the website template I am trying to use requires the CSV file to
>>> contain the proper date in the name of the file.
>>>
>>> I could also modify the website template scripts to look for an input
>>> file name something like "todays_data.csv" but then it breaks compatibility
>>> with future website upgrades. Just trying to do things the "right way"
>>>
>>> I will try this out tonight and give feedback.
>>>
>>
>>
>