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

Fix for extracting jpegs from id3v2 #57

Closed ekaminsky closed 9 years ago

ekaminsky commented 9 years ago

As far as I could tell, extracting jpegs from id3v2 tags wasn't working before (at least, in some situations?).

The problem seemed to be, whenever \xFF\xD8 wasn't in the expected position after the unpack call, real_start = pic =~ start always returned nil, since the start regex started with an ^.

It seems that PNGs would have had the same issue, so I made the same change there.

In addition, expecting \377 as the start of a jpeg didn't seem to work for my mp3s, and \xFF\xD8 worked better (according to my google searches, jpegs do indeed always start with FF D8).

moumar commented 9 years ago

thanks!!