hi leute,
ich probiere gerade das shoutcast plugin für meine site anzupassen.
leider komme ich bei folgenden punkten nicht weiter:
- ich möchte den stationsnamen auslesen ($station) und anzeigen
- track und artist ($playing) würde ich gerne voneinander trennen, um sie besser formatieren zu können
- die box müsste in etwa 3min abständen einen refresh kriegen, um immer den aktuellen titel angezeigt zu kriegen
wer kann mir bei diesen punkten helfen?
ich denke auch, diese ergänzungen könnten für mehrere wp-user interessant sein, damit kann man dieses plug auch ernsthaft verwenden...
dank im voraus!
et
code sieht so aus:
PHP
<?php
/*
Plugin Name: wp_Shoutcast
Plugin URI: http://www.curtisfamily.org.uk/wp_shoutcast.zip
Description: Displays "now playing" from a shoutcast server
Version: 1.5
Author: Chris Curtis
Author URI: http://www.curtisfamily.org.uk/
*/
function shoutcast() {
require 'wp_shoutcast_config.php';
echo '<li id="'.$station.'">';
_e($station);
echo '<ul>';
// Connect to server
$fp=@fsockopen($host,$port,$errno,$errstr,10);
if (!$fp) {
echo "$errstr ($errno)
\n";
} else {
// Get data from server
fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
// exit if connection broken
for($i=0; $i<1; $i++) {
if(feof($fp)) break;
$fp_data=fread($fp,31337);
usleep(500000);
}
// Strip useless junk from source data
$fp_data=ereg_replace("^.*<body>","",$fp_data);
$fp_data=ereg_replace("</body>.*","",$fp_data);
// Place values from source into variable names
list($current,$status,$peak,$max,$reported,$bit,$song) = explode(",", $fp_data, 7);
if ($status == "1") {
$air = "[*]<font weight='bold' color='green'>[b]on air[/b]</font>
\n";
} else {
$air = "[*]<font weight='bold' color='red'>[b]off air[/b]</font>
\n";
} }
// This is where you change the box layout
if (!$fp) {
$playing = "<font weight='bold' color='red'>derzeit kein signal</font>\n";
} else {
$playing = "[i]Programme/Song[/i]
[b]<a href=\"http://$host:$port/listen.pls\">$song</a>[/b]
[i]Bitrate:[/i] $bit kpbs
[i]Hörer:[/i] $current / $max\n";
}
echo $air;
echo $playing;
echo '[/list]';
echo '';
}
?>
Alles anzeigen
wp_shoutcast_config.php
PHP
<?php
// EDIT THE FOLLOWING THREE LINES TO MATCH THE SHOUTCAST SERVER YOU WANT TO SHOW
$host = "213.203.207.194";
$port = "8050";
$station = "stationsname hier";
// TO GET THE ABOVE DETAILS, LISTEN TO THE FEED YOU WANT THEN DO "PROPERTIES" OR READ THE MEDIA PLAYER DISPLAY
//You will see something like : http://64.62.252.134:2680/
// the last four digits are the port on which the stream is available
// the four dot-connectd numbers (a classic IP address) are the host.
//You can call the station what you like - it will appear as the title for the "what's on" display.
?>
Alles anzeigen
einbindung sidebar