Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

George Petrov
George Petrov
9,663 Points

Uploading and Streaming Music

Dear community, I am honestly tired of searching and StackOverflowing. I want to allow the users of my Ruby on Rails app to upload music and to be able to stream thus music through the website with plugins such as jQuery player. Such plugins require quite a lot of info about each individual upload (song), which is where I drowned.

Paperclip does wonders for images, by automatically including attributes containing detailed information about each picture. Similarly I want to be able to get the song duration, name, format, bit rate, etc. during the upload and store them as attributes to the song model.

My question is how to extract this information from (for example) an mp3 file and add it to the song model on each individual upload.

Thank you community and treehouse island!, George Petrov

1 Answer

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Hey George Petrov check out the "ruby-mp3info" and "taglib-ruby" projects. You'll have to do a fair bit of work to get them working with Paperclip automatically but that would be the easiest way.