示例#1
0
// the appropriate place for this function is in a unit test
// the appropriate place for this style of exploratory code is in unit tests.
// TODO: figure out TDD in Go
func whataboutnullchars(file *id3.File, path string) {
	taggerVersion := file.Tagger.Version()
	trimmed_artist := stripTerminalNull(file.Artist())
	fmt.Println(file.Artist(), "| to |", trimmed_artist, "|file ", path, " version ", taggerVersion)
	// here I just found out that the id3v1 parser doesn't strip the null padding bytes at the end of id3v1 fields.
	// also maybe I have some songs with 16bit-wide metadata fields?
	// look
	// er
	// turns out a nul byte, even in a comment, is illegal.
	// see file notes for originally included offending line.
	// strings are complicated
}
示例#2
0
func setFrame(tag *id3.File, frameName string, value string) bool {
	frame := tag.Frame(frameName)
	if frame != nil {
		//		fmt.Println("changing frame")
		if textFramer, ok := frame.(v2.TextFramer); ok {
			textFramer.SetEncoding("UTF-8")
			textFramer.SetText(value)
			return true
		}
	} else {
		//		fmt.Println("adding frame")
		ft := v2.V23FrameTypeMap[frameName]
		textFrame := v2.NewTextFrame(ft, "")
		textFrame.SetEncoding("UTF-8")
		textFrame.SetText(value)
		tag.AddFrames(textFrame)
	}
	return false
}