If "(X Mix)" add X as genre

Hello all,

I’m looking for some help in setting up a tagger script, which I’ve described in the title. I have many tracks with titles that say “(Funk Mix)” or “(Jazz Mix)” and I’d like to add Funk and Jazz as genres. I’d appreciate any help. Thank you!

1 Like

Please do not make (almost) identical duplicate posts.

except they aren’t really duplicate, just similar problems which require quite different solutions

to answer your question @nothing2obvi, the only way I can think to do this is to somehow get a list of all genres (theoretically possible) and compare the title to that. I don’t know how to do that, but I might take a crack at it…

otherwise, @rdswift or @outsidecontext might be able to help?

1 Like

For your specific case of “(X Mix)” appearing in the track title, you could try something like the following to add the value of “X” to the list of genres associated with the track:

$set(_working,$lower(%title%))
$set(_genre,$rsearch(%_working%,\\\(\(\\S+\)\\s+mix\\\)))
$if(%_genre%,$copymerge(genre,_genre))

Note that this requires that the track title contains “X Mix” enclosed in brackets, for the regular expression to match and extract the value of “X” to add to the %genres% multi-value variable provided from MusicBrainz (with the Picard “Use genres from MusicBrainz” setting enabled).

2 Likes

would that also properly handle titles like (alternate mix) or (2019 mix)? it feels like titles like those are common enough to worry about here… (tho admittedly not terribly common)

As you point out, the downside is that it would also extract things like “alternate” and “2019” as genres in its current form. Additional processing would be required to further filter out unwanted items through some combination of regular expressions and/or whitelist or blacklist. In any case, you need to be able to define either what you want to include or what you want to exclude.

1 Like

Thank you very much, @rdswift ! That works great. I can deal with words like “Alternate” and “2019”.

2 Likes