writes because I have a problem wanting to put on my radio page metadata server 
dynasmic shoutcast server


Looking for your help I found out about 
https://github.com/savonet/liquidsoap/issues/381?fbclid=IwAR1dFw0HpiBAHpBv99q5yDtzyZWCIM1vXCV5XqrSvMm4S2i_pVfgPYMP_Ic


Where is this file ??


My friend hosting with shoutcast servers added modifications to liquideapp and 
he displays the information entered in DSP SHOUTCAST.

 The Genere and Descryption fields are shown

The php script looks like this  

`<?php
/**
* SHOUTcast 2 statistics class
*
* @author PortalRadiowy.pl
* @copyright 2016 PortalRadiowy.pl
* @version 1.3
*/
class shoutcast2stats {
   private $_ip;
   private $_port;
   private $_sid;
   private $_json;

   public function __construct($ip, $port, $sid=1)
   {
       $this->_ip = $ip;
       $this->_port = $port;
       $this->_sid = $sid;
       $this->initCurl();
   }

   private function initCurl()
   {
       $ch = curl_init();
       curl_setopt($ch, CURLOPT_URL, 
'http://'.$this->_ip.':'.$this->_port.'/stats?sid='.$this->_sid.'&json=1');
       curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (PortalRadiowy.pl)');
       curl_setopt($ch, CURLOPT_HEADER, 0);
       curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
       curl_setopt($ch, CURLOPT_TIMEOUT, 3);
       $curl_exec = curl_exec($ch);
       $this->_json = ($curl_exec ? json_decode(iconv('UTF-8', 'UTF-8//IGNORE', 
$curl_exec)) : false);
       curl_close($ch);
   }
  
   public function get($name, $name_dj='')
   {
       if ($name == 'streamstatus') {
           if ($this->_json == false) {
               return 0;
           } elseif ($this->_json->streamstatus == 0) {
               return 1;
           } else {
               return 2;
           }
       } elseif (isset($this->_json->$name) && $name == 'dj' && 
!empty($name_dj)) {
           $dj_json = json_decode(substr(preg_replace('/\},[\s]*\{/', ',', 
preg_replace(array('/\([\s]*"/', '/"[\s]*\)/', '/"[\s]*,/'), array('{"', '"}', 
'":'), preg_replace_callback('/\\\\(\d+)/m', function($matches) { return 
iconv('Windows-1250', 'UTF-8//IGNORE', chr($matches[1])); }, 
$this->_json->dj))), 1, -1));
           if (isset($dj_json->$name_dj)) {
               return htmlspecialchars($dj_json->$name_dj);
           }
       } elseif (isset($this->_json->$name)) {
           return htmlspecialchars($this->_json->$name);
       }
       return '';
   }
}



/**
* Inicjalizacja klasy:
* ip-serwera - Zamień na adres IP swojego serwera SHOUTcast 2
* 8000 - Zamień na port swojego serwera SHOUTcast 2
*
* Opcjonalnie:
* Po argumencie z numerem portu, możesz wstawić argument z numerem streamu 
(kanału) sid, domyślnie: 1
* $stats = new shoutcast2stats('ip-serwera', 8000, 2); // Dla stream id: 2
*/
$stats = new shoutcast2stats('s1.slotex.pl', 7028);
//echo $stats->get('songtitle'); // Wyświetla wartość pola "Stream Name", czyli 
często uznawane jako "Nazwa audycji". Poprawnie powinno odpowiadać za nazwę 
radia.
**echo $stats->get('dj', 'icy-name'); // Displays the value of the "Name" field 
entered in the transmitter,
echo $stats->get('dj', 'icy-genre'); // Displays the value of the "Genere" 
field entered in the transmitter,** 


when disconnection connection is loaded with auto DJ value

`![screenshot_1](https://user-images.githubusercontent.com/45500615/49698612-73d16800-fbc6-11e8-8039-13edd3f0fa2f.jpg)`



PLEASE HELP ME 

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/savonet/liquidsoap/issues/673
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to