Ruby mp3 Id3 parsing

后端 未结 5 546
你的背包
你的背包 2021-02-02 02:43

Currently I\'m working on a music project, dealing with user mp3 uploads. The problem is that I can\'t find an id3 library that will work correctly for all files. I have tried

5条回答
  •  闹比i
    闹比i (楼主)
    2021-02-02 02:55

    id3tag is another option. Example:

    require "id3tag"
    
    mp3_file = File.open('/path/to/your/favorite_song.mp3', "rb")
    tag = ID3Tag.read(mp3_file)
    puts "#{tag.artist} - #{tag.title}"
    

提交回复
热议问题