Tilllate icecast server

Aus dmd2
Zur Navigation springenZur Suche springen

Dieses Dokument beschreibt die Konfiguration des Icecast Servers, für tilllate.com Nightlife Radio.

Icecast2 Server[bearbeiten]

Network adress and links[bearbeiten]

Server Adress


Server links

login : admin
password : itsnever2l@t32008

Server Status Page


Server Mountpoints



Icecast2 Server (patched version)[bearbeiten]

  • the customer is using a flash based player. according the Software developer, it is recommended to modify the default icecast2 source. The Icecast Server running on http://s1.radio.tilllate.com:8080 is patched according the following procedure. The location of the patched version is
    /usr/local/bin/icecast


Patching Icecast2.3.1 for Flash playback of MP3 streams in IE7

Minicaster and Minicaster pro-ICE both work extremely reliably on Firefox and Safari, but Internet Explorer 7 has recently decided not to play ball - this means that many Flash playheads (not just ours) have found they cannot connect to Icecast2 servers, or rather they can connect and seem to be downloading something but they just hear silence. The problem is a content-length limit, and the solution is a patch!

When Icecast2 sends a stream it of course has no idea how 'big' it is, as it can play forever. The Icecast developers made up a random number for the content-length header variable, and for most browsers that's fine.. they get confused trying to show the 'percent downloaded' but we don't care about that as long as the file is delivered to Flash. IE7 however has a 'feature' which simply eats anything that reports a content-length greater than a certain figure. It still tries to download it, but it passes garbage to Flash. The result is that in Flash we see audio data, and it has a duration like we'd expect, but the critical download progress information is never sent. Flash refuses to begin playback until it has a certain quantity of audio in the buffer, and since IE7 refuses to talk to it, Flash sits there and does nothing. All this time the data is still downloading and the Icecast server owner is seeing 'a listener' - and often paying for them!

This issue is due to be fixed in the next release of Icecast2, but for those still using an older version (and until the patch is released) you need to edit the Icecast2 code and recompile it. Under Linux-Unix it's a 30-second job, but under Windows you may find it more fun - and so have to wait for the binary release. The patch (based on an icecast 2.3.1 source package)

The change is to the file 'src/format_mp3.c' - search for the line containing "x-flash-version" and you'll find this:-

if (httpp_getvar(client->parser, "x-flash-version")) { bytes = snprintf (ptr, remaining, "Content-Length: 347122319\r\n"); remaining -= bytes; ptr += bytes; } 

Change the large number to read:-

if (httpp_getvar(client->parser, "x-flash-version")) { bytes = snprintf (ptr, remaining, "Content-Length: 221183499\r\n"); remaining -= bytes; ptr += bytes; }

Now close any running icecast2 processes, recompile icecast2 with the usual 'configure.. make.. make install', and re-run the server. The only change you'll see is that it now works when viewed through Internet Explorer 7! Our demo Icecast2 server has been patched, and so if you're using IE7 and click HERE you'll be able to hear the music.

this text is taken from the website : http://www.draftlight.net/dnex/mp3player/support/minicaster-icecast-patching.php

Icecast2 Configuration File[bearbeiten]

The Icecast2 Config File (icecast.xml) is located at

