ilikephp Posted July 20, 2009 Share Posted July 20, 2009 hi, I am trying to create a jukebox for my website, I have over 300 songs, how can I add all the songs directly to the database instead of entering the name of each song. So I will add a script to my php files that lists all the songs in my database. Thanks... Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/ Share on other sites More sharing options...
JonnoTheDev Posted July 20, 2009 Share Posted July 20, 2009 You could import from a CSV file. You will need all song names, filenames in some format. Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878720 Share on other sites More sharing options...
ilikephp Posted July 20, 2009 Author Share Posted July 20, 2009 thx a lot for your help! for example the Adromeda software directly when it recognizes the folder, it directly add all the songs in a list. so there is no way unless I type them manually? Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878726 Share on other sites More sharing options...
zq29 Posted July 20, 2009 Share Posted July 20, 2009 glob() ID3 Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878727 Share on other sites More sharing options...
JonnoTheDev Posted July 20, 2009 Share Posted July 20, 2009 Didn't know there was an extension for ID3! nice. Read the files in your directory using php's filesystem functions and use the ID3 extension to get the songnames from the mp3's. Store the filenames/song names in your db. Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878734 Share on other sites More sharing options...
ilikephp Posted July 20, 2009 Author Share Posted July 20, 2009 I am reading the example, but if u dont mind can u give me a short example? Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-878740 Share on other sites More sharing options...
JonnoTheDev Posted July 20, 2009 Share Posted July 20, 2009 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 More sharing options...
ilikephp Posted July 21, 2009 Author Share Posted July 21, 2009 Do you know any tutorial about installing extensions plz? I tried to download them but I did not know where to put them Thanks... Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-879642 Share on other sites More sharing options...
JonnoTheDev Posted July 21, 2009 Share Posted July 21, 2009 Are you running linux? Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-879830 Share on other sites More sharing options...
ilikephp Posted July 24, 2009 Author Share Posted July 24, 2009 I am running Windows Vista Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-881833 Share on other sites More sharing options...
JonnoTheDev Posted July 26, 2009 Share Posted July 26, 2009 http://i.justrealized.com/2008/10/14/how-to-install-pear-modules-using-xampp/ Link to comment https://forums.phpfreaks.com/topic/166641-jukebox-using-php/#findComment-883155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.