feat(subsonic): serve CreditedAs as name in contributor lists

This commit is contained in:
Deluan 2026-05-24 19:47:59 -03:00
commit e2fd0959bd
3 changed files with 66 additions and 3 deletions

View file

@ -92,6 +92,21 @@ func (p ParticipantList) Join(sep string) string {
}), sep)
}
// JoinCredited joins the credited names of the participants with sep.
// Falls back to Name when CreditedAs is empty.
func (p ParticipantList) JoinCredited(sep string) string {
return strings.Join(slice.Map(p, func(part Participant) string {
n := part.CreditedAs
if n == "" {
n = part.Name
}
if part.SubRole != "" {
return n + " (" + part.SubRole + ")"
}
return n
}), sep)
}
type Participants map[Role]ParticipantList
// Add adds the artists to the role, ignoring duplicates.