diff --git a/pkg/oggtag/oggtag.go b/pkg/oggtag/oggtag.go index 7fcf8aa..47d344a 100644 --- a/pkg/oggtag/oggtag.go +++ b/pkg/oggtag/oggtag.go @@ -6,6 +6,7 @@ for certain tag names ending with an = character, e.g. artist= and title=. import ( "bytes" + "strings" ) // 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 // an = character. 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 valStart := tagIdx + tagNameLen valLen := int(buf[tagIdx-4]) - tagNameLen