Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
lucasgonze
Visitor

Re: External Control of Netflix channel?

I have posted a version of the MOG Roku channel with support for ECP to the private channel for our betas. You can pick up the beta at https://owner.roku.com/add/mogbeta2 . This is a total hack job and I'm relying on the community to QA it.

app id="2049" version="1.82.0"

You must be logged in before using MOG via ECP. To do that use the app normally, in manual mode.

This takes up to 20 track IDs, plays them, and exits. Supply track IDs with the syntax trackID, trackID1, ..., trackID20

Given a Roku on 192.168.0.208, the playlist at http://mog.com/playlists/499366 will play on your Roku if you POST to

http://192.168.0.208:8060/launch/2049?t ... D10=302939
0 Kudos
lucasgonze
Visitor

Re: External Control of Netflix channel?

"whaleface" wrote:
lurking with interest over here. btw lucasgonze, since I'm assuming you are one of MOG's channel developers, thanks for tracking this forum post down. I'm excited to see if you manage to get something working.


You're welcome, whaleface.

I'm counting on you to actually put the thing to use!
0 Kudos
whaleface
Visitor

Re: External Control of Netflix channel?

"lucasgonze" wrote:
I have posted a version of the MOG Roku channel with support for ECP to the private channel for our betas. You can pick up the beta at https://owner.roku.com/add/mogbeta2 . This is a total hack job and I'm relying on the community to QA it.

app id="2049" version="1.82.0"

You must be logged in before using MOG via ECP. To do that use the app normally, in manual mode.

This takes up to 20 track IDs, plays them, and exits. Supply track IDs with the syntax trackID, trackID1, ..., trackID20

Given a Roku on 192.168.0.208, the playlist at http://mog.com/playlists/499366 will play on your Roku if you POST to

http://192.168.0.208:8060/launch/2049?t ... D10=302939


wow, that was fast. it sounds totally cool, got the beta installed and I'm going to give it a shot this weekend and see what I can get going. thanks again!
0 Kudos
EnTerr
Roku Guru

Re: External Control of Netflix channel?

"lucasgonze" wrote:
Is there an ECP controller I can use for testing? Anybody have a generic web form or precompiled OS X binary?


How about a Python snippet? I use this:

import httplib

def ecp_invoke(op, path):
conn = httplib.HTTPConnection(ROKU_IP, 8060)
conn.request(op, path)
r = conn.getresponse()
res = r.read() if r.status==200 else '%d %s' % (r.status, r.reason)
conn.close()
return res

launch = lambda appID, params='': ecp_invoke('POST', '/launch/%s?%s'%(appID,params))
get_app_list = lambda: ecp_invoke('GET', '/query/apps')
keypress = lambda key: ecp_invoke('POST', '/keypress/' + key)
keydown = lambda key: ecp_invoke('POST', '/keydown/' + key)
keyup = lambda key: ecp_invoke('POST', '/keyup/' + key)


Then you'd start an app with
launch('2049', 'trackID=5639969')
0 Kudos
EnTerr
Roku Guru

Re: External Control of Netflix channel?

"lucasgonze" wrote:
This takes up to 20 track IDs, plays them, and exits. Supply track IDs with the syntax trackID, trackID1, ..., trackID20. Given a Roku on 192.168.0.208, the playlist at http://mog.com/playlists/499366 will play on your Roku if you POST to

http://192.168.0.208:8060/launch/2049?t ... D10=302939


May i recommend a simpler API? instead of having 20 parameters trackID#, have only one - and pass list of the track numbers to be played in order. This will shorten the URL (potentially providing for more #) and remove arbitrary limit of 20 (probably will simplify your code too). The track IDs can be seprated with spaces, which gets URLencoded to `+`, so it will look neat in the form of "?trackIDs=111+222+333+444". Inside the channel code you will receive string that needs to be split on spaces.

Here is illustration: instead of
http://192.168.0.208:8060/launch/2049?trackID=5639969&trackID1=13203815&trackID2=18362895&trackID3=10936097&trackID4=287941&trackID5=539503&trackID6=34731947&trackID7=9046631&trackID8=9925193&trackID9=302937&trackID10=302939

(224 chars) call like so (133 chars)
http://192.168.0.208:8060/launch/2049?trackIDs=5639969+13203815+18362895+10936097+287941+539503+34731947+9046631+9925193+302937+302939
0 Kudos
lucasgonze
Visitor

Re: External Control of Netflix channel?

EnTerr, the way I got this done so quickly was that I happened to have a slice of free time right when this topic came up. But today I'm busy again. So if you can help get the code written for the new arg style I'm happy to make the change (or support both argument styles for the sake of "legacy" code).

My current source code is here: http://pastebin.com/n6v6VCPT
0 Kudos
EnTerr
Roku Guru

Re: External Control of Netflix channel?

"lucasgonze" wrote:
EnTerr, the way I got this done so quickly was that I happened to have a slice of free time right when this topic came up. But today I'm busy again. So if you can help get the code written for the new arg style I'm happy to make the change (or support both argument styles for the sake of "legacy" code).

My current source code is here: http://pastebin.com/n6v6VCPT


Ok, how about this (oops, i pasted it in pasta-bin too):

if( params["trackIDs"] <> invalid ) then
tidStr = params["trackIDs"] + " " 'extra space to simplify handling in loop
playlist = []
i = instr(1, tidStr, " ")
while i>0
digested = ecp_digest_trackID(left(tidStr, i-1))
if( digested <> invalid ) playlist.push(digested)
tidStr = mid(tidStr, i+1)
i = instr(1, tidStr, " ")
end while
end if
0 Kudos
TheEndless
Channel Surfer

Re: External Control of Netflix channel?

"EnTerr" wrote:
"lucasgonze" wrote:
EnTerr, the way I got this done so quickly was that I happened to have a slice of free time right when this topic came up. But today I'm busy again. So if you can help get the code written for the new arg style I'm happy to make the change (or support both argument styles for the sake of "legacy" code).

My current source code is here: http://pastebin.com/n6v6VCPT


Ok, how about this (oops, i pasted it in pasta-bin too):

if( params["trackIDs"] <> invalid ) then
tidStr = params["trackIDs"] + " " 'extra space to simplify handling in loop
playlist = []
i = instr(1, tidStr, " ")
while i>0
digested = ecp_digest_trackID(left(tidStr, i-1))
if( digested <> invalid ) playlist.push(digested)
tidStr = mid(tidStr, i+1)
i = instr(1, tidStr, " ")
end while
end if

That can be simplified greatly...

if( params["trackIDs"] <> invalid ) then
playlist = params["trackIDs"].Tokenize(" ")
end if
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
lucasgonze
Visitor

Re: External Control of Netflix channel?

I have published a new version that supports a spaces-separated list sent to an argument named trackIDs.

This is not backwards compatible with the first version. The arguments trackID, trackID1, ..., trackID20 don't work any more.
0 Kudos
lucasgonze
Visitor

Re: External Control of Netflix channel?

And thanks for the incantations, EnTerr and TheEndless.

gonzotek, reading the remoku source was a big help. I appreciate the learning. In the end I used hardcoded hack forms like this one, so that I could focus on just the brightscript: http://pastebin.com/8RryduUv
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.