Solved

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

Posted on 2014-12-15
3
438 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
ID: 40501537
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
ID: 40501775
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
ID: 40501807
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

810 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