| Vorheriges Thema anzeigen :: Nächstes Thema anzeigen |
| Autor |
Nachricht |
Manu2209 Ist hier öfters
|
Verfasst am: 27.01.2007 - 19:22 Titel: Für alle die mit shoutcast senden |
|
|
hallo habe da was tolles gefunden
für alle die mit shoutcast senden
hier mal ein kleines script
einfach im shoutcast wo aim steht die zahlen einfügen im script die bilder anpassen
und das ganze hochladen
___________________________________________________________
| Code: |
<?php
$host = "**********"; //Hostname, or ip address of server. IE blah.com or xx.xx.xx.xx
$port = "**********"; //Port server is running on. IE 8000
$password = "**********"; //Password of server, can be normal or admin. Doesn't matter.
//Configuration Finished
//Runs each time an XML element starts
function StartHandler(&$Parser, &$Elem, &$Attr) {
global $Data, $CData;
/* Start with empty CData array. */
$CData = array();
/* Put each attribute into the Data array. */
while ( list($Key, $Val) = each($Attr) ) {
$Data["$Elem:$Key"] = trim($Val);
// debug // echo "$Elem:$Key = " . $Data["$Elem:$Key"] . "\n";
}
}
//Runs each time XML character data is encountered
function CharacterHandler(&$Parser, &$Line) {
global $CData;
/*
* Place lines into an array because elements
* can contain more than one line of data.
*/
$CData[] = $Line;
}
//Runs each time an XML element ends
function EndHandler(&$Parser, &$Elem) {
global $Data, $CData, $listeners, $server, $song, $dj, $wee;
//Mush all of the CData lines into a string and put it into the $Data array.
$Data[$Elem] = trim( implode('', $CData) );
//echo "$Elem = " . $Data[$Elem] . "<br>\n";
switch ($Elem){
//for each case, we are putting some data into a variable.
case 'AIM':
$dj['AIM'] = $Data['AIM'];
break;
}
}
//open connection
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
if (!$fp) {
echo "Connection to server could not be established! <BR>";
}
else {
//request xml
fputs($fp,"GET /admin.cgi?pass=".$password."&mode=viewxml&page=0 HTTP/1.0\nUser-Agent: Mozilla Compatible\n\n");
while(!feof($fp)) {
//put xml into $Data
$Contents .= fgets($fp, 1000);
}
}
//close connection
fclose($fp);
$Contents = str_replace('HTTP/1.0 200 OK','', $Contents);
$Contents = str_replace('Content-Type:text/xml','', $Contents);
$Contents = str_replace("\n",'', $Contents);
$Contents = str_replace("\r",'', $Contents);
$Contents = preg_replace('/(&|&)/i', '&', $Contents);
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
$Data = array();
// Initialize the parser.
$Parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_handler($Parser, 'CharacterHandler');
//Pass the content string to the parser.
if (!xml_parse($Parser, $Contents)) {
$Probs[] = "$URI$Sym\n Had problem parsing file:\n "
. xml_error_string(xml_get_error_code($Parser));
}
if (isset($Probs)) {
echo implode("\n", $Probs);
}
//Output
$search = array('NA','N/A','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19');
$replace = array('<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/Raven.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/aggromacro.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/bild cfr.jpg" BORDER="0"></A><br>','<IMG SRC="tuhfotos/djkati.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/kaya.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/djkev.jpg" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/nicole.bmp" BORDER="0"></A><br>','<IMG SRC="tuhfotos/marcel1.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/CFR DJ Rock.jpg" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/Lucas_Pic.jpg" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/okki.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/BildFolgt.gif" BORDER="0"></A><br>','<IMG SRC="tuhfotos/sunny.JPG" BORDER="0"></A><br>','<IMG SRC="tuhfotos/lundener.JPG" BORDER="0"></A><br>');
echo str_replace($search, $replace, "
<tr><td></td><td>{$dj[AIM]}</td></tr>\n
");
?>
|
---------------------------------------------------------
wäre mal net wenn ihr sacht wie ihr es findet
lg
manu |
|
| Nach oben |
|
 |
schwarzezone Postet sich warm
|
Verfasst am: 25.06.2007 - 08:10 Titel: RE: Für alle die mit shoutcast senden |
|
|
hallo also das teil ist ermal gut
nur mal jetzt meine frage wie kann man das umbauen so das der dj nicht mehr angezeit wird wenn das radio offline ist weil im xnl steht nich die aim nummer und darum wird der DJ auch weiterhin angezeit auch wenn das radio off ist
kann mir da jemand helfen oder vieleicht auch mir denn code schicken?
( sagen was ich ändern muß? )
liebe grüße
mario |
|
| Nach oben |
|
 |
Jen Postet sich warm
|
Verfasst am: 26.06.2007 - 22:09 Titel: RE: Für alle die mit shoutcast senden |
|
|
ich mache das per gd imagecreate.
mit dem php script hat man auch dann die möglichkeit andere anzeigen, je nach status des radios, ins bild reinzuschreiben.
wenn mein radio nun mal off ist, dann kannst du es in meiner siggi sehen. da ist dann nur die info, das es off ist, aber keine alten infos... (s. http://ebm.jenworld.de/)
php code kann ich dir geben. _________________ cya, Jen
 |
|
| Nach oben |
|
 |
schwarzezone Postet sich warm
|
Verfasst am: 28.06.2007 - 08:54 Titel: RE: Für alle die mit shoutcast senden |
|
|
oh das wer lieb von dir wenn du das an die email schicken könntest ich würde dich knuddeln
vielen vielen dank in vorraus
Zuletzt bearbeitet von schwarzezone am 07.08.2008 - 16:39, insgesamt einmal bearbeitet |
|
| Nach oben |
|
 |
Jen Postet sich warm
|
Verfasst am: 13.07.2007 - 06:05 Titel: Re: RE: Für alle die mit shoutcast senden |
|
|
| schwarzezone hat folgendes geschrieben: | oh das wer lieb von dir wenn du das an die email schicken könntest ich würde dich knuddeln
info@nebelwelten-radio.de
vielen vielen dank in vorraus | ist soeben raus. wenn du noch fragen hast, dann melden. _________________ cya, Jen
 |
|
| Nach oben |
|
 |
BaLBoRa Postet sich warm
|
Verfasst am: 13.07.2007 - 22:50 Titel: RE: Für alle die mit shoutcast senden |
|
|
Hallo, ich bin auch an dem script interessiert... könntest dues mir auch bitte schicken? Das wäre hammer...
meine email-adresse: balbora@germandreamradio.de
dDAnke im Vorraus
mfg
bALBoRa |
|
| Nach oben |
|
 |
Jen Postet sich warm
|
Verfasst am: 14.07.2007 - 16:17 Titel: RE: Für alle die mit shoutcast senden |
|
|
*eg* ich habs mir schon gedacht... ich werd das mal hier rein packen, dann kann man auch die aufkommenden fragen dazu hier diskutieren.
| Code: |
<?php
// put this in script and then script show allso offline message when the shout DNAS is
// totally shut down, example when server is in your computer and you put computer off,
// still you can see offline message of server
error_reporting(0);
Header("Content-type: image/png");
// Fill in your own server information here:
$host = "radio.jenworld.de";
$port = "8000";
// Make link to stream:
$listenlink = 'http://radio.jenworld.de/listen.pls';
//Password of server, can be normal or admin. Doesn't matter.
$password = "HereEnterYourPassword";
//Configuration Finished
//Runs each time an XML element starts
function StartHandler(&$Parser, &$Elem, &$Attr) {
global $Data, $CData;
/* Start with empty CData array. */
$CData = array();
/* Put each attribute into the Data array. */
while ( list($Key, $Val) = each($Attr) ) {
$Data["$Elem:$Key"] = trim($Val);
// echo "$Elem:$Key = " . $Data["$Elem:$Key"] . "\n";
}
}
//Runs each time XML character data is encountered
function CharacterHandler(&$Parser, &$Line) {
global $CData;
/*
* Place lines into an array because elements
* can contain more than one line of data.
*/
$CData[] = $Line;
}
//Runs each time an XML element ends
function EndHandler(&$Parser, &$Elem) {
global $Data, $CData, $listeners, $server, $servertitle, $song, $irc, $dj, $wee;
//Mush all of the CData lines into a string and put it into the $Data array.
$Data[$Elem] = trim( implode('', $CData) );
// echo "$Elem = " . $Data[$Elem] . "<br>\n";
switch ($Elem){
//for each case, we are putting some data into a variable.
case 'SERVERTITLE':
$servertitle['SERVERTITLE'] = $Data['SERVERTITLE'];
break;
case 'SERVERGENRE':
$server['GENRE'] = $Data['SERVERGENRE'];
break;
case 'IRC':
$irc['IRC'] = $Data['IRC'];
break;
case 'AIM':
$dj['AIM'] = $Data['AIM'];
break;
}
}
//open connection
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
if (!$fp) {
// echo "Connection to server could not be established! <BR>";
}
else {
//request xml
fputs($fp,"GET /admin.cgi?pass=".$password."&mode=viewxml&page=0 HTTP/1.0\nUser-Agent: Mozilla Compatible\n\n");
while(!feof($fp)) {
//put xml into $Data
$Contents .= fgets($fp, 1000);
}
}
//close connection
fclose($fp);
$Contents = str_replace('HTTP/1.0 200 OK','', $Contents);
$Contents = str_replace('Content-Type:text/xml','', $Contents);
$Contents = str_replace("\n",'', $Contents);
$Contents = str_replace("\r",'', $Contents);
$Contents = preg_replace('/(&|&;)/i', '&', $Contents);
$Contents = preg_replace('/[^\x20-\x7E\x09\x0A\x0D]/', "\n", $Contents);
$Data = array();
// Initialize the parser.
$Parser = xml_parser_create('ISO-8859-1');
xml_set_element_handler($Parser, 'StartHandler', 'EndHandler');
xml_set_character_data_handler($Parser, 'CharacterHandler');
//Pass the content string to the parser.
if (!xml_parse($Parser, $Contents)) {
$Probs[] = "$URI$Sym\n Had problem parsing file:\n " . xml_error_string(xml_get_error_code($Parser));
}
if (isset($Probs)) {
echo implode("\n", $Probs);
}
//open connection
$fp = fsockopen("$host", $port, &$errno, &$errstr, 30);
if(!$fp) {
//set if no connection
$success=2;
}
//if connection
if($success!=2) {
//get 7.html
fputs($fp,"GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n");
while(!feof($fp)) {
$page .= fgets($fp, 1000);
}
//close connection
fclose($fp);
//extract data
$page = ereg_replace(".*<body>", "", $page);
$page = ereg_replace("</body>.*", ",", $page);
$numbers = explode(",",$page);
//set variable
$currentlisteners=$numbers[0];
$connected=$numbers[1];
//if DSP is connected
if($connected==1) {
//set variable
$wordconnected="yes";
}
//if no DSP connection
else {
//set variable
$wordconnected="no";
$peaklisteners=$numbers[2];
$maxlisteners=$numbers[3];
$reportedlisteners=$numbers[4];
$bit=$numbers[5];
}
}
// Image size can be changed here: (x, y)
$im = ImageCreate(350,75);
// Background color in R(ed)G(reen)B(lue) below
$background_color = ImageColorAllocate($im,0,0,0);
// text colors also in RGB
$text_color1 = ImageColorAllocate($im,999,999,999);
$text_color2 = ImageColorAllocate($im,999,0,0);
if($success!=2 && $connected==1) {
// song information is splitted in artist - title:
// This requires consistent artist & title format (no ' - ' in title/artist)
// else you can use $numbers[6] as current song info below
$song=explode(" - ",$numbers[6]);
// strings can of course be replaced with your own bla
// $string1= "$server[GENRE] Playing:";
$string1= "$servertitle[SERVERTITLE] Playing:";
$string2= $song[0];
$string3= $song[1];
$string4= "Send requests on GameSurge Channel: ".$irc[IRC];
$string5= "DJ: " . $dj[AIM];
}
else {
$string1= "JenWorld-Radio is currently";
$string2= "OFFLINE";
$string5= "Please return later.";
}
// positioning below
$px = (imagesx($im)-5*strlen($string1))/2;
ImageString($im,1,$px,5,$string1,$text_color1);
// (image,font (from 1 to 5),starting x position, y position,line of text,color)
$px = (imagesx($im)-5*strlen($string2))/2;
ImageString($im,1,$px,20,$string2,$text_color2);
$px = (imagesx($im)-5*strlen($string3))/2;
ImageString($im,1,$px,30,$string3,$text_color2);
$px = (imagesx($im)-5*strlen($string4))/2;
ImageString($im,1,$px,45,$string4,$text_color1);
$px = (imagesx($im)-5*strlen($string5))/2;
ImageString($im,1,$px,55,$string5,$text_color1);
ImagePng($im);
ImagePng($im, "RadioStatus.png");
// In response to KXRM's reaction:
// if you want to cache the picture, you should place this script in
// your internetpage, remove line 5 (Header-call)
// and use ImagePng($im, "filename.png");
// NB: filename.png must have the right permission settings
// (CHMOD 777 does it)
//
// Then you can place filename.png in the same html-file.
ImageDestroy($im);
?>
|
Der Vorteil an diesem Script ist, daß das daraus resutierende Bild absolut flexibel gestaltet werden kann. PHP kenntnisse natürlich vorrausgesetzt
Auch ist es in einigen Foren möglich innerhalb des IMG-Tag einen Aufruf von der php Seite in den Signaturen zu machen: | Code: | | [url=http://radio.jenworld.de/][img]http://radio.jenworld.de/ImagePlay.php[/img][/url] |
Dann aktualisiert sich das Bild immer fein automatisch
Nur hier geht es nich *schnüff* _________________ cya, Jen
 |
|
| Nach oben |
|
 |
rmadjmicha Postet sich warm
|
Verfasst am: 22.07.2007 - 18:21 Titel: RE: Für alle die mit shoutcast senden |
|
|
Hallo zusammen,
welche Zahlen müßen bei AIM eingetragen werden?
und speicher ich das Script als php datei ab um es in einer Navbox anzeigen zu können?
lg |
|
| Nach oben |
|
 |
Jen Postet sich warm
|
Verfasst am: 22.07.2007 - 19:53 Titel: RE: Für alle die mit shoutcast senden |
|
|
in meinem script wird im AIM feld nur der name des DJ's eingetragen.
ja, das ist ein php script, das auf einem webserver mit php laufen muss.
in einigen foren kann man das dann auch sogar in der siggi aufrufen lassen... in diesem hier geht das aber nicht  _________________ cya, Jen
 |
|
| Nach oben |
|
 |
ThoRr Postet sich warm
|
Verfasst am: 07.10.2007 - 14:52 Titel: RE: Für alle die mit shoutcast senden |
|
|
Ich blick durch das Skript irgendwie nicht durch Wozu ist das? Kann man das auch so umbauen, dass das Titel an den Server sendet? |
|
| Nach oben |
|
 |
schwarzezone Postet sich warm
|
Verfasst am: 07.08.2008 - 16:39 Titel: Re: RE: Für alle die mit shoutcast senden |
|
|
| Jen hat folgendes geschrieben: | | schwarzezone hat folgendes geschrieben: | oh das wer lieb von dir wenn du das an die email schicken könntest ich würde dich knuddeln
vielen vielen dank in vorraus | ist soeben raus. wenn du noch fragen hast, dann melden. |
|
|
| Nach oben |
|
 |
|
|
Du kannst keine Beiträge in dieses Forum schreiben. Du kannst auf Beiträge in diesem Forum nicht antworten. Du kannst deine Beiträge in diesem Forum nicht bearbeiten. Du kannst deine Beiträge in diesem Forum nicht löschen. Du kannst an Umfragen in diesem Forum nicht mitmachen.
|
Powered by phpBB © 2001, 2005 phpBB Group
|