HowTo: Creating m3u/pls with php from sockso MySQL
HowTo: Creating m3u/pls with php from sockso MySQL
< ?php
/*
usage: www.mymusic.hostname.lt/?q=Song or Artist name
author: FaFaS
web: http://www.fafas.lt
*/
$q=$_GET["q"]; if (isset($q)) { //connecting to mysql. Set your dbhost user and pwd ;) $con = mysql_connect('dbhost', 'dbuser', 'dbpwd'); if (!$con) { die('Could not connect: ' . mysql_error()); } //setting up charset to UTF-8 mysql_query("DEFAULT CHARACTER SET utf8"); mysql_query("COLLATE utf8_lithuanian_ci"); mysql_query("SET NAMES utf8"); mysql_select_db("sockso", $con); $sql="SELECT `id`,`name` from tracks WHERE `name` LIKE '%".mysql_real_escape_string( $_GET['q'])."%' or `path` LIKE '%".mysql_real_escape_string( $_GET['q'])."%'"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)) { //replacing spaces $blogieciai = array(" "); $no = str_replace($blogieciai, "+", $row['name']); //generating playlist //replace hostname from http://www.mymusic.hostname.lt:4444/stream/ to yours sockso stream url $livePlaylist .= '#EXTINF:-1,'.$row['name'].' http://www.mymusic.hostname.lt:4444/stream/'.$row['id'].'/'.$no.' '; } //everything what was found to .m3u header("Content-type: application/m3u;\n"); header("Content-Transfer-Encoding: binary"); $outname=$q.'.m3u'; header("Content-Disposition: attachment; filename=\"$outname\";\n\n"); echo $livePlaylist; mysql_close($con); }



How much money has passed thru your hands in a lifetime?
Did not counted :P