Help getting started with scripting

If you want Picard to automatically sort out your complete albums from the incomplete ones, then you have to give it something to work with in order to make that determination. The script that I provided attempts to do that, but it relies on you retrieving the release from MusicBrainz and match the files to the tracks on the release so that it has something to check for the $is_complete() test. Otherwise I believe that you really have only two options:

  1. Store all tracks as separate items, not grouped by album.
  2. Store everything in albums, even if not all the tracks are there for the album.

Picard is an amazing tool, but it can only work with the information provided.

Ahhhhh I see ! I thought that it could do without them being in the database. That the differentiation between clustered and unclustered files was enough… So there’s no way for me to create albums if they’re not in Picard’s database? Then I think I know what I would do : have a script on hand for saving individual tracks, and one for saving everything as albums. That way I can interchange depending on my needs.

I will try to figure out how to tweak the scripts on my own because I feel bad for having asked so much of your time already. :slight_smile:

Sure you can. It’s just that your script now makes a distinction to create a single folder for the album or save the files to separate folder with the $is_complete() function and with the value of the _primaryreleasetype variable, and both only makes sense for albums from MusicBrainz.

You could try with this small addition to the script:

$if($or($and($eq(%_primaryreleasetype%,album),$is_complete()),$eq(%_primaryreleasetype%,ep),$not(%musicbrainz_albumid%)),
%albumartist% - [$if2(%originalyear%,0000)] %album%/$if($gt(%totaldiscs%,1),%discnumber%-,)$num($if2(%tracknumber%,0),2) %title%,
%artist% - %title%
)

That now also checks the presence of %musicbrainz_albumid%, with the assumption that if this is not available you are saving unclustered files. It then also creates the album folder.

The script as it is then also should have the albumartist tag set, so make sure your files have that.

1 Like

Ok thanks for that! May I remove the ‘‘0000’’ year value though? It dates everything to ‘‘0000’’ instead of putting the release year.

Yes. Again, it’s because you’re not getting any release information from the MusicBrainz database to populate this. Picard really does work better when you match your files to releases in the database. I suggest that you have a look at the Recommended Work Flows section of the documentation, because I think that options 2 and 3 might apply to your situation.

1 Like

If your files always have the date tag, your could replace [$if2(%originalyear%,0000)] with this instead:

[$if2(%originalyear%,$substr(%date%,4))]

If you also want to handle the situation where neither originaldate nor date are set this would work:

$if($or(%originaldate%,%date%),[$if2(%originalyear%,$substr(%date%,4))] )
2 Likes

Also you might want to take a look at the naming script tutorial:

https://picard-docs.musicbrainz.org/v2.5/en/tutorials/naming_script.html

2 Likes

Please do consider adding missing releases to the DB - you will be helping everyone who comes after you greatly! After hitting ‘cluster’, right click the cluster > plugins > add cluster as release (you may have to enable the plugin in Picard > options > plugins first), and then fill out the couple of required fields and save. Shouldn’t take more than a few minutes.

No pressure, but if you have time it’s very satisfying to know that not only are you getting your tags sorted - you are getting everyone’s tags sorted! Time well spent :grin:

2 Likes