No announcement yet.

Receive meta data in HTML

  • Filter
  • Time
  • Show
Clear All
new posts

  • Receive meta data in HTML

    To start with... I have a website that will only allow me to insert html blocks into the body of a page, rather than add scripts, and what not, to the header. I know I can create a separate page with my player plugin that I have already worked out, do a slide show for advertisers etc, but I really want to stay on this format because anyone can help update ads etc, without a whole lot of coding ability.

    I've seen some code that suggests javascript calls in the header is the only way to retrieve the metadata to parse it into text within the body, but I'm hoping that if I have all the info to my server, and have the rights to that data stream, that there is an easy way to retrieve the metadata from my stream and plug it in anywhere I want, not just to Winamp, or other functioning pls player.

    Maybe there is a, somewhat, customizable player that I can plug into my site with simple HTML for the entire purpose, but I like what I have working, but NO meta data. I have it working right off my site even on the iphone, but I don't think I'll ever get the data there, but really think there must be an easy way to display this server info in a clean text box, at least for normal web display in Chrome, Explorer etc.

    Anyone come up with, or against this, this? please let me know.

    And thanks in advance.

  • #2
    With DNAS 2.x you can parse it with PHP directy from the DNAS stats like this:

    File: sc_stats.php

    PHP Code:

    $sc_port '8000';
    $sc_sid 1;

    $xml = @simplexml_load_file('http://' $sc_ip ':' $sc_port '/stats?sid=' $sc_sid);

    if (
    $xml === FALSE) {
    $count_current '0';
    $status '0';
    $current_title 'no title available';
    } else {
    $count_current $xml->CURRENTLISTENERS# counting current listeners
    $status $xml->STREAMSTATUS# stream status
    $current_title $xml->SONGTITLE# current stream-title

    'Listeners: ' $count_current '<br />';
    'Stream-Status: ' $status '<br />';
    'Current Streanttitle: ' $current_title '<br />';


    You could include this php-file in your HTML document and load it again with a jQuery intervall like this:
    PHP Code:
    <div id="sc_stats"><?php include_once 'sc_stats.php'?></div>

    <script type="text/javascript">
    var refreshId = setInterval(function() {
        $.get("sc_stats.php", function(data) {
    }, 10000);
    Make that you have a jquery.min.js loaded before the <script> code is started.

    Or the other way is using a jQuery plugin that would call the data with the DNAS JSON functionality:

    Or you can pay a player like this:
    Last edited by neralex; 21 December 2014, 11:54.