Own variables, data type "list"?


I just started modifying my data in Picard using script. Many thanks to @rdswift who helped me with a lot of patience in my beginnings. :blush:

The two scripts I currently use can be seen here.

I’ve read a few posts on scripting in the forum now and I’ve noticed that one topic keeps coming up. The interception of word phrases like “Feat.”, “feat”, “ft”, … which connects the main performer with a guest performer.

I know a little Python, but are only basic skills!

Here I would write the pharses in a list and iterate over the values to split them. Is there a similar data type in Picard’s scripting language?

with best

1 Like

First a bit of history. In times gone by Musicbrainz often had the featured artist in the title of the track rather than as an artist credit. These days, the style guide says that featured artists should be in the artist credits. I am not sure whether any of the old-style records still exist in the MusicBrainz database, but it is possible. There are some (ancient) Picard plugins that are designed to fix this, and convert track title to artist credits.

In essence, you would need to check the %artist% string for containing “ft”/“feat”, and if so do an iterative comparison with the %artists% multi-value variable to see what the previous and following artists were and then make whatever changes you wanted.

It is probably worth reviewing the plugins available to see if there is one which does what you want. If not, you can probably achieve it with a complicated Picard script, but IMO it might actually be easier to write a small plugin to do it.

Thanks for the tip. I’ll check here for available plugins:

Are there any other sources for plugins or should you limit yourself to these (official?) plugins?

ok, the PlugIn:

Feat. Artists Removed

does the job. At least after a first test with a few directories.

I have to search in my collection but I think there is also:

[Somebody] vs. [Another]
[Somebody] goes [Another]
[Somebody] battle [Somebody].
[Somebody] meets [Another]

Logically, the PlugIn cannot catch these cases. Did I understand you correctly that I cannot store the text patterns to be removed in a variable (list, Arryay) and then work with them in the script?

I have seen here in forum some scripts in which the patterns were hard coded more or less extensively in the condition. Which leads me to believe that this is the only way it works.

You can set up a multi-value variable with the list of join phrases to check, and iterate through them using the $foreach() script function. Assuming that you want to remove the featured artists from the track titles, you could have something like the following in a tagging script:

  Set list of join phrases to check,
  separated by a semicolon and space.

  These should be set in the order that
  you want them processed, because the
  processing will stop after the first
$setmulti(_joiners,ft; feat; vs; goes; battles; meets)

    Note that there is a space before the %_loop_value%
    to avoid finding a match in the middle of a word.
  $set(_location,$find($lower(%title%),$lower( %_loop_value%)))
    $noop( Set flag so the title is not trimmed further. )
    $noop( Trim the track title. )