advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.36k stars 448 forks source link

Genre tag is not used #114

Closed TheSylus closed 2 years ago

TheSylus commented 2 years ago

Hi, my audiobooks have genres filled by mp3tag (Genre 1, Genre 2 and GENRE), but audiobookshelf does not use these tags. Is this a bug or did I something wrong. I am on 1.4.11 using Unraid.

Besides that, great tool.

advplyr commented 2 years ago

I started setting that up but I didn't have any audiobooks that set those metatags, so I didn't test it.

If you could test it that would be great, and I will add it in the next release.

In the code here you can see the prober is checking if it found some other tags I was considering using, like genre, series, releasetime, etc., and it prints a log if it find one.

In order to test:

  1. Change the logger to "Debug". In config click the logger button and choose debug in the dropdown.
  2. Remove one of the books you know have the genre tags set by clicking the remove button in the edit modal.
  3. Open the container log from unraid docker page and scan the library.

Hopefully you see this in the log:

[DEBUG] Notable! file_tag_genre1
[DEBUG] Notable! file_tag_genre2

heads up though, debug is going to dump out a bunch of logs.

TheSylus commented 2 years ago

Hm, I dont see the log you posted. The only Notable! is Notable! file_tag_series, which refers to the series and is working fine. Further, I see [Book] Mapping metadata to key tagPublisher [Book] Mapping metadata to key tagSubtitle but nothing related to genres.

advplyr commented 2 years ago

I added a dump of the raw audio file tags to make this easier to test in v1.4.13. If you go to the track manager page and have experimental features turned on, you will see the "Check Track Numbers" button at the bottom.

We are looking for the key that is used for genre on you audio files.

image

TheSylus commented 2 years ago

Okay, here we go.

"genre":"Science Fiction & Fantasy/Fantasy", "TMP_GENRE1":"Science Fiction & Fantasy", "TMP_GENRE2":"Fantasy"

These are the 3 genres I fetched from audible. In my case, Genre2 would be the best. It seems that genre is just adding genre1 and genre2 which would lead to a alot of genres .

advplyr commented 2 years ago

Interesting... have you tested other audiobooks? Just taking in TMP_GENRE2 doesn't seem right, but also parsing "Science Fiction & Fantasy/Fantasy" wouldn't make sense either.

TheSylus commented 2 years ago

So, I tested several audiobooks and I think both (Genre1 and Genre2) are correct. Most of the time it is up to the personal preferences.

So what to do? I would suggest, we can use both genres. When I filter for fantasy books, the book would appear and in the case I filter for Science Fiction the books would come up aswell. So we dont have a 1 to 1 relation, but a 1 to 2 relaltion and we dont lose any information. In the case that someone uses just one Genre, it is also fine.

advplyr commented 2 years ago

How would you handle "TMP_GENRE1" in the example you posted? It would use "Science Fiction & Fantasy" as a single genre. Is that just mislabeled?

TheSylus commented 2 years ago

I think that Science Fiction & Fantasy is just bad labeled.

However, I had a look at the mp3tag forum. TMP_GENRE1 and TMP_GENRE2 are mainly placeholder tags, which are used while scrapping from audible.com

Genre is a multi-value field, which is also used to have several genres. The separator is / , //, or ;

So my idea would be to use only "genre" and extract both genres and use them.

advplyr commented 2 years ago

In v1.4.14 I included mapping the genre meta tag.

I haven't actually tested this yet, but it should split the genre tag by the separators you showed.

Once I confirm this is all good I will put out a release and update the docs. The update is available now though if you get a chance to test it out.

TheSylus commented 2 years ago

The logger shows: Notable! file_tag_genre However, for the same book the Genres is still empty when I click on edit book and when I filter for genres, still no genres are listed.

advplyr commented 2 years ago

I just pushed a patch and actually tested this time and it is working. If you open the edit modal to an audiobook and press re-scan it will re-map metatags now. Just make sure that there are no genres on the audiobook you are re-scanning (dont forget to save after removing genres).

Let me know how that goes.

TheSylus commented 2 years ago

It works perfectly fine. No issues at all. Thx a lot

advplyr commented 2 years ago

Included in release v1.5.0!