From 9edd38ca5d10eb571b767a3b07d80087086b61ed Mon Sep 17 00:00:00 2001 From: David Howden Date: Sun, 29 Jan 2017 10:14:22 +1100 Subject: [PATCH] Update README to set language on code snippets. --- README.md | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index f8d1116..59131d2 100644 --- a/README.md +++ b/README.md @@ -6,36 +6,40 @@ This package provides MP3 (ID3v1,2.{2,3,4}) and MP4 (ACC, M4A, ALAC), OGG and FL Detect and parse tag metadata from an `io.ReadSeeker` (i.e. an `*os.File`): - m, err := tag.ReadFrom(f) - if err != nil { - log.Fatal(err) - } - log.Print(m.Format()) // The detected format. - log.Print(m.Title()) // The title of the track (see Metadata interface for more details). +```go +m, err := tag.ReadFrom(f) +if err != nil { + log.Fatal(err) +} +log.Print(m.Format()) // The detected format. +log.Print(m.Title()) // The title of the track (see Metadata interface for more details). +``` Parsed metadata is exported via a single interface (giving a consistent API for all supported metadata formats). - // Metadata is an interface which is used to describe metadata retrieved by this package. - type Metadata interface { - Format() Format - FileType() FileType +```go +// Metadata is an interface which is used to describe metadata retrieved by this package. +type Metadata interface { + Format() Format + FileType() FileType - Title() string - Album() string - Artist() string - AlbumArtist() string - Composer() string - Genre() string - Year() int + Title() string + Album() string + Artist() string + AlbumArtist() string + Composer() string + Genre() string + Year() int - Track() (int, int) // Number, Total - Disc() (int, int) // Number, Total + Track() (int, int) // Number, Total + Disc() (int, int) // Number, Total - Picture() *Picture // Artwork - Lyrics() string + Picture() *Picture // Artwork + Lyrics() string - Raw() map[string]interface{} // NB: raw tag names are not consistent across formats. - } + Raw() map[string]interface{} // NB: raw tag names are not consistent across formats. +} +``` ## Audio Data Checksum (SHA1)