Page 1 of 1

Creating a local file copy

Posted: Fri 17 Mar 2023 11:31 pm
by Colin99
This is a question about Mark's "Announcement" notes on 8th March re Build 3231.

Firstly I should say this is another excellent job, as always. I actually picked up the subsequent patch release (Build 3235) today and this was my first update since 3149 in October 2021. Given there were some significant changes since then I was a bit worried, but everything worked fine as usual (albeit I am still using SFTP uploads of complete JSON files to my remote webserver for now anyway - PHP Upload might come later!).

My question is about the mention in the above note about Extra (web) Files, and Mark's 2nd suggestion to "Add an additional file entry (before the uploads) to create a local copy for subsequent uploads to use." I am wondering what medium this refers to (i.e. where should I add such an entry)? If this is referring to the Extra Web Files section in Settings, it does not have a Create Copy column.

I should explain that I previously used Extra Files to process a small json template at the Realtime interval to provide a few data items for a home weather display panel running locally off the raspberry pi, including things like cpu temp, system uptime, packet counts and errors etc. Don't laugh, I'm sure there is a better way of doing this, but my javascript skills are not great, and I couldn't figure out how to bend any of the local interface scripts to pick up my items! So I simply ticked the "Process" column but not "Upload" so the .jsontmp file it produced could be parsed by a small script I created by copying part of the setpagedata script. Now that local tmp copies are no longer produced, this has stopped working. I can see that the various standard interval files can be configured to create copies, but not the extra ones. Or is there a way to set a local directory for the file upload destination somehow?

Re: Creating a local file copy

Posted: Sun 19 Mar 2023 5:40 pm
by mcrossley
If you are just processing a template file once and copying it somewhere there is no need to create a 'local' copy of it. Just copy it direct to the destination.

Extra Web Files does not have a "Create local" option, because that is what not tick upload does, it creates a copy (processed or not) of the source file wherever you want.

Re: Creating a local file copy

Posted: Sun 19 Mar 2023 6:30 pm
by Colin99
Thanks for confirming that Mark. That is exactly how I thought it (was) working. My Extra Files were configured like this.
extra files.jpg
The 3rd one in the list is the one I just wanted to be processed (i.e. populated with values) and kept locally for my script to access. So with upload unticked, that is exactly what used to happen. From Build 3231 my understanding is (please correct me if I am wrong) that although the standard files still work this way by default, Extra Files no longer create a local processed copy (in this case paneldataT.jsontmp). It is certainly not being created where it used to be in the source (Local Filename) directory.

I probably misunderstood the wording of your announcement, but I took it to mean there was some way of processing the file and saving that result locally in the Pi somewhere. Is there any way I can achieve this or is it just no longer possible?

Re: Creating a local file copy

Posted: Mon 20 Mar 2023 1:15 pm
by mcrossley
Colin99 wrote: Sun 19 Mar 2023 6:30 pm I probably misunderstood the wording of your announcement, but I took it to mean there was some way of processing the file and saving that result locally in the Pi somewhere. Is there any way I can achieve this or is it just no longer possible?
Yes, just set the destination path to where you want the local copy and do not tick upload.

Re: Creating a local file copy

Posted: Mon 20 Mar 2023 3:23 pm
by Colin99
Ah OK, sorry Mark. That was the bit I wasn't understanding for some reason (Destination Filename becomes local when Upload unticked).

Sorry for being thick!

All fine now.

Thanks again.