Subsonic: Partial support for some OpenSubsonic tags

This commit is contained in:
Philipp Wolfer 2023-11-23 09:57:35 +01:00
parent 68b2e649f0
commit 0b5f699383
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
4 changed files with 18 additions and 1 deletions

View file

@ -88,11 +88,22 @@ func SongAsLove(song subsonic.Child, username string) models.Love {
ArtistNames: []string{song.Artist},
TrackNumber: song.Track,
DiscNumber: song.DiscNumber,
Tags: []string{song.Genre},
RecordingMbid: models.MBID(song.MusicBrainzId),
Tags: []string{},
AdditionalInfo: map[string]any{},
Duration: time.Duration(song.Duration * int(time.Second)),
},
}
if len(song.Genres) > 0 {
genres := make([]string, 0, len(song.Genres))
for _, genre := range song.Genres {
genres = append(genres, genre.Name)
}
love.Track.Tags = genres
} else if song.Genre != "" {
love.Track.Tags = []string{song.Genre}
}
return love
}