Solved

php (or JS) to log music files in directory into a database

Posted on 2014-12-15
3
432 Views
Last Modified: 2014-12-15
Can anyone direct me to a tutorial or advise on how to do this:

I have a directory named "music" with 10 (each) mp3, ogg, and m4a music files 930 total)

I want to create a function, that when triggered will, shuffle through the directory and place the files' id3 data (title, artist, album, etc) into a predetermined database

So then I will be able to query a list such as:
song_title, artist, album, time, cover_image, genre, (etc)

and when new songs are added or deleted from the directory, and I retrigger, it will update the DB based on the contents of the directory.

Thank You - Davo
0
Comment
Question by:edavo
  • 2
3 Comments
 
LVL 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
This can only be done using a server side script such as PHP and even then I would look at non web based technologies.  Yes PHP can be run from the command line but there are more purposeful languages such as powershell / vb (windows) and perl, bash/sh on linux.

What's your server environment? Windows / Linux?

Do you need to have a front end interface?  If so, then PHP may be the best option.  Sorry for the questions but they will help get you the best answer.
0
 

Author Comment

by:edavo
Comment Utility
Linux… And yes it will feed a front end "player" also built in PHP and JS.
0
 
LVL 42

Accepted Solution

by:
Rob Jurd, EE MVE earned 500 total points
Comment Utility
Personally i would do this in two separate sections.  

One to read the files and import them as indicated here: http://php.net/manual/en/function.id3-get-tag.php.  This will read the files into an associative array where you can pull the relevant data you need and store it in your database.  Your PHP would obviously check if that file already exists or just overwrite it... up to you.  I would set this up as a CRON job or triggered when a new file is uploaded (assuming it is) OR you could run php script manually.

The other to be the front end player using PHP to query and serve the digital content along with javascript to manipulate it.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Creating and Managing Databases with phpMyAdmin in cPanel.
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now