Jump to content

Process to Scan thousands of files


Psycho

Recommended Posts

I am working on a project to make a web interface for my MP3 collection. It will include functionality to read the tags from the MP3 files and save them to a database. But, I'm at a loss as to how I should set up the scanning process since it will be doing a large number of files. I will most likely have the ability to scan newly added albums individually as they are added, but I will also need to have a full scan process to account for files that are moved or have had the tags changed.

 

Each album has been ripped to a separate folder, so there are a few hundred folders and thousands of files. Timing out of the script will be an issue as well.

 

I was thinking that utilizing AJAX would be a possible solution so I could have one request process a folder, when that completes a new request would process the next folder, etc. That would prevent timeout issues. But, how would I keep track between JS and PHP as to which folder is next? I was thinking of havng PHP do an initial scan of just the folders and then passing that back to the Javascript or saving to a text file. Then using that to monitor the next folder to process. But, I'm wondering if there is a more elegant solution.

 

Any ideas or solutions are welcome.

Link to comment
Share on other sites

Thanks, but that's appears to be a "complete" solution for accessing your MP3's. I'm building my own interface and am comfortable with all the functionality except for the process of scanning a large number of files.

 

FYI: There's a really nice free PHP app for this called Jinzora which I want to use, but it seems to always have several areas that are broken (installed different versions on several different machines/environments). So instead of reengineering someone elses code I decided I would build my own. http://en.jinzora.com/

Link to comment
Share on other sites

Sounds liek a good nightly cron to me. Simply call this

 

set_time_limit(0)

 

at the start, and it won't time out. Even then, PHP is fairly fast at iterating through files.. Unless it takes some serious power to pull the ID3 tags, i wouldn't worry about iterating through hundreds of folders once a night. I highly doubt it'd take more than 30 seconds anyway

Link to comment
Share on other sites

Unless it takes some serious power to pull the ID3 tags, i wouldn't worry about iterating through hundreds of folders once a night.

 

Agreed. I think it would depend on how often you're updating.

 

My Quicksilver mac app scans my computer every 10 minutes, which would be tricky, but I doubt you'll have to scan that often.

Link to comment
Share on other sites

Shame most of my library is in WMA which appears unsupported.

 

I think WMA is supported (it just doesn't stand out on that page). Under "Audio-Video formats" it states:

 

ASF (ASF, Windows Media Audio, Windows Media Video)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.