Why does metadataVorbis#Composer and #Artist return a value that was unasked for?
itslychee opened this issue · comments
I encountered this issue with my program alto where I was expecting the %artist%
variable to return m.c["artist"]
, which is the actual artist
field defined within the metadata, but it returned m.c["performer"]
instead. Unbeknownst to me, I thought this was an error with my code, so after a few minutes of trial and error still yielded the same result. I was puzzled, but then decided to check Windows Explorer and said that the artist field was defined. I was confused at why it wasn't returning m.c["artist"]
when Windows Explorer was, but that was when I finally decided to conclude my confusion by going directly to the source only to see the following code:
https://github.com/dhowden/tag/blob/master/vorbis.go#L175-L185
func (m *metadataVorbis) Artist() string {
// PERFORMER
// The artist(s) who performed the work. In classical music this would be the
// conductor, orchestra, soloists. In an audio book it would be the actor who
// did the reading. In popular music this is typically the same as the ARTIST
// and is omitted.
if m.c["performer"] != "" {
return m.c["performer"]
}
return m.c["artist"]
}
It turned out that m.c["performer"]
was " "
which caused the library to return it instead.
ID3v1 and ID3v2 doesn't do this, so why does Vorbis? Metadata for each audio file varies, and when I call a method like Artist
, I expect m.c["artist"]
, not m.c["performer"]
.
I was originally thinking about using Metadata#Raw()
to mitigate this, but after seeing the note that says that it is an unstable mapping, which was expected, I couldn't risk instability for my program.
I have the same issue, this is very strange behavior that really shouldn't be there