XBMC Community Forum
[dev] CetonTV+HDHomeRun - Watch TV on XBMC (WIN/OSX) - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: [dev] CetonTV+HDHomeRun - Watch TV on XBMC (WIN/OSX) (/showthread.php?tid=119865)



- mcheng89 - 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);
    }
}
^ Didnt test it


- uspino - 2012-02-24 02:38

How's everything coming up tonight? Any help?


- mcheng89 - 2012-02-24 02:46

uspino Wrote:How's everything coming up tonight? Any help?

Probably favorites and channel list...
It's been slow since I have to learn how to use that library for the interface.
And I haven't had too much time to work on it

Issues: settings are not saving....

Figured out channel list! Smile
I think its a clean way to do it.

[Image: 2j2vvqw.jpg]

^ Just a mockup... Still have some improvements to make


- uspino - 2012-02-24 03:48

I noticed that. Also, it looks like resolution is always the same, regardless of what you choose in settings... I try lowest and highest on the iPad and they both look the same.

EDIT: Channel List looks really nice.


- mcheng89 - 2012-02-24 04:19

uspino Wrote:I noticed that. Also, it looks like resolution is always the same, regardless of what you choose in settings... I try lowest and highest on the iPad and they both look the same.

EDIT: Channel List looks really nice.

Fixed:
- Settings saves now

Todo:
- Finish channel list
- Finish Favorites
- Redesign Input Channel
- Create bandwidth calculator for settings window
- Make icon + load screen

Requoting this to remind me:
uspino Wrote:A few things/ideas:

- A lot of (small) .ts files remain in the webfiles folder. Should there be a clean up line in the code?

- It would be good to be able to select the temp folder for the transcoding files.

- Are you thinking about a different interface for iPhone/iPad (on iPad looks extremely small)

- Is there a way to start a video stream on an iOS device from a shortcut containing channel & transcode settings, the same way you can do it on VLC? That would be fantastic: you could create a shortcut to, say, ESPN, and just start streaming, or we could create a folder with shortcuts to favourite channels (and there are free apps on the store to assign a logo to each shortcut)



- synapseattack - 2012-02-24 04:37

I'm on the HDHomerun Prime train here. I know you are working on it and I can't wait to try it out. Just sent you a PM...


- mcheng89 - 2012-02-24 04:52

synapseattack Wrote:I'm on the HDHomerun Prime train here. I know you are working on it and I can't wait to try it out. Just sent you a PM...

After I finish iOS Smile... making good progress now!

EDIT: Loaded channel map to offline html5 database...
That way we don't slow down for something thats almost always static

Working on loading channel map... (previous image was a mockup)


- uspino - 2012-02-24 05:14

mcheng89 Wrote:After I finish iOS Smile... making good progress now!

...and don't forget the other pending project we talked about... the *easy* one...

Seriously, allow us to do donations before somebody hires you and you move to Palo Alto


- europorsche914 - 2012-02-24 05:39

uspino Wrote:...and don't forget the other pending project we talked about... the *easy* one...

Seriously, allow us to do donations before somebody hires you and you move to Palo Alto

I second that!! Cool


- mcheng89 - 2012-02-24 05:45

europorsche914 Wrote:I second that!! Cool

Does the json method work for you? Smile


EDIT: channel list is completely loaded! Smile
still needs to be able to click to start a channel!
Double click to start channel is done!


- europorsche914 - 2012-02-24 06:59

mcheng89 Wrote:Does the json method work for you? Smile


EDIT: channel list is completely loaded! Smile
still needs to be able to click to start a channel!
Double click to start channel is done!

Well I had some issues with cross browser compatibility with JSON, some support it natively but not in every version and all in all it just hasnt behaved well but Im working on a method to make it work any way using string commands, just need to create a loop to load it into an array and then Ill have it working Smile


- mcheng89 - 2012-02-24 07:16

europorsche914 Wrote:Well I had some issues with cross browser compatibility with JSON, some support it natively but not in every version and all in all it just hasnt behaved well but Im working on a method to make it work any way using string commands, just need to create a loop to load it into an array and then Ill have it working Smile

Include this file with your code:
https://github.com/douglascrockford/JSON-js/blob/master/json2.js

