A PHP script to show current QTSS song on the web

Dec 22, '02 05:13:43PM

Contributed by: Anonymous

Here is a script that will display the currently playing track info from QT SS on a web page using php.

This was basically written by vonleigh with help from nosaj56 in the forums - thanks guys!

<?php 

// Define path to playlist.current
// Change to match your playlist name and path
$path = "/path/to/QTSS/playlist.current";

// Read playlist.current into $file
$file = fopen($path, "r");

// Read the contents of $file into $content
$content = fread ($file, filesize($path));

// Separate into parts and put in $info array
$info = explode("/",$content);

// Delete .mp3
$song = substr($info[5], 0, -4);

// Make sure to close after you open
fclose($file);

// Print the information
echo "<br> Track: $song <br>";
echo "<br> Album: $info[4] <br>";
echo "<br> Artist: $info[3] <br>";

?>
You might need to change the permisions of the playlist directory with chmod 777 to get it to work.

Comments (2)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20021222141343572