n10v / id3v2

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

change album image #63

Closed imanborumand closed 3 years ago

imanborumand commented 3 years ago

hello thanks for create this lib

how i can change mp3 file album art picture? please help me :)

this code not work

tag, err := id3v2.Open("public/music/Siavash.mp3", id3v2.Options{Parse: true})
    if tag == nil || err != nil {
        Core.Error400(c, "Error while opening mp3 file: ","")
    }
    defer tag.Close()

    artwork, err := ioutil.ReadFile("public/test.jpg")
    if err != nil {
        Core.Error400(c, "Error while opening mp3 file: ","")
    }

    pic := id3v2.PictureFrame{
        Encoding:    id3v2.EncodingUTF8,
        MimeType:    "image/jpeg",
        PictureType: id3v2.PTBackCover,
        Description: "Front cover",
        Picture:     artwork,
    }

    tag.AddAttachedPicture(pic)
n10v commented 3 years ago

Hello! What error do you get?

n10v commented 3 years ago

Closing as there was no response