The code in
categoryFeed.brs looks mostly right. It should assure that each time the Roku goes to access
categories.xml it requests a fresh copy from your server. But then in the
categories.xml file, you point to a categoryLeaf feed:
<categoryLeaf title="Awesomeness" description="" feed="http://scclib.com/demo/roku/xml/xmlfeed.php"/>
That feed should have a unique parameter (timestamp) appended to it, so that when the Roku looks for it, it doesn't use cached data:
<categoryLeaf title="Awesomeness" description="" feed="http://scclib.com/demo/roku/xml/xmlfeed.php?ts=20120223104501"/>
Your php script,
xmlfeed.php, should only echo the file contents of
awesomness.xml. Appending the timestamp in that function is unnecessary (and I'd be surprised if it worked at all):
<?php
echo file_get_contents('awesomeness.xml');
?>
What I would do is dynamically generate the category.xml file so that it timestamps the feed links:
categories.php<?php
// Send the headers
header('Content-type: text/xml');
header('Pragma: public');
header('Cache-control: private');
header('Expires: -1');
//Store the current time in seconds into variable $now:
$now = time();
echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
echo '<xml>';
echo ' <categories>';
echo ' <category title="Awesomeness" description="Here it iskhj"';
echo ' sd_img="http://scclib.com/demo/roku/images/test_sd_poster.jpg"';
echo ' hd_img="http://scclib.com/demo/roku/images/test_hd_poster.jpg">';
//Append a timestamp to the category feed:
echo ' <categoryLeaf title="Awesomeness" description="" feed="http://scclib.com/demo/roku/xml/xmlfeed.php?ts=' . $now . '"/>';
echo ' </category>';
echo ' </categories>';
echo '</xml>';
?>
So instead of pointing at
category.xml in
categoryFeed.brs, you point at
categories.php (
keeping the timestamp!!😞conn.UrlCategoryFeed = conn.UrlPrefix + "/categories.php?ts=" + dt.AsSeconds().ToStr()
Awesomness.xml looks fine to me, but if the contents will change often, you'll want to dynamically generate this too. I assume that's why you have the xmlfeed.php script just echoing the file contents, as a placeholder until you are dynamically generating?
PHP has a lot of built-in xml functions, simply echoing everything is definitely not the way to go for production use (I used it only so it would be easier for you to see what's going on). If you aren't comfortable with xml yet, the language may initially be a little intimidating, but it's really quite easy to work with. I recommend reading up on it and the php functions you can use to generate and manipulate it.
XML in a Nutshell, or the
XML Pocket reference, both published by O'Reilly might be good places to start with XML learning, and the php reference for
SimpleXML might help for when you're ready to generate it on the fly
Remoku.tv - A free web app for Roku Remote Control!
Want to control your Roku from nearly any phone, computer or tablet? Get started at http://help.remoku.tv
by Apps4TV - Applications for television and beyond: http://www.apps4tv.com