winamp script

LN5

Mitglied
Hellow ppl..

bin mir nicht ganz sicher, an welches Forum ich mich wenden soll.. versuche es hier mal:

habe mir so ein WinAmp-Plugin heruntergeladen, dass es mir ermöglicht den aktuellen Songtitel an die Datei winamp.php zu senden und auszugeben.

Folgend der Code:

PHP:
<?php

     /* ----------------------------------------------------------------
     | Scriptname : Info Sender's PHP Sidekick v3 PNG-Output
     | Taken From : appel@nr78.net
     | Updated By : Sami Khan - sukhan@ucalgary.ca (v2)
     | Updates By : Patrick aka Tutti patrick@pc-mind.de (v3)
     | Website    : http://www.pc-mind.de
     | License    : GPL'd (by Sami  ;-) )
     |
     | I find an Image-Output better ;-)
     | Make an empty file called winamp.txt,
     | put it in the same directory as this php file and then change the
     | permission of the file to 777 by doing a "chmod 777" at the console.
     | Copy the button.png in the same directory
     | Then simply simply point your Info-Sender to:
     | http://path_to_your/winamp.php?song=
     | Make sure you have all of the last part, ie. ?song=
     | Now look the picture with <img src="http://path_to_your/winamp.php">
     | Enjoy, any questions feel free to e-mail me.
     * ------------------------------------------------------------------ */


     $song     = $_GET[song];
     $filename = 'winamp.txt';
     $chars    = 50;
     // text in Picture
     $text     = "Ich höre gerade...";
    $text2    = "";

         // check if Info Sender is calling the script
         if(isset($_GET[song])) {

             // check if text file is writeable
             if(is_writable($filename)) {

                 // check if we can open the text file
                 if(!$handle = fopen($filename, 'w')) {
                      print "Cannot open file ($filename)";
                      exit;
                 }
                 
                 // check if we can wite to the text file
                 if(!fwrite($handle, stripslashes($song))) {
                     print "Cannot write to file ($filename)";
                     exit;
                 }

             // close the door behind you
             fclose($handle);

             }

         } else {

             // grab song title from text file
             $songname = @implode('',@file($filename));

    //new Edit PNG-Output

    // replace german special character
    $songname = ereg_replace("&Auml;","Ä",$songname);
    $songname = ereg_replace("&auml;","ä",$songname);
    $songname = ereg_replace("&Ouml;","Ö",$songname);
    $songname = ereg_replace("&ouml;","ö",$songname);
    $songname = ereg_replace("&Uuml;","Ü",$songname);
    $songname = ereg_replace("&uuml;","ü",$songname);
    $songname = ereg_replace("&szlig;","ß",$songname);

     // short the Songtext to 30 Characters
    
      if(strlen($songname) > $chars) {
        $songname = substr($songname,0,$chars);
        $songname .= "...";
         }

    //read Create-date of winamp.txt
    if (file_exists($filename))
        {
            $time = date("j.m.Y H:i", filectime($filename));
        }

    //now we build the png with the Songtext

     Header("Content-type: image/png");
     $im = ImageCreateFromPng("button.png");
     $color = ImageColorAllocate($im, 0, 0, 0);
     $color2 = ImageColorAllocate($im, 255, 255, 255);
     ImageString($im,1,315,3,$time,$color);
     ImageString($im,1,32,10,$text,$color);
     ImageString($im,2,35,18,$songname,$color);
     ImageString($im,1,195,30,$text2,$color2);
     ImagePng($im);
     ImageDestroy($im);
         }
     //end new Edit PNG-Output
?>

Jetzt möchte ich aber, dass wenn der Song zu Ende ist nicht mehr der Songtitel steht, sondern "nichts" z.B.. Entweder muss ich hierfür das WinAmp-Plugin umschreiben (keine Ahnung wie das geht) und das so machen, dass wenn kein Song läuft diese txt-Datei geleert wird, oder aber ich mache das im Script mittels "if" (nehmen wir an, kein Song dauert länger als 5 Minuten) und sage dem Script, dass es mir falls $time > 5 min (wie realisiere ich diesen Vergleich am besten) "nichts" ausgeben soll.

Welche der beiden Lösungsansätze haltet IHR für die bessere?

Danke für euren Rat!
 
Die Lösung mit den 5Minuten ist sicherlich die Beste. Vielleicht kannst du das PlugIn ja auch so umschreiben, dass er nicht nur Titel&Interpret, sondern auch Länge des Songs mitschickt, dann kannst du die 5Minuten ja durch die Länge des jeweiligen Songs ersetzen.

mAu

P.s.: Wen interessiert eigendlich, was für Musik man gerade hört? *kopfschüttel*
 
EigenTlich interessierts einige Leute. So abwegig kann die Idee nicht sein, zumal die Microsoft Etage die gleiche Idee auch für den MSN Messenger hatte. Nicht wahr?

Wer (welches Forum?) könnte mir denn helfen bei einem DLL-Umbau?
 
Zurück