ruby-mp3info icon indicating copy to clipboard operation
ruby-mp3info copied to clipboard

tag.pictures array is empty

Open adamyonk opened this issue 11 years ago • 2 comments

I'm seeing the following behavior:

> mp3info.tag.pictures
  => []
> mp3info.tag2.PIC
  => "\\0JPG\\<<<...snip...>>>"

adamyonk avatar Apr 30 '13 19:04 adamyonk

hello,

did you save the mp3 file before seeing this behaviour ?

thanks

moumar avatar Nov 20 '13 11:11 moumar

hi @moumar

I have the same issue with this mp3:

http://traffic.libsyn.com/zenandtech/melton06.mp3

info.tag.pictures is empty because APIC is empty, but PIC is present.

I have a did a quick fix for my project and seems to work as a charm:

pictures = info.tag2.pictures

if pictures.empty?
  info.tag2['APIC'] = info.tag2['PIC']
  pictures = info.tag2.pictures
end

A possible fix can applied here:

https://github.com/moumar/ruby-mp3info/blob/master/lib/mp3info/id3v2.rb#L280

-- apic_images = [self["APIC"]].flatten.dup
++ apic_images = [Array(self["APIC"]) + Array(self["PIC"])].flatten

I can apply a pull request with this fix, if you think this is good enough.

RStankov avatar Jul 30 '15 15:07 RStankov