From 8bdc82eff0fdac24c4380a12282b88b7df22027d Mon Sep 17 00:00:00 2001 From: David Howden Date: Sun, 24 May 2015 22:25:04 +1000 Subject: [PATCH] Added Genre() to Metadata interface --- README.md | 1 + tag.go | 3 +++ tag/tag.go | 1 + 3 files changed, 5 insertions(+) diff --git a/README.md b/README.md index b4e4ed4..708cd29 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,7 @@ Parsed metadata is exported via a single interface (giving a consistent API for Artist() string AlbumArtist() string Composer() string + Genre() string Year() int Track() (int, int) // Number, Total diff --git a/tag.go b/tag.go index 5fdd090..5114771 100644 --- a/tag.go +++ b/tag.go @@ -100,6 +100,9 @@ type Metadata interface { // Year returns the year of the track. Year() int + // Genre returns the genre of the track. + Genre() string + // Track returns the track number and total tracks, or zero values if unavailable. Track() (int, int) diff --git a/tag/tag.go b/tag/tag.go index ade20dc..c565dc2 100644 --- a/tag/tag.go +++ b/tag/tag.go @@ -67,6 +67,7 @@ func printMetadata(m tag.Metadata) { fmt.Printf(" Album: %v\n", m.Album()) fmt.Printf(" Artist: %v\n", m.Artist()) fmt.Printf(" Composer: %v\n", m.Composer()) + fmt.Printf(" Genre: %v\n", m.Genre()) fmt.Printf(" Year: %v\n", m.Year()) track, trackCount := m.Track()