/etc/icecast2/icecast.xml
<icecast>
    <limits>
        <clients>600</clients>
        <sources>10</sources>
        <threadpool>5</threadpool>
        <queue-size>524288</queue-size>
        <client-timeout>30</client-timeout>
        <header-timeout>15</header-timeout>
        <source-timeout>10</source-timeout>
        <!-- If enabled, this will provide a burst of data when a client 
             first connects, thereby significantly reducing the startup 
             time for listeners that do substantial buffering. However,
             it also significantly increases latency between the source
             client and listening client.  For low-latency setups, you
             might want to disable this. -->
        <burst-on-connect>1</burst-on-connect>
        <!-- same as burst-on-connect, but this allows for being more
             specific on how much to burst. Most people won't need to
             change from the default 64k. Applies to all mountpoints  -->
        <burst-size>65535</burst-size>
    </limits>

    <authentication>
        <!-- Sources log in with username 'source' -->
        <source-password>itsnever2l@t3</source-password>
        <!-- Relays log in username 'relay' -->
        <relay-password>itsnever2l@t3</relay-password>

        <!-- Admin logs in with the username given below -->
        <admin-user>admin</admin-user>
        <admin-password>itsnever2l@t32008</admin-password>
    </authentication>

    <!-- Uncomment this if you want directory listings -->
    <!--
    <directory>
        <yp-url-timeout>15</yp-url-timeout>
        <yp-url>http://dir.xiph.org/cgi-bin/yp-cgi</yp-url>
    </directory>
     -->

    <!-- This is the hostname other people will use to connect to your server.
    It affects mainly the urls generated by Icecast for playlists and yp
    listings. -->
    <hostname>localhost</hostname>

    <!-- You can use these two if you only want a single listener -->
    <!--<port>8080</port> -->
    <!--<bind-address>127.0.0.1</bind-address>-->

    <!-- You may have multiple <listener> elements -->
    <listen-socket>
        <port>8080</port>
        <!-- <bind-address>127.0.0.1</bind-address> -->
    </listen-socket>
    <!--
    <listen-socket>
        <port>8001</port>
    </listen-socket>
    -->

    <!--<master-server>127.0.0.1</master-server>-->
    <!--<master-server-port>8001</master-server-port>-->
    <!--<master-update-interval>120</master-update-interval>-->
    <!--<master-password>hackme</master-password>-->

    <!-- setting this makes all relays on-demand unless overridden, this is
         useful for master relays which do not have <relay> definitions here.
         The default is 0 -->
    <!--<relays-on-demand>1</relays-on-demand>-->


    <relay>
        <server>live-four.dmd2.ch</server>
        <port>8000</port>
        <mount>/tilllate_channel1</mount>
        <local-mount>/tilllate_channel1</local-mount>
    </relay>


    <relay>
        <server>live-four.dmd2.ch</server>
        <port>8000</port>
        <mount>/tilllate_channel11</mount>
        <local-mount>/tilllate_channel11</local-mount>

    </relay>
    
    <relay>
        <server>live-four.dmd2.ch</server>
        <port>8000</port>
        <mount>/tilllate_channel21</mount>
        <local-mount>/tilllate_channel21</local-mount>
    </relay>



    <mount>
        <mount-name>/tilllate_channel1</mount-name>
        <intro>/tilllate_channel1_intro.mp3</intro>
        <fallback-mount>/tilllate_channel1_fallback.mp3</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
    </mount>

    <mount>
        <mount-name>/tilllate_channel11</mount-name>
        <intro>/tilllate_channel11_intro.mp3</intro>
        <fallback-mount>/tilllate_channel11_fallback.mp3</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
    </mount>

    <mount>
        <mount-name>/tilllate_channel21</mount-name>
        <intro>/tilllate_channel21_intro.mp3</intro>
        <fallback-mount>/tilllate_channel21_fallback.mp3</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
    </mount>


    <!-- Only define a <mount> section if you want to use advanced options,
         like alternative usernames or passwords
    <mount>
        <mount-name>/example-complex.ogg</mount-name>

        <username>othersource</username>
        <password>hackmemore</password>

        <max-listeners>1</max-listeners>
        <dump-file>/tmp/dump-example1.ogg</dump-file>
        <burst-size>65536</burst-size>
        <fallback-mount>/example2.ogg</fallback-mount>
        <fallback-override>1</fallback-override>
        <fallback-when-full>1</fallback-when-full>
        <intro>/example_intro.ogg</intro>
        <hidden>1</hidden>
        <no-yp>1</no-yp>
        <authentication type="htpasswd">
                <option name="filename" value="myauth"/>
                <option name="allow_duplicate_users" value="0"/>
        </authentication>
        <on-connect>/home/icecast/bin/stream-start</on-connect>
        <on-disconnect>/home/icecast/bin/stream-stop</on-disconnect>
    </mount>

    <mount>
        <mount-name>/auth_example.ogg</mount-name>
        <authentication type="url">
            <option name="mount_add"       value="http://myauthserver.net/notify_mount.php"/>
            <option name="mount_remove"    value="http://myauthserver.net/notify_mount.php"/>
            <option name="listener_add"    value="http://myauthserver.net/notify_listener.php"/>
            <option name="listener_remove" value="http://myauthserver.net/notify_listener.php"/>
        </authentication>
    </mount>

    -->

    <fileserve>1</fileserve>

    <!-- set the mountpoint for a shoutcast source to use, the default if not
         specified is /stream but you can change it here if an alternative is
         wanted or an extension is required
    <shoutcast-mount>/live.nsv</shoutcast-mount>
    -->

    <paths>
		<!-- basedir is only used if chroot is enabled -->
        <basedir>/usr/share/icecast2</basedir>

        <!-- Note that if <chroot> is turned on below, these paths must both
             be relative to the new root, not the original root -->
        <logdir>/var/log/icecast2</logdir>
        <webroot>/usr/share/icecast2/web</webroot>
        <adminroot>/usr/share/icecast2/admin</adminroot>
        <!-- <pidfile>/usr/share/icecast2/icecast.pid</pidfile> -->

        <!-- Aliases: treat requests for 'source' path as being for 'dest' path
             May be made specific to a port or bound address using the "port"
             and "bind-address" attributes.
          -->
        <!--
        <alias source="/foo" dest="/bar"/>
          -->
        <!-- Aliases: can also be used for simple redirections as well,
             this example will redirect all requests for http://server:port/ to
             the status page
          -->
        <alias source="/" dest="/index.html"/>
    </paths>

    <logging>
        <accesslog>access.log</accesslog>
        <errorlog>error.log</errorlog>
        <!-- <playlistlog>playlist.log</playlistlog> -->
      	<loglevel>4</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error -->
      	<logsize>10000</logsize> <!-- Max size of a logfile -->
        <!-- If logarchive is enabled (1), then when logsize is reached
             the logfile will be moved to [error|access|playlist].log.DATESTAMP,
             otherwise it will be moved to [error|access|playlist].log.old.
             Default is non-archive mode (i.e. overwrite)
        -->
