Welcome Guest

Pages: 1
Selectively removing the comment field
Gary-SwiftPostAugust 31, 2025, 06:03
Advanced
Posts: 70
Registered:
April 29, 2014, 06:12
Normal topicSelectively removing the comment field

I'm not sure if this is possible but here goes.

I want to selectively remove the comment field if it matches a pattern such as this:

00000000 00000210 000007B0 0000000000A6F440 00000000 005ACDB7 00000000 00000000 00000000 00000000 00000000 00000000
0000021A 0000028B 00001819 00002917 0002C014 0002C014 00005551 00005D1F 00016F0A 0000E9E0

iTunes generated these fields when I ripped my CDs a long time ago.

Here's my action so far:

Force Grouped Execution
' Remove iTunes generated comments such as:↵…
Test if the Comments field matches regular expression "^ [0-9A-Fa-f]{8,}(?= )" (Set test state and Variable 0)
Test if the Variable 0 field is not empty (Set test state)
if true
    Clear the Comments field
endif

Image

The issue here is that it removes all comments. I want to keep the comment that describes the album, but remove comments that begin with a pattern such as ' 0000021A '. These comments do not have a name or description. I'm happy with the regex also. It's just an issue with 'Clear' function.

Is there a way to do this?

2MR2PostAugust 31, 2025, 08:49
Avatar photo
Administrator
Posts: 2362
Registered:
August 23, 2012, 19:27
Normal topicSelectively removing the comment field

A number of issues here. First off the Force Grouped Execution statement is not necessary and multiplies the execution time by the number of selected files. Take advantage of the parallelism in Yate actions.

Your test after the regex statement is testing for not empty and it should be testing for true. The compare sets the result track variables to 0 or 1.

Most important the Clear statement does a deep clear of all selected fields which support more than one value. The Set statement only clears the default item.

Try the following:

1: Test if the Comments field matches regular expression "^ [0-9A-Fa-f]{8,}(?= )" (Set test state and Variable 0)
2: if Variable 0 is true
3: Set the Comments field to empty
4: endif

Statement 1 does your regex test on all active files.

Statement 2 reduces the number of active files to those where variable 0 is true. ie. everything until the matching else is only executed if the test was true.

Statement 3 is a Set statement which clears the default (unnamed) comment.

Gary-SwiftPostAugust 31, 2025, 10:28
Advanced
Posts: 70
Registered:
April 29, 2014, 06:12
Normal topicSelectively removing the comment field

Thanks.

I think I've gone too far with this one 😀

I'll retire this for now.

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