Exclude files contained in a .txt list from transcoding

Questions and answers on how to get the most out of FFAStrans
Post Reply
DCCentR
Posts: 2
Joined: Thu May 04, 2023 7:15 am

Exclude files contained in a .txt list from transcoding

Post by DCCentR »

Hi all,

I want to add a check for all video files entering the monitoring folder. I want to exclude files contained in a .txt list from a transcoding workflow.

txt list look like that (each line is video file name):

HPT10104_V2023
HPT10106_v2023
HPT10107B
HPT20105
HPT40102
HPU10106_v2023
HPU20101_B_V2023
HPU20102
HRU80104B_V2023
HRU90101_B_V2023

I've tried it with "populate" & "for each" nodes, but didn't figure it out.

Is it possible to do that? Can someone give an example worflow with it?
emcodem
Posts: 1692
Joined: Wed Sep 19, 2018 8:11 am

Re: Exclude files contained in a .txt list from transcoding

Post by emcodem »

Hi @DCCentR,

welcome to the Forum and thank you for using FFAStrans!
You could just use the "deny files" input in the monitor processor and insert your list like this:

Code: Select all

HPT10104_V2023*|HPT10106_v2023*|HPT10107B*|HPT20105*|HPT40102*|HPU10106_v2023*|HPU20101_B_V2023*|HPU20102*|HRU80104B_V2023*|HRU90101_B_V2023
But that would be no fun at all because too easy, so let me show you how you can potentially deny the files specified in a text file:
emcodem_deny_files_in_text_list.json
(4.88 KiB) Downloaded 271 times
The first populate vars processor does all the magic:
  • read text file with list of deny patterns: c:\temp\deny.txt
  • replace "newline" character by *| to make it regex compatible (creating the same list i posted above)
  • apply the newly constructed regex, if any of the patterns matches, the output of this function will be the matched pattern. if none applies, the output will be empty
  • count the characters of the new string after the regex was applied.
After that, i use a conditional processor to check if the regex returned empty, in that case we go on with the worfklow. Note that i checked "dispel" here in order to delete the denied files jobs from the status monitor.

The regex part shortly explained:
Assume you have a deny file like

Code: Select all

a
b
First we transform to a*|b*, then we check if a or b is in the %s_original_filename%. If yes, the $regext function will return either a or b, if no, the regext will return nothing. So if regext returned nothing we can go on, otherwise stop.

I just realize that we can delete the * in the replace part so we end up with a|b instead of a*|b* but i guess it works for you this or that way.

Let me know any questions :D
emcodem, wrapping since 2009 you got the rhyme?
DCCentR
Posts: 2
Joined: Thu May 04, 2023 7:15 am

Re: Exclude files contained in a .txt list from transcoding

Post by DCCentR »

@emcodem, thank you so much! It's works as it should :)

I'd like to point out that I had to reverse the order in this expression:

$regext("%s_original_name%, "%s_temp%"") => $regext("%s_temp%", "%s_original_name%")

If this is not done, the result for conditional in both cases will be "true".


Thanks for this wonderful software, guys ;)
emcodem
Posts: 1692
Joined: Wed Sep 19, 2018 8:11 am

Re: Exclude files contained in a .txt list from transcoding

Post by emcodem »

Great, thanks for letting us know.

Well sure it works also the way you did reverse the regex match, it is even easier to understand this way. Well done :D
The limitation is that it does not work with deny patterns anymore but only when the full filename is contained in the deny list.

my version checked if
filename = pattern1|pattern2|pattern3

your version checks the other way around e.g.
pattern1|pattern2|pattern3 = filename

in your version, you actually don't really need to replace the newlines in the deny.txt anymore at all, so in the populate proc this line is not needed:

Code: Select all

%s_temp%= $replace('%s_temp%',@CRLF,"*|")
emcodem, wrapping since 2009 you got the rhyme?
Post Reply