Browse Source

Fixed README and a test

main
Unbewohnte 3 years ago
parent
commit
60047a2902
  1. 9
      README.md
  2. 11
      v2/read_test.go

9
README.md

@ -120,9 +120,12 @@ func main() {
} }
if mp3tag.Header.Version == id3v2.V2_3 { if mp3tag.Header.Version == id3v2.V2_3 {
// get certain frame by identifier // get certain frame by identifier.
title := mp3tag.Frames["TIT2"] // Contents is []byte. CAN AND PROBABLY WILL
artist := mp3tag.Frames["TPE1"] // CONTAIN NULL OR OTHER NON-PRINTABLE BYTES !!!
// Text encoding support is still not implemented.
title := mp3tag.Frames["TIT2"].Contents
artist := mp3tag.Frames["TPE1"].Contents
} }

11
v2/read_test.go

@ -4,6 +4,8 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/Unbewohnte/id3ed/util"
) )
func TestReadV2Tag(t *testing.T) { func TestReadV2Tag(t *testing.T) {
@ -12,8 +14,15 @@ func TestReadV2Tag(t *testing.T) {
t.Errorf("%s", err) t.Errorf("%s", err)
} }
_, err = ReadV2Tag(f) tag, err := ReadV2Tag(f)
if err != nil { if err != nil {
t.Errorf("GetV2Tag failed: %s", err) t.Errorf("GetV2Tag failed: %s", err)
} }
titleFrame := tag.Frames["TIT2"]
if util.ToStringLossy(titleFrame.Contents) != "title" {
t.Errorf("ReadV2Tag failed: expected contents to be %s; got %s",
"title", util.ToStringLossy(titleFrame.Contents))
}
} }

Loading…
Cancel
Save