Read mp3 tags

I’m a newbie for Ruby. I am reading an application to read mp3 tags.
I’ve below code to read Binary file, please help me to make full code
and rhtml viewing file when submit a form and show data on browser.

=====================

def parse_id3(mp3_file)
fields_and_sizes = [[:track_name, 30], [:artist_name, 30],
[:album_name, 30], [:year, 4], [:comment, 30],
[:genre, 1]]
tag = {}
open(mp3_file) do |f|
f.seek(-128, File::SEEK_END)
if f.read(3) == ‘TAG’ # An ID3 tag is present
fields_and_sizes.each do |field, size|
# Read the field and strip off anything after the first null
# character.
data = f.read(size).gsub(/\000.*/, ‘’)
# Convert the genre string to a number.
data = data[0] if field == :genre
tag[field] = data
end
end
end
return tag
end