Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7765609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:12:28+00:00 2026-06-01T15:12:28+00:00

I have a list of files on a server and would like to load

  • 0

I have a list of files on a server and would like to load and parse only the ID3 from each file.

The code below loads the entire file, which is (obviously) very time consuming when batched.

require 'mp3info'
require 'open-uri'

uri = "http://blah.com/blah.mp3"

Mp3Info.open(open(uri)) do |mp3|
    puts mp3.tag.title   
    puts mp3.tag.artist   
    puts mp3.tag.album
    puts mp3.tag.tracknum
end
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:12:29+00:00Added an answer on June 1, 2026 at 3:12 pm

    Well this solution works for id3v2 (the current standard). ID3V1 doesn’t have the metadata at the beginning of the file, so it wouldn’t work in those cases.

    This reads the first 4096 bytes of the file, which is arbitrary. As far as I could tell from the ID3 documentation, there is no limit to the size, but 4kb was when I stopped getting parsing errors in my library.

    I was able to build a simple dropbox audio player, which can be seen here:
    soundstash.heroku.com

    and open-sourced the code here: github.com/miketucker/Dropbox-Audio-Player

    require 'open-uri'
    require 'stringio'
    require 'net/http'
    require 'uri'
    require 'mp3info'
    
    url = URI.parse('http://example.com/filename.mp3') # turn the string into a URI
    http = Net::HTTP.new(url.host, url.port) 
    req = Net::HTTP::Get.new(url.path) # init a request with the url
    req.range = (0..4096) # limit the load to only 4096 bytes
    res = http.request(req) # load the mp3 file
    child = {} # prepare an empty array to store the metadata we grab
    Mp3Info.open( StringIO.open(res.body) ) do |m|  #do the parsing
        child['title'] = m.tag.title 
        child['album'] = m.tag.album 
        child['artist'] = m.tag.artist
        child['length'] = m.length 
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a long list of files and file extensions which I would like
I have a list of files that I would like analyze. They are all
I have a list of files (stored in a database) that I would like
Background : I have a anonymous login ftp server, ftp_nlist only list files alphabetically,
I would like to have a list of clients in a separate HTML file
I have a list of files like this: wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep1.fastq.trim.tags.sam wgEncodeCaltechRnaSeqGm12878R1x75dFastqRep2.fastq.trim.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim00.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim01.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep1.fastq.trim02.tags.sam wgEncodeCshlLongRnaSeqGm12878CellPapFastqRd1Rep2.fastq.trim00.tags.sam
I'm using ftplib for connecting and getting file list from FTP server. The problem
I have some offline databases on a SQL server. I would like to know
I have a list of options that I read from an xml file. In
I have a function that downloads files from a web server that is sometimes

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.