Refactor Ufid -> UFID

This commit is contained in:
David Howden 2015-05-24 12:11:52 +10:00
parent eef1ffcbbd
commit 1832dec4e7
2 changed files with 6 additions and 6 deletions

View File

@ -226,7 +226,7 @@ func readID3v2Frames(r io.Reader, h *ID3v2Header) (map[string]interface{}, error
result[rawName] = txt
case name == "UFID" || name == "UFI":
t, err := readUfid(b)
t, err := readUFID(b)
if err != nil {
return nil, err
}

View File

@ -195,21 +195,21 @@ func readTextWithDescrFrame(b []byte, hasLang bool, encoded bool) (*Comm, error)
}, nil
}
// UFID is composed of a provider (frequently an URL and a binary identifier)
// UFID is composed of a provider (frequently a URL and a binary identifier)
// The identifier can be a text (Musicbrainz use texts, but not necessary)
type Ufid struct {
type UFID struct {
Provider string
Identifier []byte
}
func (u Ufid) String() string {
func (u UFID) String() string {
return fmt.Sprintf("%v (%v)", u.Provider, string(u.Identifier))
}
func readUfid(b []byte) (*Ufid, error) {
func readUFID(b []byte) (*UFID, error) {
result := bytes.SplitN(b, []byte{0}, 2)
return &Ufid{
return &UFID{
Provider: string(result[0]),
Identifier: result[1],
}, nil