2012-02-23, 23:47
europorsche914 Wrote:I have been been following this thread but havent had much time to give any input lately.. I started working on parsing epg data on my webpage so my brother can watch tv from the marine base in okinawa, japan. It would be much easier to handle this data if it was sent by the remoteceton api in xml format, that way simple javascript xml handling can be used.. For now I probably just parse the xml file that is downloaded by mc2xml. Just a thought!
There's an API call for the epg data in json format.
If you need help using it, let me know!
I'll put in an example later, when I get home.
Todo:
Code:
function getEPGData(start_time, end_time, channels) {
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
} else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.open("POST","/getEPGData",false);
var request = {
start_time: start_time,
end_time: end_time,
channels: channels
};
xmlhttp.send(JSON.stringify(request));
xmlDoc=xmlhttp.responseText;
return JSON.parse(xmlDoc);
}
var epg_data = getEPGData(parseInt(new Date().getTime()/1000), (parseInt(new Date().getTime()/1000)+5400), [1,2,3,4,5,6,7,8,9,10]);
if (epg_data["1"]) {//do we have channel 1 data?
alert("Number of programs for channel 1: "+epg_data["1"].length);
if (epg_data["1"].length > 0) {
alert("First program for channel 1: "+epg_data["1"][0].program_title);
alert("First program for channel 1: "+epg_data["1"][0].start_time);
alert("First program for channel 1: "+epg_data["1"][0].end_time);
}
}