advplyr / audiobookshelf

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

[Bug]: Deleted Genres & Tags re-appear after re-scan of the library #3649

Open b3nd1k opened 1 week ago

b3nd1k commented 1 week ago

What happened?

Through the WebUI, I navigated to Settings -> Item Metadata Utils. Under the section Manage Tags and Manage Genres I deleted a large amount of unnecessary tags, as well as merging tags and genres that have similar names. For example, Fiction Books, Fiction, Fictional was merged into Fiction.

What did you expect to happen?

I expected the changes and removal of genres and tags I made to remain after a re-scan of the library. I have the "Store metadata with item" option checked under Settings, but I assume what happens is that the changes I made are not written to the metadata file, so that when the re-scan appears it adds the information back.

Steps to reproduce the issue

To reproduce the issue, go to Settings -> Item Metadata Utils and either remove or rename any tags. After re-scanning the library, you will notice that the removed or renamed tags reappear.

Audiobookshelf version

v.2.17.2

How are you running audiobookshelf?

Docker

What OS is your Audiobookshelf server hosted from?

Linux

If the issue is being seen in the UI, what browsers are you seeing the problem on?

Firefox

Logs

No response

Additional Notes

No response

advplyr commented 2 days ago

I'm not able to reproduce this issue. I can see that the tag gets removed from the metadata.json file.

Maybe the tags are getting pulled from another file during the scan. Do you have an OPF file or an NFO file with that book?

b3nd1k commented 2 days ago

Do you have an OPF file or an NFO file with that book?

You're probably on to something. The path of the my eBook library in ABS is pointed to my Calibre eBook library. Under Scanner, I have given the Audiobookshelf metadata file a higher priority than OPF file. The thought was that ABS would pick up the metadata from the Calibre library on the initial scan, but then ignore changes to the OPF-file on additional scans.

Am I correct to assume that when I delete a tag from Item Metadata Utils, the Audiobook metadata field for tags goes blank and re-import the tags from the OPF file, rather than locking that field to be blank? Since I have Audiobook metadata field_ set higher than the OPF file, the expected behaviour would be that ABS prevents the tags from getting re-added.

Screenshot 2024-12-02 at 08 19 31
advplyr commented 1 day ago

This is a decision we have to figure out how to best implement. For the case of genres, tags and chapters if they are empty in the metadata file they are ignored, meaning it will not overwrite with an empty array.

I think you're right in assuming it should though. For the case of narrators and series the metadata file will take precedence and keep them empty. There was just a PR opened to make narrators and series behave like genres, tags and chapters. https://github.com/advplyr/audiobookshelf/pull/3671

b3nd1k commented 1 day ago

From what I can tell, there seems to be different opinions on how to best handle this issue. The way I see it is that this is by the order of precedence. If Audiobookshelf metadata file is higher than the OPF file it will remain black, if not, it will re-import.