mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-02 22:46:55 -05:00
[Bug]: Weekly Library Scan does not honor Metadata order of Precedence #1824
Labels
No labels
authentication
awaiting release
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/audiobookshelf-advplyr#1824
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bwprog on GitHub (Mar 18, 2024).
Describe the issue
Audiobookshelf metadata file is the #1 precedence (default order). I make changes to books like correcting author names (e.g. 'J. R. R. Tolkein' to 'J.R.R. Tolkein' to merge into single author) or fixing series names. The weekly scan happens which ignores the precedence order and overwrites the library changes with what is in the audiobook m4b metadata. This happens whether the metadata json file is stored with the books or not--I've tried both methods.
The scan log shows this as the order.
{"timestamp":"2024-03-18T07:06:34.126Z","message":""Honor Among Enemies" Getting metadata with precedence [folderStructure, audioMetatags, nfoFile, txtFiles, opfFile, absMetadata]","levelName":"DEBUG","level":1}
Example from log showing the author reverting.
"timestamp":"2024-03-18T07:13:01.930Z","message":"Library item "J.N. Chaney/Renegade Origins/01 - Nameless" key "ctime" changed from "1709496949448" to "1710620503636"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:01.930Z","message":"Library file "Nameless A Renegade Star Story Renegade Star, Book 0.m4b" for library item "/audiobooks/J.N. Chaney/Renegade Origins/01 - Nameless" key "ctimeMs" changed from "1708368842108" to "1710620503636"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:01.931Z","message":"Library file "Nameless A Renegade Star Story Renegade Star, Book 0.jpg" for library item "/audiobooks/J.N. Chaney/Renegade Origins/01 - Nameless" key "ctimeMs" changed from "1708368842108" to "1710620503636"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:01.931Z","message":"Library file "cover.jpg" for library item "/audiobooks/J.N. Chaney/Renegade Origins/01 - Nameless" key "ctimeMs" changed from "1709496949448" to "1710620503636"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:01.931Z","message":"Library item "J.N. Chaney/Renegade Origins/01 - Nameless" changed: [ctime,size,lastScan,lastScanVersion]","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:02.072Z","message":""Nameless" Getting metadata with precedence [folderStructure, audioMetatags, nfoFile, txtFiles, opfFile, absMetadata]","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:02.072Z","message":"setChapters: Using embedded chapters in first audio file /audiobooks/J.N. Chaney/Renegade Origins/01 - Nameless/Nameless A Renegade Star Story Renegade Star, Book 0.m4b","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:02.072Z","message":"Found metadata file "/metadata/items/1633d10f-837c-496e-ac2b-da990c9bbcc2/metadata.json"","levelName":"INFO","level":2}
{"timestamp":"2024-03-18T07:13:02.113Z","message":"Updating book "Nameless: A Renegade Star Story" added author "J. N. Chaney"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:02.116Z","message":"Updating book "Nameless: A Renegade Star Story" removed author "J.N. Chaney"","levelName":"DEBUG","level":1}
{"timestamp":"2024-03-18T07:13:02.120Z","message":"Success saving abmetadata to "/audiobooks/J.N. Chaney/Renegade Origins/01 - Nameless/metadata.json"","levelName":"DEBUG","level":1}
The only way I have found to prevent this is to uncheck the other metadata options which then shows only the 2 still enabled in the log. Still the wrong order, but without the audioMetatags it doesn't mess up the library.
{"timestamp":"2024-03-04T15:41:25.236Z","message":""Servant of the Dragon" Getting metadata with precedence [folderStructure, absMetadata]","levelName":"DEBUG","level":1}
The issue was in 2.7.2 and 2.8.0. I used the workaround in 2.8.0. The upgrade to 2.8.1 seemed to re-enable the other 4 metadata options, so last night's weekly scan overwrote all my manual library changes again.
Steps to reproduce the issue
Audiobookshelf version
v2.8.1
How are you running audiobookshelf?
Docker
@advplyr commented on GitHub (Mar 18, 2024):
I wasn't able to reproduce the issue in my test.
The precedence in the log is actually correct because Abs iterates through the array from the lowest precedence to the highest, overwriting metadata as it takes precedence.
I would suggest opening up the JSON file at
/metadata/items/1633d10f-837c-496e-ac2b-da990c9bbcc2/metadata.jsonand verifying that it has the correct data in it. Once you make a change you should see it reflected in that file.According to the log the author name "J. N. Chaney" was what was saved in that JSON file and the author name "J.N. Chaney" is what was saved in the database for that book at the time of the scan.
The scheduled scan and a manual scan is using the same code so it shouldn't make any difference. The only way it could make a difference perhaps is if something on your system is changing over a longer period of time that you wouldn't see by running a manual scan.
In my testing I changed an author on a book then set up a scheduled scan to run in 5 minutes. If you are able to find more consistent reproduction steps that can help identify what is going on. Also providing more information about your specific setup, for example CIFS is known to have issues due to not respecting file inode values.