Is There an Action to Move Certain Words If Present To Another Field?

Hi,

I use the Comment field to store record label information, but also keywords to generate smart playlists. There maybe up to 25 of these keywords and they are typically SOUL, DISCO, NME500A, RS500A, etc. I now want to split record label info and keywords into different fields. Obviously, record label information is unique to each album and song, and also follows different naming patterns, so it would be impossible to target this for an action. However, keywords are consistent and repeat many times over thousands of songs and albums. As a first step in splitting, is there an action that would search for and move any keywords specified by me, if they occur, from the Comment field to the Contentgroup field? I would prefer if the action ADDS the keywords to the Contentgroup field, rather than displaces whatever text is already there. Naturally, if I could incorporate all the different keywords in the one moving action it would eliminate the need to perform the action many times for each keyword.

Unless there is a pattern that allows to separate the part that should be moved from the part that should stay, I do not see very much hope to avoid the tedious way.
So, e.g. if the last part of the label information would always be a number, that would be a valid separator...
Or if the label information is always the first word or words ...
Something like this.

Hi,

Thanks for the reply and letting me know the difficulty that this task poses in terms of scripting. I can perhaps deal with 60% as there is only one keyword at the end of the field and I can use one of the quick actions I have learned, but for the last 40% there is no discernible pattern or separators, and this will be a hard slog to say the least. However, I appreciate your help in this.

I just realised that you were answering specifically the last part of my question which dealt with moving all the keywords in one go. Therefore, is there a script for searching and moving just ONE keyword amongst many from the Comments field, no matter where it occurs in the field? If at least I can achieve this it will save some time. Again, having the keyword added to the destination rather than replacing the contents (which may already be populated by other keywords), and deleting it from the original Comments field would be most desirable.

e.g. Comments Field is: RCA 45376 OZALB Disco RS500A NME500A
Contentgroup Field is: Dance Funk

  move Disco from Comments to Contentgroup

So now Comments Field is: RCA 45376 OZALB RS500A NME500A
and Contentgroup Field is: Dance Funk Disco

It is always difficult to discuss just theories.
So if you find perhaps some of the troublesome examples and post them, perhaps someone else can think of a solution...

1 Like

This looks like a one-time project.
You could filter the files for every keyword and apply 2 actions for each.

For example:
Filter: %comment% HAS keyword1

Remove keyword1 from COMMENT field: use "Replace" action
Field: COMMENT
Original: keyword1
Replace with:

Add keyword1 to CONTENTGROUP field: use "Format value" action
Field: CONTENTGROUP
Format string: %contentgroup% keyword1

You could create an action group that used the 2 actions for each keyword, but it might take longer to de-bug the action group than to use the "brute force method"!
And it might be necessary to use some logic that prevents a keyword from being added more than once.

E.g. this regular expression extracts one word that starts with a capital letter followed by lower case ones:
$regexp('RCA 45376 OZALB Disco RS500A NME500A',(.*) (\u.\l*) (.*), $2)
gives "Disco"
So with 2 actions, the first to add the word from COMMENT to CONTENTGROUP:
Format value for CONTENTGROUP
Format string: %contentgroup% $regexp(%comment%,(.*) (\u.\l*) (.*), $2)

and a second to cut the word from COMMENT:
Format value for COMMENT
Format string: $regexp(%comment%,(.*) (\u.\l*) (.*), $1 $3)

Perhaps that works for a couple of cases.

Thanks very much for these suggested actions. They worked in both instances, and from this I should be able to create a group action which repeats the actions, but with different keywords. This will save me a lot of time, for which I'm most grateful.