Added Genre() to Metadata interface

This commit is contained in:
David Howden 2015-05-24 22:25:04 +10:00
parent ce0c1dc2f8
commit 8bdc82eff0
3 changed files with 5 additions and 0 deletions

View File

@ -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

3
tag.go
View File

@ -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)

View File

@ -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()