A script that removes duplicates from a tag?

Tags: #<Tag:0x00007f7569672ba0>

After using a $copymerge script, I end up with a tag that contains duplicates:

Is there a script function to remove all duplicates from a tag?

That sounds like a bug. According to the documentation, $copymerge() is supposed to remove duplicates. Can you please share the script snippet that you’re using. I’m wondering if you are using $copymerge() on strings which might be causing the problem. You might have to use $setmulti() on the inputs first.

1 Like

It looks like it isn’t $copymerge failing to remove duplicates.

I think there are two things going on here:

  1. The Classical Extras plugin outputs these duplicates without filtering them.
  2. $copymerge is case sensitive, so it doesn’t see e.g. concerto and Concerto as duplicates:

I’ll try to do some more testing later on to make sure this is not because of something I am doing wrong myself.

1 Like

Ah, yes. That is a little bit better and prevented some of the duplicates. Thanks.

To take care of that, process each of the input variables through $title() before using them in the $setmulti(). Something like:

$setmulti(genre and type,$title(%genre%))
$setmulti(type,$title(%type%))
$copymerge(genre and type,type)
3 Likes

Great, I have gotten rid of all duplicates, things looking Hunky Dory now.
Thanks rdwsift.