In oggtag handle a case when tag name are in upper case.
This commit is contained in:
parent
2ea74277ab
commit
10b817df2e
@ -6,6 +6,7 @@ for certain tag names ending with an = character, e.g. artist= and title=.
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// OggGetTag is searching for a certain tag in a given buffer buf and returns
|
// OggGetTag is searching for a certain tag in a given buffer buf and returns
|
||||||
@ -15,7 +16,14 @@ import (
|
|||||||
// looking for a certain tag preceded with three zero bytes and ends with
|
// looking for a certain tag preceded with three zero bytes and ends with
|
||||||
// an = character.
|
// an = character.
|
||||||
func OggGetTag(buf []byte, tag string) string {
|
func OggGetTag(buf []byte, tag string) string {
|
||||||
tagIdx := bytes.Index(buf, append([]byte{0, 0, 0}, (tag+"=")...)) + 3
|
tagIdx := bytes.Index(buf, append([]byte{0, 0, 0}, (tag+"=")...))
|
||||||
|
if tagIdx == -1 {
|
||||||
|
tagIdx = bytes.Index(buf, append([]byte{0, 0, 0}, (strings.ToUpper(tag)+"=")...))
|
||||||
|
if tagIdx == -1 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tagIdx += 3
|
||||||
tagNameLen := len(tag) + 1
|
tagNameLen := len(tag) + 1
|
||||||
valStart := tagIdx + tagNameLen
|
valStart := tagIdx + tagNameLen
|
||||||
valLen := int(buf[tagIdx-4]) - tagNameLen
|
valLen := int(buf[tagIdx-4]) - tagNameLen
|
||||||
|
Loading…
Reference in New Issue
Block a user