n10v / id3v2

🎵 ID3 decoding and encoding library for Go
https://pkg.go.dev/github.com/bogem/id3v2/v2
MIT License
334 stars 50 forks source link

tag.AddAttachedPicture() not working #31

Closed kalbhor closed 6 years ago

kalbhor commented 6 years ago

The album art doesn't seem to get added in the music file. Here path is a valid mp3 file and metadata.Image is a valid jpeg image byte array.

    tag, err := id3v2.Open(path, id3v2.Options{Parse: true})
    checkErr(err)
    defer tag.Close()

    pic := id3v2.PictureFrame{
        Encoding:    id3v2.EncodingUTF8,
        MimeType:    "image/jpeg",
        PictureType: id3v2.PTFrontCover,
        Description: "Front cover",
        Picture:     metadata.Image,
    }
    tag.AddAttachedPicture(pic)
    if err = tag.Save(); err != nil {
        log.Fatal("Error : ", err)
    }
kalbhor commented 6 years ago

Found the problem. Turns out there's a problem with MacOS High Sierra, and it sometimes fails to show album covers in Finder.

Sorry for raising this issue. Its not related to your program.

n10v commented 6 years ago

@kalbhor Sometimes I encounter this issue too. It's better to check ID3 tags in iTunes.