moumar / ruby-mp3info

ruby-mp3info read low-level informations and manipulate tags on mp3 files.
http://rdoc.info/github/moumar/ruby-mp3info/master/frames
223 stars 57 forks source link

tag.pictures array is empty #29

Open adamyonk opened 11 years ago

adamyonk commented 11 years ago

I'm seeing the following behavior:

> mp3info.tag.pictures
  => []
> mp3info.tag2.PIC
  => "\\0JPG\\<<<...snip...>>>"
moumar commented 10 years ago

hello,

did you save the mp3 file before seeing this behaviour ?

thanks

RStankov commented 9 years ago

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.