Compilation = 1 based on string content possible?

I use Discogs as my main tag source on Mp3tag for Mac.
I import the MEDIATYPE tag which, if the album is a compilation, may look for example like this:

"Vinyl (12" 33 ⅓ RPM Compilation)"
"File (WAV Compilation)"
"Cassette (Compilation Limited Edition)"

I would like to automatically set the id3 tag "Compilation" to "1" based on the contents of MEDIATYPE, i.e. if that string contains "Compilation", the Compilation tag is set to 1.

Is this possible? I searched but didn't find any solution here on the forums, and didn't manage to figure it out myself.

(To use Album Artist = Various does not fit my case, since some compilations are from specific artists and Various albums are not necessarily compilations.)

You could filter for all the files with the word Compilation somewhere in the tag data.
And then assign "1" to the field COMPILATION, e.g. with the dialogue "extended tags".

1 Like

Thank you @ohrenkino - I will use this!

Would it be possible to implement a "contains" string function for to make it possible, @Florian ? Similar to the equal function? Or would that be too resource heavy or complicated?

And another question (it is related, I think!), is it or could it be possible to pull and automatically set track number and total tracks from the tag source?

Example:

Here it found the TRACK = 5, I move my file to line 5 to assign it to the correct track but if Mp3tag could read out that the album has a total of 7 tracks it might be possible for it to automatically add that at the end of the track field (i.e. "5/7" instead of just "5")? It would save a lot of time by not always having to manually set track data in the track number assistant (Cmd+K). I can see that it might mess things up a bit in some cases, but as an optional switch would be cool.

I am not sure where you want to specify the "contains".
The filter function already has HAS as keyword - but you would have to specify where:

In general: the data provided by tag sources is usually beyond the control of MP3tag but relies on the community that maintains the tag source.

You can use the track numbering assistant to add the totals.
See
⌘ K Assign Track Numbers...

I am not sure where you want to specify the "contains".
The filter function already has HAS as keyword

Sorry, I was unclear, I meant 'contains' as a scripting function, something like $if($contains(%mediatype%,'Compilation')$set('Compilation','1') (this syntax is surely completely broken but I hope the meaning of it is understandable. To allow full automation.

But using the filter as you suggested is a good compromise (even if it's manual it saves me a lot of time) if my idea is not possible.

In general: the data provided by tag sources is usually beyond the control of MP3tag but relies on the community that maintains the tag source.

This I understand. I just hoped maybe it would be possible for Mp3tag to "read out" the blue marked "7" in my example even though it is not a tag field because it is the last number in the list. The Cmd-K assistant is great but does not help in my example, it only works if I tag a complete album with all tracks available. It breaks if there is one or more tracks missing.

See the documentation on scripting functions:

$contains would probably be $strstr()
You would need something like
$ifgreater($strstr(%mediatype%,Compilation),0,1,)

1 Like

Wow, that seems to work perfectly! :grin:

Thank you so much for the help!