<?
 
 
    /*
 
    PHP Script for "What's playing" Winamp 3 plugin
 
    
 
    Using the "What's Playing" plugin for Winamp 3 (available at http://www.srijith.net/codes/whatsplaying/),
 
    this script retrieves information about the current song you are hearing in your Winamp, along with a list of the latest songs you've heared.
 
    
 
    Come to http://phpspain.hexoplastia.com/projects/whatsplaying for more info and in-detail installation instructions.
 
    
 
    Author: Llorenç Herrera [[email protected]]
 
    
 
    Greets:
 
    This script is strongly based in the Winamp 3 plugin "What's Playing", by Srijith, available at http://www.srijith.net/codes/whatsplaying/
 
    */
 
 
    // This script has to be called by the "What's Playing" plugin for Winamp 3, available at http://www.srijith.net/codes/whatsplaying/ (see README for more details on how to do this)
 
    // This script have to have filesystem rights to write a file in the same directory as it's placed.
 
 
    include "whatsplaying.conf.php";
 
    
 
    $js = "";
 
    
 
    jsline($table_start);
 
    $songloop = true;
 
    $songcount = 1;
 
    $colcount = 1;
 
    while($songloop)
 
    {
 
        if(!$isjslastplayed && $songcount > 1)
 
            break;
 
            
 
        if(isset($_GET[$songcount]))
 
        {
 
            $song = str_replace("\\'", "´", $_GET[$songcount]);
 
            $whatsplaying["songs"][] = $song;
 
            if($_GET["p"] && $songcount == 1)
 
            {
 
                $tojs = str_replace("{song}", $song, $nowplaying_song);
 
            }
 
            else
 
            {
 
                $tojs = str_replace("{columncount}", $colcount, $lastplayed_song);
 
                $tojs = str_replace("{song}", $song, $tojs);
 
            }
 
            jsline($tojs);
 
        }else{
 
            $songloop = false;
 
        }
 
        $songcount ++;
 
        $colcount ++;
 
        if($colcount > 2)
 
            $colcount = 1;
 
    }
 
    jsline($table_end);
 
 
    $whatsplaying["nowplaying"] = $_GET["p"];
 
 
    $r = serialize($whatsplaying);
 
 
    if($issaveserialized)
 
    {
 
        $fp = fopen("whatsplaying.serialized", "w");
 
        fwrite($fp, $r);
 
        fclose($fp);
 
    }
 
 
    if($issavejs)
 
    {
 
        $fp = fopen("whatsplaying.js", "w");
 
        fwrite($fp, $js);
 
        fclose($fp);
 
    }
 
    
 
    function jsline($string)
 
    {
 
        global $js;
 
        $js .= "document.writeln('".$string."');\n";
 
    }
 
 
?>
 
 
 |