Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-12-15
3
Medium Priority
?
467 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

In this article, we’ll look at how to deploy ProxySQL.
It’s a season to be thankful, and we’re thankful for users like you who engage on site, solve technology problems, and network with others in the industry. What tech are we most thankful for? Keep reading.
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 create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

824 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