fix vorbis multiple artists
All checks were successful
Go / build (push) Successful in 3m33s

This commit is contained in:
majomi 2024-07-15 16:18:59 +02:00
parent 3d75831295
commit 64531b717e
Signed by: majomi
SSH Key Fingerprint: SHA256:VYTIGShChSqrGhLmmBZAmfYtjdyj+HLrfJ1Hb6d/0O8

View File

@ -22,7 +22,7 @@ func newMetadataVorbis() *metadataVorbis {
}
type metadataVorbis struct {
c map[string]string // the vorbis comments
c map[string]string // the vorbis commentsq
p *Picture
}
@ -43,6 +43,8 @@ func (m *metadataVorbis) readVorbisComment(r io.Reader) error {
return err
}
artists := []string{}
for i := uint32(0); i < commentsLen; i++ {
l, err := readUint32LittleEndian(r)
if err != nil {
@ -56,9 +58,15 @@ func (m *metadataVorbis) readVorbisComment(r io.Reader) error {
if err != nil {
return err
}
if k == "ARTIST" {
artists = append(artists, v)
}
m.c[strings.ToLower(k)] = v
}
m.c["artist"] = strings.Join(artists, ";")
if b64data, ok := m.c["metadata_block_picture"]; ok {
data, err := base64.StdEncoding.DecodeString(b64data)
if err != nil {
@ -151,6 +159,7 @@ func parseComment(c string) (k, v string, err error) {
err = errors.New("vorbis comment must contain '='")
return
}
k = kv[0]
v = kv[1]
return