Rename Tag Name

I want to bulk rename (for all selected music files) the tag “Lyrics [Lyrics were Saved by MiniLyrics.]” to Lyrics, only if Lyrics tag does not already exists. Reference:

Any suggestions?

You might try something like the following in a tagging script.

WARNING: Untested code. Please work with a copy of your files to ensure expected results.

$if($and(%Lyrics [Lyrics were Saved by MiniLyrics.]%,$not(%Lyrics%)),
  $set(Lyrics,%Lyrics [Lyrics were Saved by MiniLyrics.]%)
  $delete(Lyrics [Lyrics were Saved by MiniLyrics.])
)
3 Likes

When I typed your code in Options → Scripting → Add New script. I get the following error:

Unexpected character ' ' at position 18, line 1

And I am not able to save it by selecting Make it so!

Okay, it seems that it doesn’t like the spaces in the %tag name% shortcut. Try this instead. It creates a temporary variable _minilyrics to get around this problem.

$set(_minilyrics,$get(Lyrics [Lyrics were Saved by MiniLyrics.]))
$if($and(%_minilyrics%,$not(%Lyrics%)),
  $set(Lyrics,%_minilyrics%)
  $delete(Lyrics [Lyrics were Saved by MiniLyrics.])
)
1 Like

I think it is:

$get(Lyrics:Lyrics were Saved by MiniLyrics.)

Because the square brackets is how Picard formats it for friendly display, but colon is used for internal representation. But check how it is spelled when you edit the tag in the edit tag dialog.

1 Like

Would that also need to be changed in the $delete() statement? I’ve never actually used that function.

EDIT: Another (strange) workaround is to set the string as a variable and then refer to the variable in the $get() (and $delete() ?) statements. Something like:

$set(_tag_with_spaces,Lyrics:Lyrics were Saved by MiniLyrics.)
$set(_minilyrics,$get(%_tag_with_spaces%))
...

That way the “Lyrics:Lyrics were Saved by MiniLyrics.” only needs to be entered in one place.