<logarchive>1</logarchive> 
    </logging>

    <security>
        <chroot>0</chroot>
        <changeowner>
            <user>icecast2</user>
            <group>icecast</group>
        </changeowner>
    </security>
</icecast>



Icecast2 Server Re-load scripts[bearbeiten]

Damit neue Backup und oder Intro Files aktiv vom Server geladen werden können, muss der Server neu gestarted werden. foldendes Script läuft jede nacht um XXXX und lädt das configuration Files neu. .........

Tillate intro Files[bearbeiten]

  • Each Channel has his own intro file. This intro file is in the icecast.xml file declared
 <intro>/tilllate_channel21_intro.mp3</intro>

the location of the intro file is

/usr/share/icecast2/web

eventuell in upload folder verschieben und config neu anpassen, damit neue intro files von extern auf den server geladen werden können

Tillate Backup files Files[bearbeiten]

location festlegen und configuration anpassen

Tillate Listener Statistics[bearbeiten]

You'll find the statistics here : http://s1.radio.tilllate.com/listener-statistics/

login : statistics
password : iscreamjuskriim4sunncriim

the php script for each mount point looks like :

<?php

$server = "localhost:8080";
$user = "admin";
$passw = "itsnever2l@t32008";
$mountpoint = "/tilllate_channel11";

$fp = fopen("http://$user:$passw@$server/admin/stats","r")
         or die("Error reading Icecast data from $server.");

while(!feof($fp))
{
     $data .= fread($fp, 8192);
}

fclose($fp);

// Now parse the XML output for our mountpoint
$xml_parser = xml_parser_create();
xml_parse_into_struct($xml_parser, $data, $vals, $index);
xml_parser_free($xml_parser);

$params = array();
$level = array();
foreach ($vals as $xml_elem) {
     if ($xml_elem['type'] == 'open') {
        if (array_key_exists('attributes',$xml_elem)) {
            list($level[$xml_elem['level']],$extra) =
array_values($xml_elem['attributes']);
         } else {
             $level[$xml_elem['level']] = $xml_elem['tag'];
         }
     }
     if ($xml_elem['type'] == 'complete') {
         $start_level = 1;
         $php_stmt = '$params';
         while($start_level < $xml_elem['level']) {
             $php_stmt .= '[$level['.$start_level.']]';
             $start_level++;
         }
         $php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
         eval($php_stmt);
     }
}

$listeners = $params['ICESTATS'][$mountpoint]['LISTENERS'];
$currenttrack = $params['ICESTATS'][$mountpoint]['TITLE'];

echo "cur_listen:$listeners";
?>

The grahpical representation is made with the open source application http://www.cacti.net/ the scripts are stored in the cacti folder

/var/www/listats/scripts

for each channel a single script is used

tilllate_channel1.php
tilllate_channel11.php
tilllate_channel21.php