Ankündigung

Einklappen
Keine Ankündigung bisher.

Shoutstats

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Shoutstats

    Hallo,

    Wer kann mir denCode so umschreiben das Shoutstats die XML ausliest und nicht die 7.html

    Hier erstmal der Standartcode:
    Code:
    <? 
    // Shoutstats version 
    define('SS_VERSION',   '0.8.4'); 
    
    // The file providing the the config variables 
    define('SS_CONF',   'config.ini'); 
    
    // The file providing the server list 
    define('SS_SERVERS',   'servers.ini'); 
    
    // The folder containing the generated PNG 
    define('SS_PATH_GFX',   'gfx'); 
    
    // The folder containing the RRDtool databases 
    define('SS_PATH_RRD',   'rrd'); 
    
    if (!file_exists(SS_CONF)) 
       die(SS_CONF.' file is missing'); 
    $configuration = parse_ini_file(SS_CONF, TRUE); 
    define('SS_RRDTOOL_COMMAND', $configuration['Configuration']['rrdtool_command']); 
    define('SS_NAME', $configuration['Configuration']['stream_name']); 
    
    //if(!is_executable(SS_RRDTOOL_COMMAND)) 
    //   die(SS_RRDTOOL_COMMAND . ' not found. Please update the ' . SS_CONF . ' file'); 
    exec(SS_RRDTOOL_COMMAND, $output); 
    if(!count($output)) 
       die(SS_RRDTOOL_COMMAND . ' not found. Please update the ' . SS_CONF . ' file'); 
    
    // 
    // Get the server list from the configuration file 
    // 
    
    function GetServerList() 
    { 
       if (!file_exists(SS_SERVERS)) 
               die(SS_SERVERS.' file is missing'); 
    
       $servers = parse_ini_file(SS_SERVERS, TRUE); 
       ksort($servers); 
        
       if (!count($servers)) 
               die('no server configured, edit the '.SS_CONF.' file'); 
        
       return $servers; 
    } 
    
    // 
    // Get the number of current and max listeners from the specified server 
    // 
    
    function GetShoutcastStats($host,$port) 
    { 
      $fp = fsockopen($host, $port, $errno, $errstr, 30); 
    
      // can't connect =( 
      if (!$fp) { 
       print("$errstr ($errno)
    \n"); 
       $server['current'] = 0; 
       $server['max'] = 0; 
      // oh yes, it can connect 
      } else { 
          fputs($fp, "GET /7.html HTTP/1.0\r\nUser-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 5.0)\r\n\r\n"); 
          while (!feof($fp)) { 
              $content .= fgets($fp,128); 
          } 
          fclose($fp); 
    
          $debut = strpos($content, '<body>') + strlen('<body>'); 
          $fin = strpos($content, '</body>', $debut); 
          $string = substr($content, $debut, $fin - $debut); 
         
         $stats = explode(',', $string); 
    
       // server is up but no source is connected 
       if ($stats[1] == 0) { 
          $server['current'] = 0; 
       // everything is ok 
       } else { 
          $server['current'] = $stats[0]; 
       } 
        
       $server['max'] = $stats[3]; 
      } 
    
       // debug 
       // print("$host:$port = {$server['current']}/{$server['max']}\n"); 
      return $server; 
    } 
    
    // 
    // Template used to display each generated graph 
    // 
    
    function DisplayGraph($txt_freq, $rrdgfx) { 
    $size  = GetImageSize($rrdgfx); 
    ?> 
    
    
     
    <?=$txt_freq?> graph:
     
    [img]<?=$rrdgfx?>[/img] alt="<?=$txt_freq?> graph" />
     
    </p> 
    <? } ?>

    Jetzt sagte man mir dass das nicht gehen würde die XML auszulesen, weil der Code nur HTML dateien auslesen würde und man müsse das ganze Umbauen, sprich umcoden. Stimmt das und wenn ja wer kann mir dabei helfen da ich mit php-scripting kaum bis keine erfahrung habe.

    Vielen Dank schon mal im Voraus.

    LG
    Sonic84

  • #2
    Was ist eine 7.html und eine shoutstat XML File? Woher sollen wir bitte wissen was drinnen steht, was wie ausgelesen werden soll ...

    Außerdem wäre es mehr als nur bissl umcoden ... du musst alles auf XML umstellen.
    Da wir keine Ahnung haben was der Code ansich macht wird des ne etwas zeitintensive Aufgabe die keiner einfach mal so macht denke ich.

    Kommentar


    • #3
      Zitat von RaZoR
      Was ist eine 7.html und eine shoutstat XML File? Woher sollen wir bitte wissen was drinnen steht, was wie ausgelesen werden soll ...

      Außerdem wäre es mehr als nur bissl umcoden ... du musst alles auf XML umstellen.
      Da wir keine Ahnung haben was der Code ansich macht wird des ne etwas zeitintensive Aufgabe die keiner einfach mal so macht denke ich.
      Also der Code liest die aktuellen Hörerzahlen aus und erstellt eine Grafik mit dem RDD Tool.
      Die 7.html sieht in der Ausgabe so aus:

      Code:
      Hörerzahl,1,Peak,Max,2,56,Back to Future - mit Sascha Braun
      und das XML File (http://85.214.19.144:8000/http://85....i?mode=viewxml) sieht wie folgt aus:

      Code:
       <?xml version="1.0" standalone="yes" ?> 
        <!DOCTYPE SHOUTCASTSERVER (View Source for full doctype...)> 
      - <SHOUTCASTSERVER>
        <CURRENTLISTENERS>ZAHL</CURRENTLISTENERS> 
        <PEAKLISTENERS>ZAHL</PEAKLISTENERS> 
        <MAXLISTENERS>ZAHL</MAXLISTENERS> 
        <REPORTEDLISTENERS>ZAHL</REPORTEDLISTENERS> 
        <AVERAGETIME>7980</AVERAGETIME> 
        <SERVERGENRE>Various</SERVERGENRE> 
        <SERVERURL>http://www.antennefm.de</SERVERURL> 
        <SERVERTITLE>AntenneFM.de</SERVERTITLE> 
        <SONGTITLE>Back to Future - mit Sascha Braun</SONGTITLE> 
        <SONGURL>http://www.antennefm.de</SONGURL> 
        <IRC>NA</IRC> 
        <ICQ>NA</ICQ> 
        <AIM>NA</AIM> 
        <WEBHITS>16395</WEBHITS> 
        <STREAMHITS>2137</STREAMHITS> 
        <STREAMSTATUS>1</STREAMSTATUS> 
        <BITRATE>56</BITRATE> 
        <CONTENT>audio/mpeg</CONTENT> 
        <VERSION>1.9.5</VERSION> 
      - <WEBDATA>
        <INDEX>184</INDEX> 
        <LISTEN>156</LISTEN> 
        <PALM7>10002</PALM7> 
        <LOGIN>0</LOGIN> 
        <LOGINFAIL>61</LOGINFAIL> 
        <PLAYED>2517</PLAYED> 
        <COOKIE>0</COOKIE> 
        <ADMIN>423</ADMIN> 
        <UPDINFO>2571</UPDINFO> 
        <KICKSRC>22</KICKSRC> 
        <KICKDST>1</KICKDST> 
        <UNBANDST>0</UNBANDST> 
        <BANDST>0</BANDST> 
        <VIEWBAN>0</VIEWBAN> 
        <UNRIPDST>0</UNRIPDST> 
        <RIPDST>0</RIPDST> 
        <VIEWRIP>0</VIEWRIP> 
        <VIEWXML>417</VIEWXML> 
        <VIEWLOG>31</VIEWLOG> 
        <INVALID>9</INVALID> 
        </WEBDATA>
      es musste denke ich dann nur die Zeile " <CURRENTLISTENERS>ZAHL</CURRENTLISTENERS> ausgelesen werden den ein crontab schau da alle 60 sejkunden danach[/code]

      Kommentar


      • #4
        Zitat von Cineplex
        Kann man mit "keiner Ahnung" solch einen Code schreiben?
        http://www.glop.org/shoutstats/

        Kommentar

        Lädt...
        X