Use folder name in script

Tags: #<Tag:0x00007f58f36eda68> #<Tag:0x00007f58f36ed900>

HI there: is there a way to use the information in a folder or in a genre in a renaming script. Something like if the genre is classical, then do this? If a track is in this folder, do this? Thank you

You could likely parse the %_dirname% variable and check for a desired genre and then use a $if() statement to conditionally execute part of the script. Have a look at the File Variables section of the Picard User Guide for more information.

1 Like

For genre you could use something like:

1 Like

If you want to use %genre% for this, then you need to:

  1. Have the correct options settings - in Options / Metadata / Genres, enable “Use genres from MusicBrainz”. I also recommend that you set “Fallback on album’s artists genres…”.

  2. Make sure that you don’t have a plugin that overwrite this variable, especially if it uses track genres rather than release genres (because if you use this in the path part of a file naming script you will get your albums scattered amongst multiple directories). AcoustBrainz Mood-Genre is one example of a plugin to avoid (though I do have a PR submitted to save the values so that you can use a script to restore them), but there may be others.

I also just checked my (relatively small) classical music directory to see how well genre would work to detect Classical music, and there were (from a purely subjective position) some anomalies - for example:

  1. Even MusicBrainz genres can be track by track - I have raised an enhancement request to allow you to see artist and release genres (which are consistent across tracks) as well as the combined genres.

  2. Some releases contain genres which are sub-classifications of Classical but not Classical itself - so you will nee to check for these. Examples in my collection include “Other Classical”, “Modern Classical”, “Opera”, “Chamber Opera”, “Minimalism”, “General Contemporary Era”, “Ambient”, “Soundtrack”, “Concerto”, “Symphony”.

  3. Album artist genres are only included when Release / Release Group don’t have genres. I have included an enhancement for this in the above enhancement request.

Bottom line: Picard isn’t yet ready to handle file naming paths using genres.

1 Like