Fix UFID error: "expected to split UFID data into 2 pieces"
(cherry picked from commit 02b288165e4fc288c84d48653483a0a59f46388c)
This commit is contained in:
parent
d52dcb253c
commit
a081f19c30
5
id3v2.go
5
id3v2.go
@ -340,10 +340,7 @@ func readID3v2Frames(r io.Reader, offset uint, h *id3v2Header) (map[string]inter
|
||||
result[rawName] = txt
|
||||
|
||||
case name == "UFID" || name == "UFI":
|
||||
t, err := readUFID(b)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
t := readUFID(b)
|
||||
result[rawName] = t
|
||||
|
||||
case name == "WXXX" || name == "WXX":
|
||||
|
@ -505,16 +505,18 @@ 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 {
|
||||
result := bytes.SplitN(b, singleZero, 2)
|
||||
if len(result) != 2 {
|
||||
return nil, errors.New("expected to split UFID data into 2 pieces")
|
||||
return &UFID{
|
||||
Identifier: result[0],
|
||||
}
|
||||
}
|
||||
|
||||
return &UFID{
|
||||
Provider: string(result[0]),
|
||||
Identifier: result[1],
|
||||
}, nil
|
||||
}
|
||||
}
|
||||
|
||||
var pictureTypes = map[byte]string{
|
||||
|
Loading…
Reference in New Issue
Block a user