Welcome Guest

Pages: 1
Append "Untitled" Titles
SineonlinePostJanuary 17, 2021, 06:17
Newbie
Posts: 23
Registered:
April 21, 2020, 14:44
Normal topicAppend "Untitled" Titles

Hi,

I'm struggling with using the 'Compare Text' function.

Having imported all the metadata I want from Discogs, Saved and Renamed Files & Folder, I then want an Action to compare the [Title] field against the text 'Untitled' and then append it with either (Remixed by [Remixer]) or [Track] (with a leading zero).

i.e. If the first track has the title 'Untitled', it will be changed to the following if Remixer is empty:
Untitled 01
If Remixer is not empty and has say 'Bitstream' in the field, the title will be changed to:
Untitled (Remixed by Bitstream)

The Action I've created to do this works fine IF I only select files whose titles = Untitled.
But if I have a whole album selected in the File List and any of the titles ≠ Untitled, no 'Untitled' track titles are appended.

I'm puzzled as to how if-else-endif actions only work if ALL selected files agree with the Compare Text parameters.

Reading the support file >> https://2manyrobots.com/YateResources/InAppHelp/CompareTextTestStmt.html << my brain just burns out. Similarly, I've read the help file on variables, as I dare say using them would help here, but that goes way over my head too. Unfortunately I struggle with word-intensive information without any practical examples to try out and learn from 🙁

I've tried using the Batch Processor, as I assumed that would run actions on a per file basis; therefore changing any file with an 'Untitled' title. But that's not working either. Likewise with setting up a Droplet. Everything works if and only if ALL files = TRUE.

Ideally, I'd rather add this action on to the end of my Rename Files & Folders action. This would ensure that for each new album I purchase, all untitled tracks will have something a little more identifiable in Traktor. I won't need to batch process my whole collection, as I muddled through with manually selecting the offending tracks last night. Definitely not a long-term solution though!

tl;dr - How do I get Yate to process files in my File List on a per file basis?

Thanks

2MR2PostJanuary 17, 2021, 10:08
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicAppend

You're running up against the parallelism of Yate actions. When an action starts executing, the action is run stepwise ... every step (or statement) is run against all files before proceeding to the next statement. This was designed this way about 12 years ago so that different things could be done to multiple files with a single statement.

For example when you append Remixed by remixer to Title in a single statement, every Title field will potentially end up with different content.

It was also designed that way to minimize statement execution through the interpreter. If you have a test sequence containing 5 statements and you're running against 100 files, it requires 500 statement executions to perform the operation when grouped. If the entire operation is the same for all files, only 5 statements will be executed.

However, there are times when you want to run grouped (one statement against one file). Typically this is due to a comparison.

The internal How Actions Execute help topic covers this. There is also a more extensive document available in the Documentation section of the resources page called Yate and the P Word which goes into more depth.

Note regarding the following examples: the mailer tends to strip out backslash characters. View the examples in the forum.

Example 1: At any given time you can make an entire action run grouped by placing a Force Grouped Execution statement as the first statement in the action. This variant is the worst if you have a lot of files loaded.

Force Grouped Execution
' Example 1: Fully grouped
Test if the Title field is equal to "Untitled" case insensitive (Set result)
if true
Test if the Remixer field is empty (Set result)
if true
Copy the Track field to Variable 0
Make Variable 0 numeric padding to 2 digits
Set the Title field to "Untitled \v0"
else
Set the Title field to "Untitled (Remixed by \[Remixer])"
endif
endif

Example 2: This variant runs completely stepwise.

' Example 2: Fully stepwise
Test if the Title field is equal to "Untitled" case insensitive (Set result and Variable 0)
Test if the Remixer field is empty (And result and Variable 0)
Ignore files where Variable 0 is false
if true
Copy the Track field to Variable 0
Make Variable 0 numeric padding to 2 digits
Set the Title field to "Untitled \v0"
Restore Initial Set of Files
endif
Test if the Title field is equal to "Untitled" case insensitive (Set result and Variable 0)
Test if the Remixer field is not empty (And result and Variable 0)
Ignore files where Variable 0 is false
if true
Set the Title field to "Untitled (Remixed by \[Remixer])"
endif

Example 3: This variant is a hybrid and only runs grouped for those files which initially have a Title field with Untitled as its value.

' Example 3: Hybrid
Test if the Title field is equal to "Untitled" case insensitive (Set result and Variable 0)
Run inline action 'Modify One File' grouped if Variable 0 is true

Start Modify One File
Test if the Remixer field is empty (Set result)
if true
Copy the Track field to Variable 0
Make Variable 0 numeric padding to 2 digits
Set the Title field to "Untitled \v0"
else
Set the Title field to "Untitled (Remixed by \[Remixer])"
endif

SineonlinePostJanuary 17, 2021, 13:01
Newbie
Posts: 23
Registered:
April 21, 2020, 14:44
Normal topicAppend "Untitled" Titles

Example 2: Fully stepwise
Test if the Title field is equal to "Untitled" case insensitive (Set result and Variable 0)
Test if the Remixer field is empty (And result and Variable 0)
Ignore files where Variable 0 is false
if true
Copy the Track field to Variable 0
Make Variable 0 numeric padding to 2 digits
Set the Title field to "Untitled \v0"
Restore Initial Set of Files
endif
Test if the Title field is equal to "Untitled" case insensitive (Set result and Variable 0)
Test if the Remixer field is not empty (And result and Variable 0)
Ignore files where Variable 0 is false
if true
Set the Title field to "Untitled (Remixed by \[Remixer])"
endif

Thank you so much!!! Example 2 works perfectly. And thank you for clarifying how the actions work. I was interpreting the help files in completely the opposite way (thinking grouped action was "Do this to a group of files" 😳 )

Now I understand the difference and how to use variables (he says, with a hefty slice of Dunning-Kruger), I think I can re-write my other actions that currently make use of nested if-else-endifs and, after checking against this slightly different use case, have shown similar problems I hadn't seen before.

Thanks again!
Rob

2MR2PostJanuary 17, 2021, 13:03
Avatar photo
Administrator
Posts: 2079
Registered:
August 23, 2012, 19:27
Normal topicAppend "Untitled" Titles

I'm glad it worked out for you. I desperately have to add a code snippet section to the resources web page.

Pages: 1
Mingle Forum by Cartpauj | Version: 1.1.0beta | Page loaded in: 0.029 seconds.