Browse Source

id3v1genres map is unexported now

main
Unbewohnte 3 years ago
parent
commit
2b145a211e
  1. 7
      id3v10.go
  2. 7
      id3v11.go
  3. 2
      id3v1genres.go

7
id3v10.go

@ -72,7 +72,10 @@ func GetID3v1Tags(rs io.ReadSeeker) (*ID3v1Tags, error) {
return nil, err return nil, err
} }
// genre is one byte by specification // genre is one byte by specification
genre := int(genreByte[0]) genre, exists := id3v1genres[int(genreByte[0])]
if !exists {
genre = ""
}
return &ID3v1Tags{ return &ID3v1Tags{
SongName: string(songname), SongName: string(songname),
@ -80,7 +83,7 @@ func GetID3v1Tags(rs io.ReadSeeker) (*ID3v1Tags, error) {
Album: string(album), Album: string(album),
Year: year, Year: year,
Comment: string(comment), Comment: string(comment),
Genre: ID3v1Genres[genre], Genre: genre,
}, nil }, nil
} }

7
id3v11.go

@ -83,7 +83,10 @@ func GetID3v11Tags(rs io.ReadSeeker) (*ID3v11Tags, error) {
return nil, err return nil, err
} }
// genre is one byte by specification // genre is one byte by specification
genre := int(genreByte[0]) genre, exists := id3v1genres[int(genreByte[0])]
if !exists {
genre = ""
}
return &ID3v11Tags{ return &ID3v11Tags{
SongName: string(songname), SongName: string(songname),
@ -92,7 +95,7 @@ func GetID3v11Tags(rs io.ReadSeeker) (*ID3v11Tags, error) {
Year: year, Year: year,
Comment: string(comment), Comment: string(comment),
Track: track, Track: track,
Genre: ID3v1Genres[genre], Genre: genre,
}, nil }, nil
} }

2
id3v1genres.go

@ -2,7 +2,7 @@ package id3ed
// https://en.wikipedia.org/wiki/List_of_ID3v1_Genres // https://en.wikipedia.org/wiki/List_of_ID3v1_Genres
var ID3v1Genres = map[int]string{ var id3v1genres = map[int]string{
0: "Blues", 0: "Blues",
1: "Classic Rock", 1: "Classic Rock",
2: "Country", 2: "Country",

Loading…
Cancel
Save