Appending to existing genres

I am storing a list of genres using commas as the delimiter. I wish to add (maybe remove) a genre - in bulk - from the currently visible/selected view of tracks; yet most importantly, I do not want a genre to be duplicated!

Do I do this using filters or action groups? I understand things work a little differently with the Mac version.

What expressions//scripts can I use? Thanks in advance.

See this thread on how to remove duplicates from a list:

Thanks for the reference.

I still need to solve adding and removing tags in bulk - based on selection in browser.

Even pointing into direction of what scripting/regex needed (if at all) will help.

The genre selection list only writes a single genre. If you want to add multiple genres this will need to be done manually. You can use the existing genre field and add to it using actions, but not much point if you need to spend as much time writing the action in the first place.

BTW - a comma isn’t generally the best solution for a delimiter as that character often appears in other tag fields. I suggest you might consider a more unique Unicode character as the separator, or at least the more traditionally used semicolon ; or forward slash / as a better choice.

The removal of duplicates has already been linked.
Here is a thread from the FAQs on how to append an existing field

You can also use a dedicated action combined with a filter.

Filtering for

NOT genre HAS "Rock"

would list all files which don't have "Rock" in the genre field. Then, applying an action Format tag field for field GENRE with [%genre%, ]Rock would append the genre "Rock" to a possible existing genre.

You can use two actions Replace for field GENRE with

  1. , Rock and
  2. Rock

replaced by nothing (equivalent to removing) to remove the genre "Rock" from a possibly comma-delimited list of genres.

1 Like

Thanks for the tip. How could I find and replace commas to say a semicolon? I'm confident none of my comma'd fields express a single genre.

There's a lot going on in the thread. Would I use (within the Action Groups section) "Replace with Regular Expression"? option?

I'm unsure how the list items thing was included in that thread. And how would I import the .mta file? I think that's the answer in the thread.

Yes, in the end you have to use that rather complicated regular expression that only remove duplicates.
So, if you do not have duplicates, then you don't have to dig into that thread.

To replace commas with semicoli, use an action of the type "Replace" (without regular expression)

I tried the expression in the final reply. Couldn't seem to notice it in a test? Do I need to supply a list?

Thanks!

To note, I also tried "Merge Duplicate Fields" and "Remove Duplicate Fields" from the Quick Actions. Not that I know what I'm doing ...

EDIT: I got "Replace" from Quick Actions to work though (ie. replacing commas to semicolons)

I found this thread regarding where .mta are stored in WIndows: How can I import .mta files into mp3tag?

Still trying to sort out for Mac!
EDIT: Realised I needed to update the progam. Looks like the .mta doesn't support semicolons ...

see the documentation for the Mac:

1 Like

So import works yet doesn't seem to actually remove duplicates (ensuring genres are comma delimitered).

I think I'm using it wrong because it needs a list of text to find duplicates?

Looks like you got this part figured out with @ohrenkino now.

1 Like

This only works when you are using multiple and separate fields for the same tag. In your example I believe you are using just one tag separating a list of genres with a comma or semicolon. So these actions don’t apply.

I see, so is there are a way to remove duplicates in a comma separated field?

I think that what was covered in the links above. You would have to change the separator to use the semicolon if you made that change to your genre tags already. But regex is not my strength, maybe one of the other users can help. But this is not a simple action using any of the defined tools.

OK, I managed to modify the aforementioned regex to work with semicolons by replacing the colons. It seems to work by only keep the last instance of the word (which is fine enough).

Thank you!

A post was split to a new topic: Save filters for continual reuse?