Plex Scanner not recognizing multiple genres in mp3 tag

Hi,

 

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"

 

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

 

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.

 

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()

      for genre in genres:
        metadata.genres.add(genre)
    except: 
      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.

 

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.

 

Thanks in advance for any help

Andy

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

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.

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
 
You'll need to made a copy of the agent, otherwise your change will get automatically overwritten.
 
-D. Dwarf
 
 

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%. 

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.......

I made 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

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.

I've just stumbled across this thread a few days after posting the same issue in another Plex forum (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?

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'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

I made 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! ;)

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 :(

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

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

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/

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