SIMPLE TAG/RENAME/MOVE or is it?

musicbrainz
tags
rename
Tags: #<Tag:0x00007fe3cf4b6eb8> #<Tag:0x00007fe3cf4b6cb0> #<Tag:0x00007fe3cf4b6b70>

#1

Hi guys, of course I’m new and I have been searching the forum for answers. But MusicBrainz is so customizable that I have not been able to find a solution for me.

I just need to auto-tag, rename and move my files:

I need my files to automatically rename based on the tag as such: Albulmartist_Title_Grouping_OriginalYear_Language
This is what I have under file naming preferences: %albumartist%%title%%grouping%%originalyear%%language%

I have not been able to permanently add Grouping and Language to the automatic tag list for it to always comes up. These fields do not populate into the rename above.

I want all files moved to one folder. Given my preferred naming convention, I don’t need to separate into Artist/Album/Year folders etc. Since I’m not tagging all my files at once, what would MusicBrainz do if it found a duplicate in that folder?

The setup: Mac OS HighSierra, MusicBrainz version 1.3.2, lastfm plugin.

Thank you in advance for your help!


#2

You probably should add underscores or spaces between the tags, otherwise your file names will be hard to read.

The language tag will only be set, if there is a work related to that track and that work has the language set. For this to work you have to enable Metadata > Use track relationships in options.

Grouping is not populated by Picard. Try the Classical Extras plugin, I think it can fill that tag.

It will append numbers to the filenames.


#3

You might also want to use the $if2() function to put in a default value for %grouping% (e.g.: “No Group”), %originalyear% (e.g.: “0000”) and %language% (e.g.: “Unknown”) in the event that those tags are empty even using the Classical Extras plugin that @outsidecontext suggests (and I agree with him on recommending its use). Further information on $if2() and the other available functions can be found at https://picard.musicbrainz.org/docs/scripting/.


#4

Ah yes, I had the underscores and took them out for some reason to post them.

The classical Extras plugin does not work with my current Brainz version. I’m trying to install the newest Mac version but it’s not working. I’ve read there’s an installation issue after updating the Mac OS.

It would be easy to just insert Genre but I find this field to be have too many variables, Grouping simplifies things.
Perhaps I can put in temporary value for Grouping and Language then batch rename.

THANK YOU FOR YOUR HELP!


#5

Absolutely, thank you for the idea. Initially I didn’t want to get into the if statements but this will help minimize a headache down the road, I have over 200K songs.

Thank you for your help!


#7

Do you think this will work for my criteria? Thank you again.


#8

Looks like it should, but I offer a couple of suggestions:

  • Rather than %date% I would use $left(%date%,4) so that you only get the year. This would make it consistent with the four digits that you would get with the preferred %originalyear%.

  • In the case where the album artist is “Various Artists” you may want to show the track artist instead. This could be done by replacing your first $if2() with $if($eq(%albumartist%,Various Artists),%artist%,$if2(%albumartist%,%artist%))

The revised naming script would look something like:

$if($eq(%albumartist%,Various Artists),%artist%,$if2(%albumartist%,%artist%))_$if2(%title%,none)_$if2(%originalyear%,$left(%date%,4),6666)_$if2(%grouping%,%genre%,none)_$if2(%language%,none)

Hope that helps.


#9

Two amazing points. Thank you so much your revision works for me.

I was going to group all Various Artists and rename later on. Obvious newbie here.

My last question to yield a clean rename, how can I automatically delete unnecessary characters such as quotation marks, apostrophes, etc on each field (artist, title) before it renames the file?

Thanks again! I’m 98% ready to start renaming all my 200K files.


#10

There are two ways (at least). You could run each tag through the $rreplace() function or you could take the final result and process it through $rreplace(). Doing each tag separately really only makes sense if you want to strip different characters from each tag. Building on my earlier script, the new one would look something like:

$rreplace($if($eq(%albumartist%,Various Artists),%artist%,$if2(%albumartist%,%artist%))_$if2(%title%,none)_$if2(%originalyear%,$left(%date%,4),6666)_$if2(%grouping%,%genre%,none)_$if2(%language%,none),['"],)

The pattern used for the $rreplace() in this case consists of a string of all the characters that you want removed, enclosed in square brackets. Note that some characters (e.g.: comma, left and right parentheses) must be escaped such as “\(”, “\)” or “\,” if they are included in the pattern. Left and right square brackets must be double escaped as “\\[” and “\\]”.

Note that some characters will be automatically replaced by Picard to avoid special characters used by your operating system’s file system. For example, on a Windoze system, the colon and backslash will be replaced automatically.


#11

Wonderful, I’m definitely using your code. I’m 99% ready thanks to you. Have a great evening!


#12

Thanks for this, I didn’t know how to get rid of those apostrophe’s!

Here is my renamer setting which is similar to releases you see out there in the ‘scene’.

$rreplace($if2(%albumartist%,%artist%)/$replace($if2(%albumartist%,%artist%)-%album%-CD-FLAC-$if(%date%,$left(%date%,4))-PiCARD, ,_)/$lower($if($gt(%totaldiscs%,1),%discnumber%,)$if($ne(%albumartist%,),$num(%tracknumber%,2),)$replace(-%artist%-%title%, ,_)),['"],)