If the json isnt supported in the browser, it will automatically add the json function Smile
All the current browser versions have that function built in:
http://caniuse.com/json

EDIT: Fixed annoying tab switching with the library...
TODO: Redo input channel since it doesnt loook too nice


- europorsche914 - 2012-02-24 07:35

mcheng89 Wrote:Include this file with your code:
https://github.com/douglascrockford/JSON-js/blob/master/json2.js

If the json isnt supported in the browser, it will automatically add the json function Smile
All the current browser versions have that function built in:
http://caniuse.com/json

EDIT: Fixed annoying tab switching with the library...
TODO: Redo input channel since it doesnt loook too nice

Still no dice, actually used the json2 from json.org originally and so far havent got anything to work with IE 9 or firefox but just chaulked it up to JSON incompatibility.. Gonna continue with my string modifying which is cross browser compatible unless im missing something and thats why the javascript doesnt work for me

Code:
<html>
<head>
<script language="javascript" src=json2.js></script>
<script language="javascript" type="text/javascript">

function getEPGData() {
    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","http://************:8555/getEPGData",false);
    var request = {
        start_time: start_time,
        end_time: end_time,
        channels: [477]
    };
    xmlhttp.send(JSON.stringify(request));
    xmlDoc=xmlhttp.responseText;
    alert(JSON.parse(xmlDoc));
    xmlhttp.close;
}
</script>
<?php include "/media/Storage/Multimedia/HEADER.html" ?>
</head>
<body>
<hr>

Please wait <b>1 min</b> before changing channels (you must close your media player), otherwise channel will not change...<br> If the channel you are trying to watch is not the one you selected, someone else is watching tv (or you didnt wait 1 minute when changing the channel!).<br>

Pick a channel below to stream, HD starts @ channel 460. Guide Listings also below:<br>
<iframe align=top height=335 width=325 src="http://***********/pickchannel.htm" onload="getEPGData()"></iframe>

etc



- mcheng89 - 2012-02-24 07:38

europorsche914 Wrote:Still no dice, actually used the json2 from json.org originally and so far havent got anything to work with IE 9 or firefox but just chaulked it up to JSON incompatibility.. Gonna continue with my string modifying which is cross browser compatible unless im missing something and thats why the javascript doesnt work for me

Code:
<html>
<head>
<script language="javascript" src=json2.js></script>
<script language="javascript" type="text/javascript">

function getEPGData() {
    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","http://************:8555/getEPGData",false);
    var request = {
        start_time: start_time,
        end_time: end_time,
        channels: [477]
    };
    xmlhttp.send(JSON.stringify(request));
    xmlDoc=xmlhttp.responseText;
    alert(JSON.parse(xmlDoc));
    xmlhttp.close;
}
</script>
<?php include "/media/Storage/Multimedia/HEADER.html" ?>
</head>
<body>
<hr>

Please wait <b>1 min</b> before changing channels (you must close your media player), otherwise channel will not change...<br> If the channel you are trying to watch is not the one you selected, someone else is watching tv (or you didnt wait 1 minute when changing the channel!).<br>

Pick a channel below to stream, HD starts @ channel 460. Guide Listings also below:<br>
<iframe align=top height=335 width=325 src="http://***********/pickchannel.htm" onload="getEPGData()"></iframe>

etc

hmm its this issue: http://stackoverflow.com/questions/1767443/can-i-use-xmlhttprequest-on-a-different-port-from-a-script-file-loaded-from-that
EDIT1: I'll try it tomorrow.

EDIT2: I know what I want to do for input channel now... I think...
TODO: Favorites, Nicer Input Channel, Make Bitrate List... Should be done in 1 more day


- europorsche914 - 2012-02-24 07:42

mcheng89 Wrote:hmm its this issue: http://stackoverflow.com/questions/1767443/can-i-use-xmlhttprequest-on-a-different-port-from-a-script-file-loaded-from-that

youre using php right? i'll write something up for you to try Smile

I'll try it and let ya know if I figure something out, I use php just to use server wide header & footer files and tested with the line removed and nothing changed Sad but hey dont spend too much time on me Im pushing what the run of the mill user would be doing