⬥ ID3 encoding/decoding library in Go ⬥
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package v2
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Writes ID3v2Tag to ws
|
|
|
|
func (tag *ID3v2Tag) write(ws io.WriteSeeker) error {
|
|
|
|
_, err := ws.Seek(0, io.SeekStart)
|
|
|
|
if err != nil {
|
|
|
|
return fmt.Errorf("could not seek: %s", err)
|
|
|
|
}
|
|
|
|
|
|
|
|
// write header
|
|
|
|
ws.Write(tag.Header.toBytes())
|
|
|
|
|
|
|
|
// write frames
|
|
|
|
for _, frame := range tag.Frames {
|
|
|
|
ws.Write(frame.toBytes(tag.Header.Version))
|
|
|
|
}
|
|
|
|
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// func (tag *ID3v2Tag) WriteToFile(f *os.File) error {
|
|
|
|
// return nil
|
|
|
|
// }
|