Fix multiple id3v2.4 genres appearing as one big concatenated genre
This commit is contained in:
@@ -32,13 +32,11 @@ func (e *taglibExtractor) extractMetadata(filePath string) (*Tags, error) {
|
||||
}
|
||||
|
||||
tags := NewTags(filePath, parsedTags, map[string][]string{
|
||||
"title": {"_track", "titlesort"},
|
||||
"album": {"_album", "albumsort"},
|
||||
"artist": {"_artist", "artistsort"},
|
||||
"genre": {"_genre"},
|
||||
"date": {"_year"},
|
||||
"track": {"_track"},
|
||||
"duration": {"length"},
|
||||
"title": {"_track", "titlesort"},
|
||||
"album": {"_album", "albumsort"},
|
||||
"artist": {"_artist", "artistsort"},
|
||||
"date": {"_year"},
|
||||
"track": {"_track"},
|
||||
})
|
||||
|
||||
return tags, nil
|
||||
|
||||
@@ -23,7 +23,7 @@ int taglib_read(const char *filename, unsigned long id) {
|
||||
|
||||
// Add audio properties to the tags
|
||||
const TagLib::AudioProperties *props(f.audioProperties());
|
||||
go_map_put_int(id, (char *)"length", props->length());
|
||||
go_map_put_int(id, (char *)"duration", props->length());
|
||||
go_map_put_int(id, (char *)"bitrate", props->bitrate());
|
||||
|
||||
TagLib::PropertyMap tags = f.file()->properties();
|
||||
@@ -40,9 +40,6 @@ int taglib_read(const char *filename, unsigned long id) {
|
||||
if (!basic->album().isEmpty()) {
|
||||
tags.insert("_album", basic->album());
|
||||
}
|
||||
if (!basic->genre().isEmpty()) {
|
||||
tags.insert("_genre", basic->genre());
|
||||
}
|
||||
if (basic->year() > 0) {
|
||||
tags.insert("_year", TagLib::String::number(basic->year()));
|
||||
}
|
||||
@@ -64,7 +61,6 @@ int taglib_read(const char *filename, unsigned long id) {
|
||||
}
|
||||
}
|
||||
|
||||
// Get only the first occurrence of each tag (for now)
|
||||
for (TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end();
|
||||
++i) {
|
||||
for (TagLib::StringList::ConstIterator j = i->second.begin();
|
||||
|
||||
@@ -19,7 +19,7 @@ var _ = Describe("taglibExtractor", func() {
|
||||
Expect(m.Artist()).To(Equal("Artist"))
|
||||
Expect(m.AlbumArtist()).To(Equal("Album Artist"))
|
||||
Expect(m.Compilation()).To(BeTrue())
|
||||
Expect(m.Genres()).To(ConsistOf("Rock", "Rock"))
|
||||
Expect(m.Genres()).To(ConsistOf("Rock"))
|
||||
Expect(m.Year()).To(Equal(2014))
|
||||
n, t := m.TrackNumber()
|
||||
Expect(n).To(Equal(2))
|
||||
|
||||
Reference in New Issue
Block a user