add support for composer tag

This commit is contained in:
Drew Weymouth
2024-07-19 08:03:10 -07:00
parent 867e2c44b6
commit d4066f0b1c
4 changed files with 103 additions and 70 deletions
@@ -509,31 +509,42 @@ func toTrack(ch *subsonic.Child) *mediaprovider.Track {
genres = []string{ch.Genre}
}
var composerIDs []string
var composers []string
for _, ctr := range ch.Contributors {
if strings.EqualFold(ctr.Role, "composer") {
composerIDs = append(composerIDs, ctr.Artist.ID)
composers = append(composers, ctr.Artist.Name)
}
}
return &mediaprovider.Track{
ID: ch.ID,
CoverArtID: ch.CoverArt,
ParentID: ch.Parent,
Title: ch.Title,
Duration: ch.Duration,
TrackNumber: ch.Track,
DiscNumber: ch.DiscNumber,
Genres: genres,
ArtistIDs: artistIDs,
ArtistNames: artistNames,
Album: ch.Album,
AlbumID: ch.AlbumID,
Year: ch.Year,
Rating: ch.UserRating,
Favorite: !ch.Starred.IsZero(),
PlayCount: int(ch.PlayCount),
LastPlayed: ch.Played,
FilePath: ch.Path,
Size: ch.Size,
BitRate: ch.BitRate,
ContentType: ch.ContentType,
Comment: ch.Comment,
BPM: ch.BPM,
ReplayGain: rGain,
ID: ch.ID,
CoverArtID: ch.CoverArt,
ParentID: ch.Parent,
Title: ch.Title,
Duration: ch.Duration,
TrackNumber: ch.Track,
DiscNumber: ch.DiscNumber,
Genres: genres,
ArtistIDs: artistIDs,
ArtistNames: artistNames,
ComposerIDs: composerIDs,
ComposerNames: composers,
Album: ch.Album,
AlbumID: ch.AlbumID,
Year: ch.Year,
Rating: ch.UserRating,
Favorite: !ch.Starred.IsZero(),
PlayCount: int(ch.PlayCount),
LastPlayed: ch.Played,
FilePath: ch.Path,
Size: ch.Size,
BitRate: ch.BitRate,
ContentType: ch.ContentType,
Comment: ch.Comment,
BPM: ch.BPM,
ReplayGain: rGain,
}
}