Since I’m playing music on a fairly simple player, I’d like to tag my classical music with the composer as the artist (while recording performers in other tags). I’ve tried the following script:
$if($startswith(%genre%,Classical),$copy(artist,composer))
The $copy
works fine, but it happens for all tracks, not just those that have a genre that starts Classical. Am I misunderstanding how to use the $if
conditional here?
You do know that most classical music in MusicBrainz is already tagged with the composer as the track artist? If it’s not tagged that way, it should be corrected to follow the Classical Style Guide
Regarding your script, I’m not sure if this is the problem but it looks like it’s missing an Else.
No, you discovered a bug in $startswith
, it cannot currently be used like it would be expected. $if($startswith(%genre%,Classical),...)
is always true. This is a bug.
A workaround with $startswith
is:
$if($eq($startswith(%genre%,Classical),1),$copy(artist,composer))
Also the solution with startswith only works if Classical is the very first genre tag. It doesn’t matter if there is only one, but maybe you want to check if any tag is classical:
$if($inmulti(%genre%,Classical),$copy(artist,composer))
Update: Will get fixed in the next release, see https://tickets.metabrainz.org/browse/PICARD-1667
In the meantime $if
in combination with $startswith
, $endswith
and $is_complete
should be used in combination with $eq
check for “1”. Examples:
$if($eq($startswith(%tag%,something),1),...)
$if($eq($endswith(%tag%,something),1),...)
$if($eq($is_complete(),1),...)
Thanks for reporting
7 Likes
Classical Extras plugin was rewriting the Artist tag! I’ll need to look at the CE options to stop that happening.
1 Like