fix(scanner): split comma-joined ABS sidecar genres into separate tags

Audiobookshelf-style exports join genres into one comma-string
(["Epic, Action & Adventure, Military, Sword & Sorcery"]). The
smart-genre picker already split candidates for the genre column,
but the tags assembly used the raw unsplit array — so the whole
string landed as ONE element of media_items.tags and rendered as a
single tag everywhere.

Use pickSmartGenre's split candidates for tags too, exactly as the
function's own comment documents ('split parts included stay in
tags'). Commas inside a single subject heading remain legal within
one tag (EPUB dc:subject path unchanged).
This commit is contained in:
John O'Keefe committed 2026-10-25 12:05:14 -04:00
1 parent ecfd7276ab
commit ab2a5568ae
2 files changed
+34 -3

No files matched your search

+9 -3
View File
@@ -1884,11 +1884,17 @@ func extractAudiobookshelfSidecar(path string) *MediaMetadata {
}
// Smart genre (A2c §2.5): most-specific canonical genre wins the genre
// column; every candidate (split parts included) stays in tags.
if genre, _ := pickSmartGenre(sidecar.Genres); genre != "" {
// column; every candidate (split parts included) stays in tags. The
// split is the point: ABS-style exports join genres into one
// comma-string ("Epic, Action & Adventure, Military") which must land
// as separate tags, while commas inside a single subject heading stay
// legal within one tag.
genre, all := pickSmartGenre(sidecar.Genres)
if genre != "" {
metadata.Genre = genre
}
if tags := append(append([]string{}, sidecar.Genres...), sidecar.Tags...); len(tags) > 0 {
tags := append(append([]string{}, all...), sidecar.Tags...)
if len(tags) > 0 {
metadata.Tags = utils.NormalizeTags(tags)
}
if sidecar.Language != nil {