2017 © Pedro PelĂĄez
 

library shoutcast-server-information

A php library to get information from Shoutcast v2

image

cperezabo/shoutcast-server-information

A php library to get information from Shoutcast v2

  • Friday, December 9, 2016
  • by cperezabo
  • Repository
  • 2 Watchers
  • 2 Stars
  • 3 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Simple Shoutcast Server Information

About

It's just another library to get information from a Shoutcast Server
It supports Shoutcast Server 2+., (*1)

Example

<?php

include 'shoutcast.php';

$s = new Shoutcast('10.211.55.3', '8000');

if (!$s->server_online()) {
    echo 'Server offline';
} else {
    if (0 == $s->get('STATION_STATUS')) {
        echo 'Transmition off';
    } else {
        $format = '<strong>%s:</strong> %s <br />';

        //Print Current Listeners
        printf($format, 'Current Listeners', $s->get('CURRENT_LISTENERS'));

        //Print Current Song
        printf($format, 'Current Song', $s->get('CURRENT_SONG'));

        //Print Song History
        if ($s->admin_mode()) {
            $str_history = '';
            foreach ($s->get('SONG_HISTORY') as $song) {
                $str_history .= '<br />'.$song['TITLE'];
            }

            printf($format, 'Song History', $str_history);
        }
    }
}

Public Methods

public Shoutcast::server_online (void)
Returns TRUE or FALSE depending on the server status. If you want get the transmission status, use the STATION_STATUS variable., (*2)

public Shoutcast::admin_mode (void)
Returns TRUE or FALSE depending if it is in admin mode or not. You have to provide an admin password to the class constructor., (*3)

public Shoutcast::get (string $var)
Returns the value for the given var, if it is not available, it just returns an empty string, (*4)

Data Variables

CURRENT_LISTENERS : Amount of current listeners.
CURRENT_SONG : Current song
NEXT_SONG : Guess what?, (*5)

LISTENERS_PEAK : Max simultaneous listeners at a certain moment
LISTENERS_LIMIT : Max simultaneous listeners allowed
UNIQUE_LISTENERS : Amount of listeners by IP
STATION_STATUS : TRUE or FALSE depending on whether someone is transmitting or not, (*6)

STATION_GENRE
STATION_URL
STATION_TITLE, (*7)

DJ, (*8)

CONTENT_TYPE : Content MIME
BITRATE : Transmission bitrate
SERVER_VERSION, (*9)

Only with admin password:, (*10)

SONG_HISTORY : Array ( TIMESTAMP, TITLE )
LISTENERS : Array ( HOST, PLAYER, UNDER_RUNS, CONNECT_TIME, POINTER, UID}), (*11)

Ideas?

As you already noticed, it doesn't cover all the XML API, only the most useful information, just to keep it simple. If you need more, let me know! or fork it instead., (*12)

The Versions

09/12 2016

dev-master

9999999-dev https://github.com/cperezabo/shoutcast-server-information

A php library to get information from Shoutcast v2

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

server information shoutcast ioduck cperezabo winamp