Solved

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

Posted on 2014-12-15
3
442 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 43

Expert Comment

by:Rob
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 43

Accepted Solution

by:
Rob 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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Creating and Managing Databases with phpMyAdmin in cPanel.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

830 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