mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-07 09:51:37 +00:00
Merge dc0899ff61 into 6f03467f35
This commit is contained in:
commit
c54c97b9ec
1 changed files with 12 additions and 2 deletions
|
|
@ -35,8 +35,18 @@ class AbsMetadataFileScanner {
|
||||||
const abMetadata = abmetadataGenerator.parseJson(metadataText, 'book') || {}
|
const abMetadata = abmetadataGenerator.parseJson(metadataText, 'book') || {}
|
||||||
|
|
||||||
for (const key in abMetadata) {
|
for (const key in abMetadata) {
|
||||||
// TODO: When to override with null or empty arrays?
|
if (abMetadata[key] === undefined) continue
|
||||||
if (abMetadata[key] === undefined || abMetadata[key] === null) continue
|
if (abMetadata[key] === null) {
|
||||||
|
// Propagate null for scalar string fields so that values intentionally cleared
|
||||||
|
// by the user are preserved when the library is rescanned. absMetadata has the
|
||||||
|
// highest metadata precedence, so a null here means the user explicitly cleared
|
||||||
|
// the field and lower-priority sources (e.g. audio file tags) should not refill it.
|
||||||
|
const clearableStringFields = ['subtitle', 'publishedYear', 'publisher', 'description', 'isbn', 'asin', 'language']
|
||||||
|
if (clearableStringFields.includes(key)) {
|
||||||
|
bookMetadata[key] = null
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
if (key === 'authors' && !abMetadata.authors?.length) continue
|
if (key === 'authors' && !abMetadata.authors?.length) continue
|
||||||
if (key === 'genres' && !abMetadata.genres?.length) continue
|
if (key === 'genres' && !abMetadata.genres?.length) continue
|
||||||
if (key === 'tags' && !abMetadata.tags?.length) continue
|
if (key === 'tags' && !abMetadata.tags?.length) continue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue