mirror of
https://github.com/navidrome/navidrome.git
synced 2026-10-10 03:17:27 +02:00
feat(subsonic): serve CreditedAs as name in contributor lists
This commit is contained in:
parent
8b5e50a1aa
commit
e2fd0959bd
3 changed files with 66 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue