This commit is contained in:
Nick Wolf 2026-05-06 00:22:53 +02:00 committed by GitHub
commit 5a90eb69a2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,8 +34,18 @@ class AbsMetadataFileScanner {
libraryScan.addLog(LogLevel.INFO, `Found metadata file "${metadataFilePath}"`)
const abMetadata = abmetadataGenerator.parseJson(metadataText) || {}
for (const key in abMetadata) {
// TODO: When to override with null or empty arrays?
if (abMetadata[key] === undefined || abMetadata[key] === null) continue
if (abMetadata[key] === undefined) 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 === 'genres' && !abMetadata.genres?.length) continue
if (key === 'tags' && !abMetadata.tags?.length) continue