Conditional action


#1

I have an action to collect all standard fields values into a custom field and then wipe the standard fields...

... but how may I arrange it to operate only on tracks that it has not already operated on?

Thanks.


#2

You can filter the view.
You can check for an existing field.
Why do you collect many field's values into one field and remove the original fields?
How would you describe what is a standard field and what is a custom field?

DD.20100827.0345.CEST


#3

If it's an action group then it's not always easy. I've been asking for a special action that would exit an action group if a condition evaluates to TRUE. That way you could set up an action group that would only be executed conditionally, or could be partially executed.

Right now filtering is probably the cleanest way to do what you want.

Without filtering, one fairly cumbersome way is to use $if() statements that check for the existence of a field. The $if() would have to be included in the value for each action in the group and would only work for actions that set a value.

Action type: Format value
Field: MYCUSTOMFIELD
Format string: $if(%mycustomfield%,%mycustomfield%,%artist%;%album%;%title%;...etc...)

This would look for MYCUSTOMFIELD and if it already exists, will leave the value intact, else it will join those other fields. If your action group takes several steps to accomplish this then you'll need the $if() statement in each one.

A 'Remove fields' action can't be executed conditionally, but you can kludge something similar by setting a field's value to an empty string. Setting a field to an empty string will delete it.

Action type: Format value
Field: ARTIST
Format string: $if(%mycustomfield%,,%artist%)

This would check for the existence of MYCUSTOMFIELD and remove ARTIST if that field exists, otherwise it will leave ARTIST unchanged. You would need an action like this for each field that you want to delete.


#4

Sorry to be unclear. I meant automatically. I.e. in the action script.

I can find no way to do that in an action to meet the stated requirement.

To hide the metadata from the likes of Baidu, whilst retaining it for debugging.

Simply by referencing them:

Format value "CJJTAGS": %album% %discnumber% %track% ~ %artist% ~ %title%
Remove fields except "CJJTAGS"


#5

Thanks. That's the also least cumbersome way I have found :slight_smile:

Since my reply to Detlev, I find I can get away without that conditional:

Format value "CJJTAGS": $if(%cjjtags%,%cjjtags%,$list(,:","|))
Remove fields except "CJJTAGS'

The above is a slight compromise in that it copies all fields rather than just standard ones but this is acceptable, and worthwhile to simplify coding.

Thanks again, JJ and DD.


#6

The expression can be condensed a little bit:
Format value "CJJTAGS": $if2(%cjjtags%,$list(,:","|))
Remove fields except "CJJTAGS'

DD.20100828.0840.CEST


#7

Hi,
how can I escape the comma inside a if function
Basically I want to append the value of a tag if exist, prefixed with a comma, like this

%work%$if(%catalog no.%, , %catalog no.%,)$if(%movement%,: %movement%,)$if(%tempo%,. %tempo%,)

Thanks!


#8

how can I escape the comma inside a if function

No way I know...

Basically I want to append the value of a tag if exist, prefixed with a comma, like this

... but you can quote the string:

$if(%catalog no.%, ', %catalog no.%',)

Check you really do want that initial space.


#9

Thank chrisjj!
That works perfectly, and this is now the song title:
Piano Concerto No. 1 in C major, Op. 15: 1. Allegro con brio

And with the right if condition I will append the information only if I've tagged them
Cheers!