Page 1 of 2

Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 2:08 am
by Chewielewis
Im working on a project where i want to split the files im working with into Episode folders.

Each episode is worked on for a week and starts every wednesday. I'd like to be able to set a variable that has the episode number so I can put them into the workflow so files processed on a certain date will go into that episodes folders.

Whats the best way of doing this, I know I can generate the episode number from an excel formula.

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 8:03 am
by ThomasM
Hi Chewielewis,

FFAStrans is sensitive to Filenames and Dates in the variables-part of the nodes. Maybe you can use this:

Are the episodes completed on the same day you want to bring them into order? So you could use the creation-date in the File-Properties in the VARIABLES-menu.

Are the episodes named after or contain the correct date in the filename? so you could use FUNCTIONS ( $left() or $right() or RegExt() for example).

cheers,
tom

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 11:57 am
by momocampo
Hello Chewielewis and welcome to the forum!

As ThomasM told you, you can use file properties to populate variables you want. Each file can be sorted by creation date and move in a specific folder (even create the specific folder). If the files monitored have episode number in name, it will be even easier.
Please tell us more to help you .

Cheers.

benjamin

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 7:26 pm
by Chewielewis
There’s no information on the file names, these workflows will be for converting video clips from YouTube and other sources.

What I need the variable to do is to look at the current date and set an integer (I.e. 01,02,03) which I can put into the file destination e.g. “D:/Transcoding/Episode %epnumber%/

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 8:41 pm
by momocampo
Hi Chewielewis,

Ok I begin to understand what you want to do but the question is what is the link between current date and episode number? Do you mean the episode number is the date of day? Or can we use the number of the week to apply on each episode? (cause you told you work on 1 episode by week)
Give me your link and I give you the process.

Thanks and cheers ;)

B.

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 9:49 pm
by Chewielewis
We start working on an episode every Thursday. for that 7 day period I want all the files to be processed into a folder for that week, then move to the next folder from the following thursday.

30/01/2020 - 06/02/2020 Episode 01
07/02/2020 - 13/2/2020 Episode 02

and so on.

I know you can do REGEX to populate variables, but can you use excel style formulas?

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 10:07 pm
by emcodem
Hey Chewielewis,
You cannot access/execute/automate excel functions easily from external software like ffastrans. The only way for us to help you with that is if you found a commandline tool that somehow executed your excel calculation. In my example below, i use powershell for it.
I imagine there are many ways to get to your goal, even without your excel. It depends a little on what other "userinput" you carry in your excel.

Do you know basics of working with variables, e.g. use a populate variables processor to do your calculation.
Let us start with an example for "forward production", so you process a new episode when directly after it was recorded:
In Populate Vars proc, on the right side, use:
%i_week% for the current week number (i_week is the number of week in the year e.g. 52 for the last one)
or
%i_week%-5 to subtract 5 from the current week. (next year you would need to change it to %i_week%+52-5)

But I believe you maybe want more than that, so here is e.g. a way that allows you to enter one starting date (to identify the week that carries Episode number 1) and subtracts this starting date from the current date. The result is a count of weeks since your starting date.
Day_Diff_Demo_094.xml
(5.87 KiB) Downloaded 389 times
In this demo workflow, i use 2 processors:
1) Command executor

Code: Select all

cmd /C "powershell -Command "(New-TimeSpan -Start (Get-Date -Date "01/01/2020") -End (Get-Date)).TotalDays" > "%s_job_work%\date.txt"" 
2) Populate variables

Code: Select all

$roundd($stripcrlf($read("%s_job_work%\date.txt")))
In the first one, you can change "01/01/2020" to the day that identifies episode 1. Be aware that it uses a temp file to pass on the output of the commandline.
The second one, i just read the file from the first one, strip newlines and round it down.

Let me know if that goes in the right direction and please know that as "we" are not "you", we don't have the slightest clue about what you want to do, we are dependent on the information that you give us, otherwise we can just guess...

EDIT: Sorry, the uploaded workflow outputs DAYS instead of weeks. Change the commandline executors code to this to get the days (just divide days by 7)

Code: Select all

cmd /C "powershell -Command "(New-TimeSpan -Start (Get-Date -Date "01/01/2020") -End (Get-Date)).TotalDays/7" > "%s_job_work%\date.txt"" 

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 11:12 pm
by emcodem
@Chewielewis
Besides that, depending on your skills, you might be able to automate aksing your excel for stuff like that:
https://stackoverflow.com/questions/590 ... ula-result

If you can do that, i can show you how to use the resulting powershell with the commandline executor

Re: Put files in episode folders based on date range

Posted: Tue Jan 21, 2020 11:59 pm
by Chewielewis
The Workflow provided above seems to do the trick perfectly. Cheers

Where abouts should i put these nodes. There will be many sources and many destinations in this one workflow.

Re: Put files in episode folders based on date range

Posted: Wed Jan 22, 2020 8:41 am
by emcodem
Nice!
Could you come up with an educated guess about whats "many"? e.g. 20 or 100?
And do you want to go with "watchfolders", so each clip is processed when it is "recorded" or do you prefer to "kick off the processing" for a a full series manually?