View Single Post
Old 12-21-2012, 12:31 PM   PM User | #11
guytrance
New to the CF scene

 
Join Date: Aug 2012
Posts: 9
Thanks: 12
Thanked 0 Times in 0 Posts
guytrance is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
I suspect, according to the XML output:
Code:
function getCurrentTrack() {
	$.get('/player/readerPlayer.php', function (data) {
        $tracks = $(data).find('track');
        $tracks.each(function (){
            $this = $(this);
            var title = $this.find('title').text();
            var listenersn = $this.find('listeners').text();
            $('.now_playing a').html(title).attr('href', url);
            $('.listeners span').html(listenersn);
            setTimeout(getCurrentTrack, 65000);
        });
    }, 'xml');
};
Where does url come from..? Presumably you need to extract it from location.
Code:
function getCurrentTrack() {
	$.get('/player/readerPlayer.php', function (data) {
        $tracks = $(data).find('track');
        $tracks.each(function (){
            $this = $(this);
            var title = $this.find('title').text();
            var listenersn = $this.find('listeners').text();
            var locn = $this.find('location').text();
            $('.now_playing a').html(title).attr('href', locn);
            $('.listeners span').html(listenersn);
            setTimeout(getCurrentTrack, 65000);
        });
    }, 'xml');
};
But you need to escape the ampersand & and other characters in the XML as it is not valid otherwise:
It seems your code is working! though your right...every time the xspf generates the amp sign (&) the php fails to read. i posted the start of the remote xspf file (i need admins approval for posts for some reason and it takes forever so sorry for posting 2 replies)

the XSPF:

Code:
<xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform" version = "1.0" >
<xsl:output omit-xml-declaration="no" media-type="application/xspf+xml"
        method="xml" indent="yes" encoding="UTF-8" />
<xsl:template match = "/icestats" >
<playlist version="1" xmlns="http://xspf.org/ns/0/">
	<title><xsl:value-of select="server" /></title>
	<creator><xsl:value-of select="server" /></creator>
	<trackList >
<!-- end of "header" -->

<xsl:for-each select="source">

<track>
    <location><xsl:value-of select="listenurl" /></location>


<xsl:if test="artist"><creator><xsl:value-of select="artist" /></creator></xsl:if>
<xsl:if test="listeners"><listeners><xsl:value-of select="listeners" /></listeners></xsl:if>
<title><xsl:value-of select="title" /></title>
How can i escape that? in the xml it self? or in php?
guytrance is offline   Reply With Quote