# Plex Scanner not recognizing multiple genres in mp3 tag

**URL:** <https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487>\
**Category:** Dev/API Corner\
**Tags:** scanner-agent-dev\
**Created:** [September 2, 2014, 2:52am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487 "2014-09-02T02:52:40Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rawcoder](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Rawcoder](https://forums.plex.tv/u/Rawcoder)\
**Post date:** [September 2, 2014, 2:52am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/1 "2014-09-02T02:52:40Z")

</div>

Hi,

&nbsp;

the albums in my music library are tagged with multiple genres in the mp3 tag, separated with ";".

For example: An album is tagged with "Rock; Stoner Rock; Psychedelic Rock"

&nbsp;

Every player - especially Media Monkey - I used so far accepts that and displays the genres correct.

Media Monkey displays the following in the genres list:

Rock

Stoner Rock

Psychedelic Rock

&nbsp;

Plex however sees that as one genre and therefore shows "Rock; Stoner Rock; Psychedelic Rock" in the filter option of genre of my music library. This is obviously not what I want.

&nbsp;

I tried to find the code where the magic happens and found something in the audiohelpers.py of the LocalMedia.bundle.

There's this section:

```
# Genres
    try:
      genres = tags.getall('TCON')
      metadata.genres.clear()

&nbsp; &nbsp; &nbsp; for genre in genres:  
&nbsp; &nbsp; &nbsp; &nbsp; metadata.genres.add(genre)  
&nbsp; &nbsp; except:&nbsp;  
&nbsp; &nbsp; &nbsp; pass
```

Since it shows the genre tag as one I tried spitting it but without success.

I also tried separating the genres with an "/" instead of an ";", this didn't work either.

&nbsp;

Maybe there is a different scanner that does the job, or a work around.

I hope, I explained my problem well enough, but I'm happy to provide you with more information if needed.

&nbsp;

Thanks in advance for any help

Andy

---

<div class="post-metadata">

**Author:** ![mdahrea](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mdahrea](https://forums.plex.tv/u/mdahrea)\
**Post date:** [September 3, 2014, 7:57pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/2 "2014-09-03T19:57:27Z")

</div>

This isn't the scanner, it's the metadata agent.

I had the same problem, so I wrote my own agent.

The issue you're going to run into with Plex fixing this is the ";" is not a standard separator supported by the ID3 specification, so it's unlikely Plex will adopt support for it natively.

-D. Dwarf

---

<div class="post-metadata">

**Author:** ![Rawcoder](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Rawcoder](https://forums.plex.tv/u/Rawcoder)\
**Post date:** [September 4, 2014, 7:58am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/3 "2014-09-04T07:58:08Z")

</div>

Thank you for your reply.

Would you send me the code of your agent, so I could take a look?

I'm not that familiar with python.

Thanks in advance.

Maybe a moderator can move this topic to agents.

---

<div class="post-metadata">

**Author:** ![mdahrea](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mdahrea](https://forums.plex.tv/u/mdahrea)\
**Post date:** [September 6, 2014, 4:42am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/4 "2014-09-06T04:42:16Z")

</div>

Here's the change I made:

```
    # Genres
    try:
      genres = tags.getall('TCON')
      for genre in genres:
        for g1 in genre.genres:
          genre_list = g1.split(';')
          for g in genre_list:
            if g not in metadata.genres: metadata.genres.add(g)
    except:
      Log("Genre Exception")
      pass
```

&nbsp;

You'll need to made a copy of the agent, otherwise your change will get automatically overwritten.

&nbsp;

-D. Dwarf

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![Rawcoder](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Rawcoder](https://forums.plex.tv/u/Rawcoder)\
**Post date:** [September 6, 2014, 9:30pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/5 "2014-09-06T21:30:53Z")

</div>

Thanks for the code. Did you make the change in audiohelper.py of LocalMedia.bundle and was is in your Plex installation directory or the one in your %localappdata%.&nbsp;

I made the changes in both directories, but with no effect on the agent, i.e. no genre showing at all. Did you rename the agent and is it visible in the settings for the agents? In mine it's not.

Argh, this is so frustrating.......

---

<div class="post-metadata">

**Author:** ![mdahrea](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mdahrea](https://forums.plex.tv/u/mdahrea)\
**Post date:** [September 7, 2014, 4:19am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/6 "2014-09-07T04:19:41Z")

</div>

I made&nbsp;a copy of the LocalMedia.bundle directory and named it MyLocalMedia.bundle. Then I searched and replaced LocalMedia with MyLocalMedia in that new directory. Finally, I modified audiohelpers.py.

Then you need to go into the agents settings on the server and uncheck Local Media Assets and check My Local Media Assets. You may need to restart the server, I don't remember.

I'm running on Linux, so my paths will be different than yours.

-D. Dwarf

---

<div class="post-metadata">

**Author:** ![Rawcoder](https://avatars.discourse-cdn.com/v4/letter/r/e5b9ba/32.png) [@Rawcoder](https://forums.plex.tv/u/Rawcoder)\
**Post date:** [September 7, 2014, 10:27pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/7 "2014-09-07T22:27:27Z")

</div>

Thanks again.

It's really strange. Plex doesn't recognize the new agent, i.e. it doesn't show up in the settings.

And it doesn't seem to work, i.e. Plex shows genres like "Rock; Stoner Rock" still as one genre and not as two separate.

That's very annoying.

---

<div class="post-metadata">

**Author:** ![gcoupe](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/gcoupe/32/11125_2.png) [@gcoupe](https://forums.plex.tv/u/gcoupe)\
**Post date:** [December 8, 2014, 7:57am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/8 "2014-12-08T07:57:35Z")

</div>

I've just stumbled across this thread a few days after posting [the same issue in another Plex forum](https://forums.plex.tv/topic/130831-plex-server-cant-handle-multiple-music-genre-tags/) (where it has so far received precisely zero views).

Do I understand that the fix proposed by D.Dwarf seems to work on Linux, but not on Windows? If so, that is very disappointing and annoying. It's annoying that MediaBrowser 3, Media Monkey, Windows Media Player and even the Windows File Explorer can all deal with multiple values in the TCON tag, but that Plex cannot.

Also, I thought that the separation character in the ID3v2 spec might be the NULL character - it just gets shown as a semicolon character in the UI?

---

<div class="post-metadata">

**Author:** ![mdahrea](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mdahrea](https://forums.plex.tv/u/mdahrea)\
**Post date:** [December 8, 2014, 11:54pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/9 "2014-12-08T23:54:21Z")

</div>

I don't know if it'll work in Windows or not. It should.

It's been a while since I looked into this, but I think what has happened is that many clients have started using ';' to separate the fields instead of the null character to make it more human readable/editable. Then strict clients don't display it properly.

tags.getall('TCON')&nbsp;should return an array of genres. If it doesn't, it's because your client has not written them according to the specification. If was more motivated, I would make that character configurable so people that use '\' or '/' wouldn't be left out.

-D. Dwarf

---

<div class="post-metadata">

**Author:** ![zuz\_242](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zuz_242/32/105054_2.png) [@zuz\_242](https://forums.plex.tv/u/zuz_242)\
**Post date:** [March 3, 2015, 10:49pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/10 "2015-03-03T22:49:23Z")

</div>

> I made&nbsp;a copy of the LocalMedia.bundle directory and named it MyLocalMedia.bundle. Then I searched and replaced LocalMedia with MyLocalMedia in that new directory. Finally, I modified audiohelpers.py.
> 
> Then you need to go into the agents settings on the server and uncheck Local Media Assets and check My Local Media Assets. You may need to restart the server, I don't remember.
> 
> I'm running on Linux, so my paths will be different than yours.
> 
> -D. Dwarf

Well, the topic of multiple genre tags pops up for me as well. Im on a windows plex media server and got many mp3s tagged with musicbrainz picard.

Your solution did not work for me so far, maybe you could elaborate? I made the copy of the MyMedia.bundle (folder) and edited "audiohelpers.py".

But what do you mean by "replaced LocalMedia with MyLocalMedia" - the text string within other files or just in filenames?

MyMedia did not show up in the server settings after a restart, yet :(

If i just edit the original audiohelpers.py, it will get overwritten with every update, right?

btw: my audiohelpers.py did look a bit more complicated..

```
    # Genres
    try:
      genres = tags.get('TCON')
      if genres is not None and len(genres.text) > 0:
        metadata.genres.clear()
        for genre in genres.text:
          for sub_genre in genre.split('/'):
            metadata.genres.add(sub_genre.strip())
    except Exception, e:
      Log('Exception reading TCON (genre): ' + str(e))
```

Thanks in advance.

EDIT:

As i pasted my audiohelpers.py i realized the "genre.split('/'):" part. After changing to ";" it seems to work! ;)

---

<div class="post-metadata">

**Author:** ![zuz\_242](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zuz_242/32/105054_2.png) [@zuz\_242](https://forums.plex.tv/u/zuz_242)\
**Post date:** [May 15, 2015, 8:57pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/11 "2015-05-15T20:57:21Z")

</div>

Well, i am still not happy.

I can edit the audiohelpers.py to get it to work but it gets overwritten / resetted rather often.

So: how do i create my own mediascanner that doesnt get overwritten?

I tried to copy and rename the whole LocalMedia.bundle but it wont show up in settings :(

---

<div class="post-metadata">

**Author:** ![mdahrea](https://avatars.discourse-cdn.com/v4/letter/m/3d9bf3/32.png) [@mdahrea](https://forums.plex.tv/u/mdahrea)\
**Post date:** [June 9, 2015, 4:31am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/12 "2015-06-09T04:31:32Z")

</div>

> Well, i am still not happy.
> 
> I can edit the audiohelpers.py to get it to work but it gets overwritten / resetted rather often.
> 
> So: how do i create my own mediascanner that doesnt get overwritten?
> 
> I tried to copy and rename the whole LocalMedia.bundle but it wont show up in settings :(

You don't need to. They've updated the LocalMedia.bundle to handle '/' and ';' and 'nul'.

If you really want to, follow the instructions for creating a new bundle and copy the contents of LocalMedia.bundle into it. Then make your changes in the new bundle.

-D. Dwarf

---

<div class="post-metadata">

**Author:** ![zuz\_242](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/zuz_242/32/105054_2.png) [@zuz\_242](https://forums.plex.tv/u/zuz_242)\
**Post date:** [June 10, 2015, 5:09pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/13 "2015-06-10T17:09:59Z")

</div>

I suspected as much. So everthing is fine now ;)

---

<div class="post-metadata">

**Author:** ![gcoupe](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/gcoupe/32/11125_2.png) [@gcoupe](https://forums.plex.tv/u/gcoupe)\
**Post date:** [June 10, 2015, 5:15pm UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/14 "2015-06-10T17:15:42Z")

</div>

> I suspected as much. So everthing is fine now ;)

Well, not quite. Although the Plex Server can handle multiple genres in your tags, it would appear that at least some of the clients studiously ignore this. See

[https://forums.plex.tv/topic/165821-phtpms-genres/](https://forums.plex.tv/topic/165821-phtpms-genres/)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/plex/original/3X/2/a/2acb9765406f63293d357b4ec509ec39aa28f2ad.png) [@system](https://forums.plex.tv/u/system)\
**Post date:** [December 21, 2019, 2:53am UTC](https://forums.plex.tv/t/plex-scanner-not-recognizing-multiple-genres-in-mp3-tag/75487/15 "2019-12-21T02:53:55Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
