id3-go icon indicating copy to clipboard operation
id3-go copied to clipboard

Writing new comments

Open sa7mon opened this issue 4 years ago • 2 comments

I'm attempting to add a SetComment method so I can write comment fields on v2 files. This is what I have so far and it almost works:

id3v2.go

func (t *Tag) SetComment(text string) {
	t.setTextFrameText(t.commonMap["Comments"], text)
}

then in testing:

file, err := id3.Open(filePath, false)
if err != nil {
	panic(err)
}

file.SetComment("this is my test comment with absolutely no special characters woohoo")

err = file.Close()
if err != nil {
	panic(err)
}

The ID3 spec defines the Comments frame as such:

<Header for 'Comment', ID: "COMM">
Text encoding           $xx
Language                $xx xx xx
Short content descrip.  <text string according to encoding> $00 (00)
The actual text         <full text string according to encoding>

It seems like the comment text is actually ending up in the "Short content description" portion instead of "the actual text".

I'd love any tips and I'll be sure to create a PR and share back my improvements when I get this working

sa7mon avatar Feb 08 '21 17:02 sa7mon

@sa7mon did you have any luck with this? Looking at add exactly the same at the moment.

ghenry22 avatar Oct 16 '22 16:10 ghenry22

@ghenry22 Tbh I can't remember if I got this working or not. My fork of the repo is here. Relevant branches are master and dev. The repo I was using this library with is here

I did make a number of other changes including adding setDate() and setReleaseYear() as well as improvements in handling v2 vs v1 tags. It's been a while since I looked at this project, so memory is hazy.

sa7mon avatar Oct 19 '22 09:10 sa7mon