XML Metadata Input / File Name

Questions and answers on how to get the most out of FFAStrans
Post Reply
graham728
Posts: 30
Joined: Sat Oct 13, 2018 10:54 pm

XML Metadata Input / File Name

Post by graham728 » Fri Apr 12, 2019 8:24 am

Hi,

I was wondering if it would be possible to extract metadata from an xml and use it to add a suffix and prefix to the output file name?

Example:

Watchfolder > Hold (wait for MXF and XML with same file name) > Extract XML > Encode MXF to MP4 > Rename MP4 with Metadata > Move MP4 to Folder

The XML's in question is always the same file names as their MXF counterpart. The idea is to drop both into a watch folder at the same time and have the workflow encode the MXF to an MP4 and use metadata from the XML to rename the MP4.

I've attached an XML template we use. This is a standard DPP Broadcast sidecar XML. I've entered most fields with 'test'. It would be great to use the 'Advertiser' and 'Product' fields for the prefix and suffix.

Thanks.

momocampo
Posts: 349
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: XML Metadata Input / File Name

Post by momocampo » Fri Apr 12, 2019 8:36 am

Hello Graham,
I think you have to use the functions for your goal.
After your "hold", you have to populate variable (and several) and use the "between" function to "catch" what you want into the xml. Then, you will have the variable to use into prefix or suffix.
If you don't know how to do, please tell me and I will try for you :D

Cheers.
Benjamin

momocampo
Posts: 349
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: XML Metadata Input / File Name

Post by momocampo » Fri Apr 12, 2019 9:43 am

Here I come again,
It's my day of kindness, I give you a good workflow .
You just have to change the different path > Monitor folder and first populate variable path.
Set your H234 encoder too.
And delete or move your original files if you want.
Cheers.

benjamin
Attachments
GRAHAM_WF.xml
(12.1 KiB) Downloaded 55 times

graham728
Posts: 30
Joined: Sat Oct 13, 2018 10:54 pm

Re: XML Metadata Input / File Name

Post by graham728 » Fri Apr 12, 2019 12:00 pm

Hi,

Thanks very much for this! working perfectly. I'm not great and scripting but I understand enough to apply what you've supplied to amend for future use.

Thanks again! I've posted my workflow with a few additional nodes below if it helps out anyone in the future.
Last edited by graham728 on Mon Apr 29, 2019 12:02 pm, edited 1 time in total.

momocampo
Posts: 349
Joined: Thu Jun 08, 2017 12:36 pm
Location: France-Paris

Re: XML Metadata Input / File Name

Post by momocampo » Fri Apr 12, 2019 12:12 pm

Hey,
You're welcome !
I liked (and I always like) when someone can help me so if I can do the same thing I'm happy :D.
cheers ;)

Benjamin

graham728
Posts: 30
Joined: Sat Oct 13, 2018 10:54 pm

Re: XML Metadata Input / File Name

Post by graham728 » Fri Aug 09, 2019 3:13 pm

Hi,

I'm looking at this workflow again and I wondered if it's possible to have something like the following:

We use forward slashes in our 'Identifier_Value' field for commercial clock numbers and hyphens for sponsorships.

So a commercial clock in Identifier_Value looks like XXX/XXXXXX/XXX and sponsorships XXX-XXXXX-XXX

We identify if the clock is a commercial or sponsorship in the 'Material_Type' field as 'Commercial' or 'Sponsorship'.

Is it possible for FFastrans to look at the Material_Type and know if it's a commercial but contains hyphens in the clock 'Identifier_Value' to move the xml and mxf file to a 'Reject' folder and vice-versa for sponsorships that contain forward slashes in the Material_Type field?

I hope that makes sense?

Thanks

emcodem
Posts: 419
Joined: Wed Sep 19, 2018 8:11 am

Re: XML Metadata Input / File Name

Post by emcodem » Sun Aug 11, 2019 2:30 pm

Hey graham,
while @momocampo is away, i'll try to take care of this case :-)
unfortunately i did not find your uploaded example xml, so currently i can only give you a rough idea.

So, you say if your xml contains XXX/XXXXXX/XXX you want to go on normally but if it contains XXX-XXXXX-XXX then move the mxf and xml to a folder named rejected.
All you need for that is a "conditional" processor. On the left side, you can read the xml content and use regex to see if there is a XXX-XXXXX-XXX contained. On the right side, you just put in a "-".

Left side:

Code: Select all

$regext($read("%s_original_path%\%s_original_name%.xml"),"...(-)......-...")
Condition:

Code: Select all

not equal to (<>), string
Right side:

Code: Select all

-
You insert this conditional processor right after your hold node and connect its output to the populate variables node. This way, only XXX/XXXXXX/XXX will go to the transcode node.
To go on and move other mxf and xml files into the rejected directory, we will need to use the "error" path of the conditional processor i mentioned first and a commandline processor.

Let me know if you can follow or you are totally lost. Please know that i do not want to just set up your workflow and send it to you but also i want you to learn and understand how everything works together.

graham728
Posts: 30
Joined: Sat Oct 13, 2018 10:54 pm

Re: XML Metadata Input / File Name

Post by graham728 » Tue Aug 13, 2019 9:20 am

Hi,

Thanks for the help so far. I've attached an example of an XML that the workflow would read. TTP-TEST001-030.xml

The clock ID is in this field:
<id:Identifier_Value>TTP-TEST001-030</id:Identifier_Value>

I've inputted a dummy clock number. This clock number above is incorrect as it should be:
<id:Identifier_Value>TTP/TEST001/030</id:Identifier_Value>

__


With moving to an approved folder, could I not use a 'delivery node' instead of a command-line node?

What would the populate variables node contain? I do want to learn this part of FFastrans although I don't have much coding/scripting experience. Where is the best place to learn 'Regtext' ?

The 'TTP-TEST001-030.xml' is the xml to be read. Although the file name contains hyphens this is only because file names can't have / in them.

The <id:Identifier_Value> where the clock id is repeated is where it has to be TTP/TEST001/030.
Attachments
xml workflow.xml
(11.76 KiB) Downloaded 20 times
TTP-TEST001-030.xml
(2.43 KiB) Downloaded 23 times

Post Reply