diff --git a/vorbis.go b/vorbis.go index f1c6a19..ce6ebe8 100644 --- a/vorbis.go +++ b/vorbis.go @@ -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