Add comment metadata (#44)

This commit is contained in:
Jonas L
2018-11-05 07:56:00 +11:00
committed by David Howden
parent c555fff0b7
commit 34f7f1e3c8
9 changed files with 51 additions and 12 deletions
+17 -12
View File
@@ -39,15 +39,17 @@ var fullMetadata = testMetadata{
Track: 3,
TrackTotal: 6,
Year: 2000,
Comment: "Test Comment",
}
var mp3id3v11Metadata = testMetadata{
Album: "Test Album",
Artist: "Test Artist",
Genre: "Jazz",
Lyrics: "",
Title: "Test Title",
Track: 3,
Year: 2000,
Album: "Test Album",
Artist: "Test Artist",
Genre: "Jazz",
Lyrics: "",
Title: "Test Title",
Track: 3,
Year: 2000,
Comment: "Test Comment",
}
func TestReadFrom(t *testing.T) {
@@ -60,11 +62,12 @@ func TestReadFrom(t *testing.T) {
"with_tags/sample.m4a": fullMetadata,
"with_tags/sample.mp4": fullMetadata,
"with_tags/sample.ogg": fullMetadata,
"without_tags/sample.flac": emptyMetadata,
"without_tags/sample.m4a": emptyMetadata,
"without_tags/sample.mp3": emptyMetadata,
"without_tags/sample.mp4": emptyMetadata,
"without_tags/sample.ogg": emptyMetadata,
"without_tags/sample.flac": emptyMetadata,
"without_tags/sample.m4a": emptyMetadata,
"without_tags/sample.mp3": emptyMetadata,
"without_tags/sample.mp4": emptyMetadata,
"without_tags/sample.ogg": emptyMetadata,
}
for path, metadata := range testdata {
@@ -80,6 +83,7 @@ func TestReadFrom(t *testing.T) {
}
func test(t *testing.T, path string, metadata testMetadata) error {
t.Log("testing " + path)
f, err := os.Open("testdata/" + path)
if err != nil {
return err
@@ -103,6 +107,7 @@ func compareMetadata(t *testing.T, m Metadata, tt testMetadata) {
testValue(t, tt.Lyrics, m.Lyrics())
testValue(t, tt.Title, m.Title())
testValue(t, tt.Year, m.Year())
testValue(t, tt.Comment, m.Comment())
disc, discTotal := m.Disc()
testValue(t, tt.Disc, disc)