Skip to content

Repository files navigation

ruby-mp3info

originally by Guillaume Pierronnet

Currently i am porting to ruby 1.9 and have some bugs etc.

ruby-mp3info read low-level informations and manipulate tags on mp3 files.

  • written in pure ruby

  • read low-level informations like bitrate, length, samplerate, etc…

  • read, write, remove id3v1 and id3v2 tags

  • correctly read VBR files (with or without Xing header)

  • only 2.3 version is supported for writings id3v2 tags

a good exercise is to read the test.rb to understand how the library works deeper

require"mp3info"# read and display infos & tagsMp3Info.open("myfile.mp3") do|mp3info|putsmp3infoend# read/write tag1 and tag2 with Mp3Info#tag attribute# when reading tag2 have priority over tag1# when writing, each tag is written.Mp3Info.open("myfile.mp3") do|mp3|putsmp3.tag.titleputsmp3.tag.artistputsmp3.tag.albumputsmp3.tag.tracknummp3.tag.title = "track title"mp3.tag.artist = "artist name"endMp3Info.open("myfile.mp3") do|mp3|# you can access four letter v2 tags like thisputsmp3.tag2.TIT2mp3.tag2.TIT2 = "new TIT2"# or like thatmp3.tag2["TIT2"]
# at this time, only COMM tag is processed after reading and before writing# according to ID3v2#options hashmp3.tag2.options[:lang] = "FRE"mp3.tag2.COMM = "my comment in french, correctly handled when reading and writing"end# tags v2 will be read and written according to the :encoding settingsmp3 = Mp3Info.open("myfile.mp3", :encoding=>'utf-8')
  • iconv

$ ruby install.rb config
$ ruby install.rb setup
# ruby install.rb install

or

# gem install ruby-mp3info

ruby

  • encoder detection

  • support for more tags in id3v2

  • generalize id3v2 with other audio formats (APE, MPC, OGG, etc…)

About

A gem for getting and setting MP3 tags etc

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages