Page 1 of 1

Monitors - Folder-Node: Check for growing files behaviour

Posted: Thu Apr 02, 2020 7:51 am
by ThomasM
Hi there,

here I have a problem, maybe I misunderstand something.
In the following Workflow I want to permanently check (every five seconds) if a new File is being written:
Check new Recording.json
(6.3 KiB) Downloaded 405 times
The new Files are being written by REAPER.

The Background:
My approach is to use REAPER as a digitisation-platform for parallel recording for up to eight stereo-sources. It is possible in REAPER to punch in / out while recording per (stereo-)Track via the REC-ARM on the track. Each time a punch-in is done a new *.WAV-File is being written.

The workflow above should recognize the appereance of this ne file and ask the user for scanning a specified Barcode for this digitize-process of the given media.

I have the problem that on either setting of "Check For Growing Files" or even disabling it, the workflow reacts only after PUNCH-OUT or Stopping the recording.

So - is it true that FFAStrans Monitor-Folder-Node always checks for growing files?
Is it possible to get my idea done with FFAStrans?

Thanks for any input,

regards
tom

Re: Monitors - Folder-Node: Check for growing files behaviour

Posted: Thu Apr 02, 2020 1:05 pm
by admin
Hi tom,

Independent of the growing file functions, the "Folder" monitor will always check if the discovered file is ready to be read. If the file is locked by another process, or in another way not readable, FFAStrans will wait until the file is readable. FFAStrans cannot process a file it cannot read so this is a logical behavior.

So, is it possible to get your idea done with FFAStrans? Probably not if you use the monitors. Only if you submit files either from the gui or through the api, FFAStrans will try to do what ever your workflow is programmed to do. This does not mean it will work but it might. The safest bet in this regard is probably just do what ever you need to do by executing custom commands by using the "Command executor" node.

However, MXF-files or other "nicely" growing files might be the exception to the rule.

-steinar

Re: Monitors - Folder-Node: Check for growing files behaviour

Posted: Thu Apr 02, 2020 5:59 pm
by emcodem
We have the scheduler of the webinterface for these kind of matters, i'll write a little script for you Thomas :-)

Re: Monitors - Folder-Node: Check for growing files behaviour

Posted: Fri Apr 03, 2020 9:47 am
by emcodem
@ThomasM

OK, i needed to update the webinterface scheduled jobs slightly in order to support this but now it looks very promising.
Please update the webinterface server.exe (link in the webinterface thread on the forum).
On the webui, open the job scheduler and create a new job, on the right side, select the workflow that you want to start.
Then edit the created job by hitting the "condidion" button on the top and insert this code:

Code: Select all

var watchfolder = "c:\\temp";

console.log("Watching ",watchfolder);
var fs = require("fs");
fs.watch(watchfolder, (eventType, filename) => {
	var fullname = watchfolder +"\\"+filename;
	try{
    	if (eventType=="rename" && fs.existsSync(fullname)){
        	console.log(fullname,"was created or renamed target file");
            //start the ffastrans job
          process.send([fullname]);
        }
    }catch(e){
    	console.error(e)
    }
})
Make sure to edit the first line to match your watchfolder - as you see you need to put 2 backslashes instead of one.
What happens is that - as soon as the job is started, the watchfolder will be watched and as soon as a new file arrives, a ffastrans job should be started.
The "frequency" of the scheduled job should be set to one minute - this will make sure the job is started latest one minute after the webserver service was restarted.

Sounds complex but it isnt;-)

Re: Monitors - Folder-Node: Check for growing files behaviour

Posted: Sat Apr 04, 2020 12:35 pm
by ThomasM
@Steinar
Thanks a lot for clearing things up.
Good to know how things work under the hood!

Stay safe,
regards
tom

Re: Monitors - Folder-Node: Check for growing files behaviour

Posted: Sat Apr 04, 2020 12:53 pm
by ThomasM
@Emcodem

Hi emcodem,

Thank you for this nice work. I will give it a try!

For now I start a PowerShell-skript (with the help of Evgenij Smirnoff from the MS-Technet-PowerShell-Forum...) that monitors actions in the directory in question. This skript writes a .LOG-file with the same name of the detected .WAV-File in the specified Directory. So here is the point where FFAStrans can start to operate. Works nice so far...

All the best,
stay safe!
regards,

tom