Distinguishing releases with the same name by the same artist in iTunes

I’d like to find a way to get Picard to write tags that help do this automatically. It seems that using iTunes the only way to separate, say, Julian Cope’s World Shut Your Mouth album from his World Shut Your Mouth EP is to actually change the album titles. I know there is a plug in that will add single or EP to single and EP titles, but that won’t solve every example in my collection.

The way I’m thinking now is to find a way to add catalog numbers and media (in rare cases where there may be a difference between releases in different media but they share a catalog #) to the titles, i.e.:
World Shut Your Mouth (818 365-1, MERL 37, 12" Vinyl)
World Shut Your Mouth (90560-1, 12" Vinyl)

Would it be possible to write a script to have Picard automatically pull other fields into another? Could I solicit this from someone who is handy with scripting?

Alternatively, and I figure this might be the longer shot, does anyone know a way to get iTunes to use some of MusicBrainz’s tag info to separate releases like this?

As far as I know, there’s no way in scripting to only do that when necessary, and even a plugin would be difficult to code without essentially writing a full music library management program. If you don’t mind having that info on every album, though, the script’s actually not all that difficult. I’d even expect it to work perfectly well in iTunes, since the files wind up with two different album names.

$noop(Precombine fields to make it easier to check for their presence)
$set(_albumdisambiguation,%catalognumber%$if(
    $and(
        $ne(%catalognumber%,),
            $ne(%media%,)
    ),\, )%media%)
$if($ne(%_albumdisambiguation%,),
    $set(album,%album% \(%_albumdisambiguation%\))
)
$noop(Clean up after ourselves)
$unset(_albumdisambiguation)

Of note, the script uses the default semicolon to separate the catalog numbers, and I don’t see any way of changing that before flattening the multiple values. If you’d really rather use a comma, replace the second line with the following one, but it will also change any semicolons (if followed by spaces) that should be in the catalog number.

$set(_albumdisambiguation,$replace(%catalognumber%,; ,\, )$if(

Also, I find a colon looks better before the medium type if you do use the commas; if you agree, I’d recommend changing the “\,” in the sixth line with “:”.

I did notice a bug in the UI when using the script: the album title in the right panel acts like the media hasn’t been added. It properly shows up in the fields in the bottom panel, though, so everything else should still work fine.

And for anyone who does just need the EP/Single marking:

$if($eq(%_primaryreleasetype%,ep),
	$noop(Only add "EP" if the album doesn't already end with it)
	$noop(This will still run into issues with, eg. "...\(EP\)")
	$if($ne($upper($right(%album%,2)),EP),
		$set(album,%album% EP)
	),
	$noop(Don't add anything for "album" release type)
	$if($ne(%_primaryreleasetype%,album),
		$set(album,%album% \(%_primaryreleasetype%\))
	)
)

I actually do want it applied to every album (prefer consistency), so this is perfect. Thank you! I really appreciate the additional suggestions, too. I’ll take it for a test and consider modifying it after seeing how things look.

Can a line be added to eliminate the part containing the catalog # for stuff that doesn’t have one? So it would be come for example: Title (CD)?

I actually thought I put that in the first version, but I guess I forgot to test it. Apparently, $if checks its arguments at least partially as strings, so the newlines and tabs I put in for readability were throwing it off. On the plus side, I was able to cut out some of the function calls in fixing that bug. Sorry for the wait!

$noop(Precombine fields to make it easier to check for their presence)
$set(_albumdisambiguation,%catalognumber%$if($and(%catalognumber%,%media%),\, )%media%)
$if(%_albumdisambiguation%,$set(album,%album% \(%_albumdisambiguation%\)))
$noop(Clean up after ourselves)
$unset(_albumdisambiguation)

This is perfect. Exactly what I needed. Thanks a million!