2015-11-07 126 views

回答

0

這是id3-go當前的問題:PR 8修復它的ID3v1

但是,這是不夠的ID3V2,作爲表演in this commit,這確實有減磅的空字符。 看到使用cutset := string(rune(0)),以及TrimRight(s string, cutset string),如例如strings.TrimRight(fd.Title(), cutset)

fd, err := id3.Open(path) 
if err != nil { 
    item.Title = f.Name() 
} else { 
    defer fd.Close() 
    cutset := string(rune(0)) 
    title := strings.TrimRight(fd.Title(), cutset) 
    author := strings.TrimRight(fd.Artist(), cutset) 
    if len(title) > 0 { 
     item.Title = title 
    } else { 
     item.Title = author 
     if len(author) > 0 { 
      item.Title += " - " 
     } 
     item.Title += strings.TrimRight(f.Name(), cutset) 
    } 
    item.Subtitle = author 
    tcon := fd.Frame("TCON") 
    if tcon != nil { 
     item.Categories = append(item.Categories, Text{Value: strings.TrimRight(tcon.String(), cutset)}) 
    } 
    item.PubDate = strings.TrimRight(formatYear(fd.Year()), cutset) 
+0

是啊,這爲我工作.......有時數據填充帶U的......我會想出出點什麼 –