Monitor folder for additional file

Use this forum to request features. Maybe you'll get lucky!
Post Reply
Noqras
Posts: 40
Joined: Mon Dec 16, 2019 4:32 am

Monitor folder for additional file

Post by Noqras »

Right now I'm working on a workflow that monitors a watch folder for a video, sets some variables, holds waiting for an SSA subtitle file and then encodes. The problem with this is that, as far as I know, I have to know the exact filename of the SSA file that I'm holding for, but I want to be able to grab the SSA and generate some variable from it and I don't know the exact name.

I don't think I can use 2 monitors at the beginning one for video one or subtitles and then move them to a common folder and then encode, at least that didn't work for me in my initial tests as the second monitor never picked up the SSA file.

One feature I thought of in Telestream Vantage that allows this is the Associate action. You can put this in the middle of a workflow and it makes the workflow wait while watching a folder for an additional file with its own accept pattern that allows wildcards and generates variables and everything when it sees it, the workflow moves on now with a variable set of the name and path of this secondary file. Basically a monitor that you can put in the middle of a workflow that waits for another file and puts its file path and name into a variable.

Just throwing it out there, this would be an awesome processor to have in FFAStrans!

Of course, maybe there is already a workaround for this! Thanks for listening.
FFAStrans 1.2.0
HP DL360p Gen8 - 2x Intel Xeon E5-2670 - 32GB RAM
2x HP SL230s
Windows Server 2008 R2 SP1 64-bit
emcodem
Posts: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: Monitor folder for additional file

Post by emcodem »

Hey @Noqras

thats an absolute valid request, we already had some discussions about that Monitoring for Files has more or less indefinite flavours. The first outcome of our thinking in that direction was the scheduled jobs on the webinterface but it requires some serious scripting, example here: viewtopic.php?f=5&t=1019&p=4851&hilit=node+script#p4822

In the end we need to split off the registration of watchfolders from the workflow itself so you can have e.g. 100 Watchfolders all starting the same workflow. I am certain that along with this, we will find a way how to customize the detection of files allowing actions as you describe and much more.

Another thing that you could currently do is to have a batch looking for the sidecar file that you want and if the test is negative, return an error to ffastrans. On the Error path in the workflow use the "remove cache entry" feature and use a conditional node with "dispel" activated so the job will not be listed in the list of jobs anymore.
emcodem, wrapping since 2009 you got the rhyme?
Noqras
Posts: 40
Joined: Mon Dec 16, 2019 4:32 am

Re: Monitor folder for additional file

Post by Noqras »

Using a batch script could be workable for me, I'm going to develop something along those lines, any idea how I would get the found filename of the SSA in my case into a variable so that I can call that in the SSA input in ffmpeg?
FFAStrans 1.2.0
HP DL360p Gen8 - 2x Intel Xeon E5-2670 - 32GB RAM
2x HP SL230s
Windows Server 2008 R2 SP1 64-bit
Noqras
Posts: 40
Joined: Mon Dec 16, 2019 4:32 am

Re: Monitor folder for additional file

Post by Noqras »

Actually I just realized, I happen to be using the command executor processor for my FFMPEG instance instead of the Custom FFMPEG processor, so I could just build finding the SSA file into that script, put its name into a batch variable instead of an FFAStrans variable and then call ffmpeg in the same script.

Thanks for the idea!
FFAStrans 1.2.0
HP DL360p Gen8 - 2x Intel Xeon E5-2670 - 32GB RAM
2x HP SL230s
Windows Server 2008 R2 SP1 64-bit
Noqras
Posts: 40
Joined: Mon Dec 16, 2019 4:32 am

Re: Monitor folder for additional file

Post by Noqras »

Wait no, then everything would have to be in a batch file and I'd be using FFAStrans in the barest of its capabilities basically. I guess I was thinking that I could somehow get a variable from a batch script into a command executor which I think is crazy.

Edit: I figured out how to use STDOUT from the batch script and set that as a variable in the command executor, works great!
FFAStrans 1.2.0
HP DL360p Gen8 - 2x Intel Xeon E5-2670 - 32GB RAM
2x HP SL230s
Windows Server 2008 R2 SP1 64-bit
emcodem
Posts: 1643
Joined: Wed Sep 19, 2018 8:11 am

Re: Monitor folder for additional file

Post by emcodem »

Sorry, i was not sure initially if i understood what you want to do.
Happy that you found my addition to the command executor :-)

Is it now working as expected for you? - what are you doing, let the job run and wait for the secondary file to arrive?
emcodem, wrapping since 2009 you got the rhyme?
Noqras
Posts: 40
Joined: Mon Dec 16, 2019 4:32 am

Re: Monitor folder for additional file

Post by Noqras »

Yeah, there are a few things I'm doing as a bit of a workaround. I set up my watchfolder structure so that I can have a command executor run dir /b %path%*.mp4 to look for an mp4 and return the path and filename setting STDOUT to a variable, if this is false and there is no *.mp4 then it goes to a hold sleep for 5 minutes, and command executor clears the cache.

One issue with this though, my

Code: Select all

 %comspec% /c "if exist "%s_cache_record%" del /f /q  "%s_cache_record%""
does not delete the cache for the workflow anymore, I've confirmed this by checking the FFAStrans\Processors\db\cache\wfs inside the workflow folder and I see the history is still there. When I manually clear history from the monitor processor it deletes but I can't get command executor to do it anymore.

Any idea on this? I recently moved the ffastrans folder from the desktop to the C drive but I don't think there should be a permissions issue. Looks like if I do RMDIR and then point to the specific directory to delete it works, seems to be my %s_cache_record% variable stopped working.
FFAStrans 1.2.0
HP DL360p Gen8 - 2x Intel Xeon E5-2670 - 32GB RAM
2x HP SL230s
Windows Server 2008 R2 SP1 64-bit
admin
Site Admin
Posts: 1659
Joined: Sat Feb 08, 2014 10:39 pm

Re: Monitor folder for additional file

Post by admin »

Hi Noqras,

You are right. The %s_cache_record% is broken. Bug located and fixed. I'm going to release a new patch within the next few days.
Thanks for notifying! :-)

-steinar
Post Reply