Jump to content

PHP (or MYSQL) to add time of mp3 file


bschultz

Recommended Posts

I need to write a bit of code to select some mp3's (actually, just the titles) from a database...but I need to select them based on last play (which is a timestamp field in the DB) AND I need to select 14 minutes worth of them (and not more than 15 minutes).  I currently do NOT know how long each song is...

 

So, if every song was 2 minutes long, I would need 7 songs.  If each song was 3 minutes long, I'd need to select 5 of them.

 

I currently do NOT have a length field in the db (the boss sprung this on me after I designed the DB).  A few questions:

 

Would it be best to have a column of TIME (mysql time...not the name of the column)? 

 

Would it be best to have a column for the raw size of the file (each file is the same bitrate, so I could do the math - plus it would be probably be easier to import raw filesize using php into the db)

 

Would it be easier to do something else?

 

Once we answer that, I'll start with some code...and probably be back for help!

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.