парсинг icecast

Статус
В этой теме нельзя размещать новые ответы.

Апокалипсис

тех дир matras.ru
парсинг icecast

Есть инет радио на Icecast2 . Необходимо сделать статистику чтобы на офсайте показывался текущий трэк и DJ или нонстоп.
Дело в том, что в винапе показывается DJ который сидит в данное время.
А в админке нет.
На других сайтаъ как то отпарсиват... Вопрос как ?
Я парсю файл admin/status.xls ....

-~{}~ 06.05.08 22:26:

может как то нужно сам протокол потоковый парсить ? О_о ...
гугл молчит...

-~{}~ 07.05.08 16:44:

да видимо тема настолько редкая. не думал.
принял решение разбирать протокол и читать заголовки...
как сделаю - если сделаю - опишу:)
 

Zonar

Новичок
<?php
/*================================================================*\
|| ############################################################## ||
|| # ICEcast info script v1.0 # ||
|| # by Johnny [icq 319-058] # ||
|| # # ||
|| # [ ASTeam - Advanced Security Team ] # ||
|| # http://www.asteam.ru | http://www.asteam.ru/forum/ # ||
|| ############################################################## ||
\*================================================================*/

//
define (NameStation, '/nrj'); //******* *******
define (RadioOff, ' '); //******* *******
//******* : 0 - , 1 - ; *******
define (StreamTitle, 1); define (StreamTitleText, ' : ');
//define (StreamDescription, 1); define (StreamDescriptionText, ' - ');
//define (ContentType, 1); define (ContentTypeText, ' - ');
//define (MountUptime, 1); define (MountUptimeText, ' : ');
//define (Bitrate, 1); define (BitrateText, ' : ');
define (CurrentListeners, 1); define (CurrentListenersText, '<b> Online :</b> ');
//define (PeakListeners, 1); define (PeakListenersText, ' : ');
//define (StreamGenre, 1); define (StreamGenreText, ' : ');
//define (StreamURL, 1); define (StreamURLText, ' : ');
define (CurrentSong, 1); define (CurrentSongText, ' - ' );

define (NoStream, ' ');//******* *******
define (Separator, '&nbsp'); //******* *******

//******* *******
$file = file_get_contents('http://moeradio.ru:10000');
//******* *******
$start = strpos($file, 'Mount Point : (' . NameStation . ') :') or $start = 0;
if ($start < 1) exit(RadioOff); //******* , *******
$start += strlen('Mount Point : (' . NameStation . ') :');
$file = substr($file, $start);
$file = substr($file, 0, strpos($file, 'Mount Point')); //******* *******
//##############################################################
//******* *******
//******* *******
if (StreamTitle == 1) {
if (preg_match('#<td>Stream Title:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
$streamtitle = $m[1];
echo StreamTitleText, $streamtitle, Separator;
} else echo StreamTitleText, NoStream, Separator;
}

//******* *******
if (StreamDescription == 1) {
if (preg_match('#<td>Stream Description:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
$streamdesc = $m[1];
echo StreamDescriptionText, $streamdesc, Separator;
} else echo StreamDescriptionText, NoStream, Separator;
}

//******* *******
if (ContentType == 1) {
if (preg_match('#<td>Content Type:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
$contenttype = $m[1];
echo ContentTypeText, $contenttype, Separator;
} else echo ContentTypeText, NoStream, Separator;
}

//******* *******
//if (MountUptime == 1) {
// if (preg_match('#<td>Mount Uptime:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
// $mountuptime = $m[1];
// echo MountUptimeText, $mountuptime, Separator;
// } else echo MountUptimeText, NoStream, Separator;
//}

//******* *******
//if (Bitrate == 1) {
// if (preg_match('#<td>Bitrate:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
// $bitrate = $m[1];
// echo BitrateText, $bitrate, Separator;
// } else echo BitrateText, NoStream, Separator;
//}

//******* *******
if (CurrentListeners == 1) {
if (preg_match('#<td>Current Listeners:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
$currentlisteners = $m[1];
echo CurrentListenersText, $currentlisteners, Separator;
} else echo CurrentListenersText, NoStream, Separator;
}

//******* - *******
//if (PeakListeners == 1) {
// if (preg_match('#<td>Peak Listeners:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
// $peaklisteners = $m[1];
// echo PeakListenersText, $peaklisteners, Separator;
// } else echo PeakListenersText, NoStream, Separator;
//}

//******* *******
//if (StreamGenre == 1) {
// if (preg_match('#<td>Stream Genre:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
// $streamgenre = $m[1];
// echo StreamGenreText, $streamgenre, Separator;
// } else echo StreamGenreText, NoStream, Separator;
//}

//******* *******
//if (StreamURL == 1) {
// if (preg_match('#<td>Stream URL:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
// $streamurl = $m[1];
// echo StreamURLText, $streamurl, Separator;
// } else echo StreamURLText, NoStream, Separator;
//}

//******* *******
if (CurrentSong == 1) {
if (preg_match('#<td>Current Song:<\/td><td class=\"streamdata\">(.*)<\/td>#Ui', $file, $m)) {
$currentsong = $m[1];
echo CurrentSongText, $currentsong, Separator;
} else echo CurrentSongText, NoStream, Separator;
}
?>


Ну и потом инклудом куда тебе надо
 

Mr_Max

Первый класс. Зимние каникулы ^_^
Команда форума
Zonar
Не надо заниматься археологией.
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху