Refactor Ufid -> UFID
This commit is contained in:
parent
eef1ffcbbd
commit
1832dec4e7
2
id3v2.go
2
id3v2.go
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user