From 2b145a211eccd8123635065c97c20888b63ada5f Mon Sep 17 00:00:00 2001 From: Unbewohnte Date: Wed, 23 Jun 2021 10:26:36 +0300 Subject: [PATCH] id3v1genres map is unexported now --- id3v10.go | 7 +++++-- id3v11.go | 7 +++++-- id3v1genres.go | 2 +- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/id3v10.go b/id3v10.go index 860cd5f..65fa0bc 100644 --- a/id3v10.go +++ b/id3v10.go @@ -72,7 +72,10 @@ func GetID3v1Tags(rs io.ReadSeeker) (*ID3v1Tags, error) { return nil, err } // genre is one byte by specification - genre := int(genreByte[0]) + genre, exists := id3v1genres[int(genreByte[0])] + if !exists { + genre = "" + } return &ID3v1Tags{ SongName: string(songname), @@ -80,7 +83,7 @@ func GetID3v1Tags(rs io.ReadSeeker) (*ID3v1Tags, error) { Album: string(album), Year: year, Comment: string(comment), - Genre: ID3v1Genres[genre], + Genre: genre, }, nil } diff --git a/id3v11.go b/id3v11.go index fb00a60..26875b3 100644 --- a/id3v11.go +++ b/id3v11.go @@ -83,7 +83,10 @@ func GetID3v11Tags(rs io.ReadSeeker) (*ID3v11Tags, error) { return nil, err } // genre is one byte by specification - genre := int(genreByte[0]) + genre, exists := id3v1genres[int(genreByte[0])] + if !exists { + genre = "" + } return &ID3v11Tags{ SongName: string(songname), @@ -92,7 +95,7 @@ func GetID3v11Tags(rs io.ReadSeeker) (*ID3v11Tags, error) { Year: year, Comment: string(comment), Track: track, - Genre: ID3v1Genres[genre], + Genre: genre, }, nil } diff --git a/id3v1genres.go b/id3v1genres.go index 354164a..f6684b3 100644 --- a/id3v1genres.go +++ b/id3v1genres.go @@ -2,7 +2,7 @@ package id3ed // https://en.wikipedia.org/wiki/List_of_ID3v1_Genres -var ID3v1Genres = map[int]string{ +var id3v1genres = map[int]string{ 0: "Blues", 1: "Classic Rock", 2: "Country",