add multi-artist support for comma separated artists

This commit is contained in:
2026-03-01 17:18:19 -08:00
parent d73ae51b95
commit 369aae818c
14 changed files with 281 additions and 40 deletions

View File

@@ -5,6 +5,8 @@ package web
import (
"fmt"
"time"
"muzi/db"
)
// Subtracts two integers
@@ -56,3 +58,18 @@ func formatTimestamp(timestamp time.Time) string {
func formatTimestampFull(timestamp time.Time) string {
return timestamp.Format("Monday 2 Jan 2006, 3:04pm")
}
// GetArtistNames takes artist IDs and returns a slice of artist names
func GetArtistNames(artistIds []int) []string {
if artistIds == nil {
return nil
}
var names []string
for _, id := range artistIds {
artist, err := db.GetArtistById(id)
if err == nil {
names = append(names, artist.Name)
}
}
return names
}