From: jMR Date: 2007-08-27T10:54:28+09:00 Subject: [SOLUTION][QUIZ] ID3 Tags (#136) ------=_Part_88855_31000669.1188179665345 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline class ID3reader attr_reader :song, :album, :artist, :comment,:year,:genre,:track TAG =3D 3 SONG =3D 30 ALBUM =3D 30 ARTIST =3D 30 YEAR =3D 4 COMMENT =3D 30 GENRE =3D 1 GENRE_LIST =3D ["Blues","Classic Rock","Country","Dance","Disco","Funk","Grunge","Hip-Hop","Jazz","Metal", "New Age","Oldies","Other","Pop","R&B","Rap","Reggae","Rock","Techno","Industria= l", "Alternative","Ska","Death Metal","Pranks","Soundtrack","Euro-Techno","Ambient","Trip-Hop","Vocal", "Jazz+Funk","Fusion","Trance","Classical","Instrumental","Acid","House","Ga= me","Sound Clip", "Gospel","Noise","AlternRock","Bass","Soul","Punk","Space","Meditative","In= strumental Pop","Instrumental Rock", "Ethnic","Gothic","Darkwave","Techno-Industrial","Electronic","Pop-Folk","E= urodance","Dream","Southern Rock", "Comedy","Cult","Gangsta","Top 40","Christian Rap","Pop/Funk","Jungle","Native American","Cabaret","New Wave", "Psychadelic","Rave","Showtunes","Trailer","Lo-Fi","Tribal","Acid Punk","Acid Jazz","Polka","Retro","Musical", "Rock & Roll","Hard Rock","Folk","Folk-Rock","National Folk","Swing","Fast Fusion","Bebob","Latin","Revival", "Celtic","Bluegrass","Avantgarde","Gothic Rock","Progressiv= e Rock","Psychedelic Rock","Symphonic Rock","Slow Rock", "Big Band","Chorus","Easy Listening","Acoustic","Humour","Speech","Chanson","Opera", "Chamber Music","Sonata","Symphony","Booty Bass","Primus","Porn Groove","Satire", "Slow Jam","Club","Tango","Samba","Folklore","Ballad","Power Ballad","Rhythmic Soul", "Freestyle","Duet","Punk Rock","Drum Solo","A capella","Euro-House","Dance Hall"] def initialize(mp3_file_path) mp3file =3D File.open(mp3_file_path,"r") mp3file.seek(-128, IO::SEEK_END) unless mp3file.read(TAG) !=3D "TAG" @song =3D mp3file.read(SONG).strip @artist =3D mp3file.read(ARTIST).strip @album =3D mp3file.read(ALBUM).strip @year =3D mp3file.read(YEAR).strip @comment =3D mp3file.read(COMMENT) unless (@comment[28..29] =3D~ /\0[:cntrl:]?/).nil? @track =3D @comment[29].to_i @comment[29]=3D0 end @comment.strip! @genre =3D GENRE_LIST[mp3file.read(GENRE).to_i] mp3file.close end end end irb(main):001:0> require 'id3reader' irb(main):003:0> ID3reader.new("5.mp3") #No tag's =3D> # irb(main):004:0> ID3reader.new("10.mp3") =3D> # irb(main):005:0> Juan Matias Repetti --=20 =ABQuien nunca ha cometido un error nunca ha probado algo nuevo.=BB ------=_Part_88855_31000669.1188179665345--