changed genre scanning to parse multiple genres, updated db to accommodate.

This commit is contained in:
2026-02-22 13:59:28 -05:00
parent 3947c2d6aa
commit 9cb1c6674a
24 changed files with 457 additions and 40 deletions
+17 -2
View File
@@ -5,6 +5,7 @@ import (
"fmt"
"path/filepath"
"strconv"
"strings"
)
// Sentinel errors for library queries.
@@ -22,12 +23,26 @@ type Track struct {
TrackNumber int64
DiscNumber int64
Album string
Genre string
Genre []string
Year int64
Composer string
FileType string
}
// genreDelimiter is the separator used by GROUP_CONCAT in the
// GetAllTracksWithFullMetadata query.
const genreDelimiter = "||"
// splitGenres splits a GROUP_CONCAT genre string into individual
// genre names. An empty string returns nil.
func splitGenres(concatenated string) []string {
if concatenated == "" {
return nil
}
return strings.Split(concatenated, genreDelimiter)
}
// Album represents an album for the cover grid display.
type Album struct {
ID int64
@@ -75,7 +90,7 @@ func (l *Library) GetAllTracks() ([]Track, error) {
TrackNumber: row.TrackNumber.Int64,
DiscNumber: row.DiscNumber.Int64,
Album: row.Album,
Genre: row.Genre,
Genre: splitGenres(row.Genre),
Year: row.Year,
Composer: row.Composer,
FileType: row.FileType,