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 7542327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:08:15+00:00 2026-05-30T08:08:15+00:00

Friends, I am trying to processing a huge amount of audio files using a

  • 0

Friends,

I am trying to processing a huge amount of audio files using a Ruby (1.9.3) script by scanning their ID3-Tags using the pretty fast taglib-ruby (0.2.1 via Gem-Server) library.

Here is a part of my code, while audio contains the full file path in a Ruby-String:

begin 
  file_ref = TagLib::FileRef.new(audio) 
  unless file_ref.tag.nil? 
     unless file_ref.tag.artist.nil? or file_ref.tag.title.nil?
       …
     end
  end
ensure
 file_ref = nil
end

Then I get into trouble nearly at the end of the processing. TagLib is complaining about missing read permissions and FileUtils.mv is not longer able to move file afterwards. This is probably the case, because my script does not free file handles TagLib is eating while processing.

Unfortunalty I don not found a certain Ruby method in taglib-ruby API, which eventually call one or better both of TagLibs C-functions:

taglib_tag_free_strings();
taglib_file_free(file);

libmagic Ruby bindings for instance provide a close-Method within its Magic class, so that freeing whithin ensure blocks will work.

Am I just missing the correct Ruby method for taglib-ruby or is it missing at the moment? Is there another way of freeing file handles acquired via Ruby?

  • 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-05-30T08:08:16+00:00Added an answer on May 30, 2026 at 8:08 am

    I’m assuming you are in fact using taglib-ruby, not the old ruby-taglib. If you’re using taglib-ruby, FileRef (and other ::File classes) have an explicit close method since version 0.3.0, see API documentation.

    Update: Since 0.4.0, an even better solution is to use the open class method, which takes a block and handles the closing automatically for you after the block is run. See documentation of open. An example:

    TagLib::FileRef.open(file_name) do |file|
      tag = file.tag
      # do things with tag
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a list of user's friends using fb connect for the
I'm trying to get friends count via my account using Facebook API. Its working
friends, i am trying to check internetconnectivity in android and using following code final
friends, i am trying to upload file to php server using following tutorial http://getablogger.blogspot.com/2008/01/android-how-to-post-file-to-php-server.html
We are two friends trying to develop an application on local network using symfony
Hello Friends I am trying to compose two images in imagemagick shell script commane
I'm trying to find out who the friends of 'x' are, and using that
I am trying to tag friends in facebook video, using Facebook API, I am
I am trying to get the names of my friends using FB Graph API
I am trying to get Online Friends by using following code. protected void GetActiveFriends()

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.