Jump to content

Jukebox using php


ilikephp

Recommended Posts

Something along the lines of

<?php
$path = "/path/to/mp3/folder/";
$dir = dir($path);
while(false !== ($file = $dir->read())) {
	if(!is_dir($path.$file)) {
		// read the file if an mp3
		if(strstr($file, ".mp3")) {
			$info = id3_get_tag($path.$file);
			/* will return the following
			Array
			(
				[title] => DN-38416
				[artist] => Re:\Legion
				[album] => Reflections
				[year] => 2004
				[genre] => 19
			)
			*/
			// store the file in the database
			mysql_query("INSERT INTO table SET filename='".mysql_real_escape_string($file)."', title='".mysql_real_escape_string($info['title'])."', album='".mysql_real_escape_string($info['album'])."'");
		}
	}
}
$dir->close();
?>

Dont forget to install the extension first

Link to comment
https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878743
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.