Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
jespin3
Level 7

Scripting for Roku

Hello, I just want to apologize ahead of time for my noob-ness. This is my first post.

I am wondering if Rokus can respond to script commands.

I came across this post during a search. This user wrote a script to effectively implement a two minute skip.
https://forums.roku.com/viewtopic.php?f ... 21#p529958

I would like to pick anyone's brain on this. Apparently TCL/TK was used; https://www.tcl.tk/

Ultimately, I would want to see if it's possible to automatically restart a TV stream after it gets stuck (and stays) on the "Loading... please wait" screen.
0 Kudos
6 Replies
jespin3
Level 7

Re: Scripting for Roku

Ok I found the commands, which does some of the things I am looking for. I am currently playing around with them.

https://sdkdocs.roku.com/display/sdkdoc ... trol+Guide

Edit:

So basically I want to write a script that will refresh/reboot my current streaming TV channel.

curl -d '' http://172.16.1.173:8060/launch/11?contentID=27536  #ID for CBS News, 172.16.1.173 is my Roku IP
sleep 1
curl -d '' http://172.16.1.173:8060/keypress/Select


However I want to expand this.

curl http://172.16.1.173:8060/query/active-app #Pull current channel thats running


Then re-launch this channel

curl -d '' http://172.16.1.173:8060/launch/11?contentID=27536 #Where 27536 is what was pulled from active-app
0 Kudos
EnTerr
Level 8

Re: Scripting for Roku

"jespin3" wrote:
Then re-launch this channel
curl -d '' http://172.16.1.173:8060/launch/11?contentID=27536 #Where 27536 is what was pulled from active-app

To re-launch you'll need this:
curl -d '' http://172.16.1.173:8060/keypress/Home
curl -d '' http://172.16.1.173:8060/launch/27536

There is a problem further down the road though: there is no way to detect when channel [gets stuck (and stays) on the "Loading... please wait" screen."]
0 Kudos
jespin3
Level 7

Re: Scripting for Roku

"EnTerr" wrote:
"jespin3" wrote:
Then re-launch this channel
curl -d '' http://172.16.1.173:8060/launch/11?contentID=27536 #Where 27536 is what was pulled from active-app

To re-launch you'll need this:
curl -d '' http://172.16.1.173:8060/keypress/Home
curl -d '' http://172.16.1.173:8060/launch/27536

There is a problem further down the road though: there is no way to detect when channel [gets stuck (and stays) on the "Loading... please wait" screen."]


I appreciate the reply! At this point I have an expectation of my Roku getting stuck at the Loading... please wait screen periodically. I'm going to attempt to have the current channel that's playing refresh the stream regardless if stuck or not.
0 Kudos
RokuMarkn
Level 7

Re: Scripting for Roku

I'd suggest that you may be approaching this wrong. Getting stuck at loading is not a normal situation and in the vast majority of channels it doesn't happen. I've never heard of another developer who felt they needed to do something like this. There may be some issue that causes your server to stop delivering data to the Roku. Restarting the stream in that case seems like a band-aid solution, while figuring out the actual communication problem seems more appropriate.

--Mark
0 Kudos
EnTerr
Level 8

Re: Scripting for Roku

I think "power user" and not "app developer", @RokuMarkn.
I doubt @jespin3 is the developer of #27536 (CBS News). Seems trying to MacGyver workaround for 3rd party channel hang-ups.
0 Kudos
jespin3
Level 7

Re: Scripting for Roku

"EnTerr" wrote:
I think "power user" and not "app developer", @RokuMarkn.
I doubt @jespin3 is the developer of #27536 (CBS News). Seems trying to MacGyver workaround for 3rd party channel hang-ups.


EnTerr, you are correct. I am making an attempt at a work-around.

RokuMarkn, I'm kinda tapped on my network hangup issues. I've been down that path already. I am okay with a band-aid solution through emulating remote control commands.
My knowledge of programming and scripting is very basic, so I'm making an attempt to get up to speed. This is stuff I'm interested in anyways so it doesn't hurt to give it a shot!

Essentially, I am trying to figure my way through what I want my program to do;


    Search for Roku on the network and determine it's IP. Store IP.
    Query what channel that's currently on display. Store app-ID.
    query/active-app

    Re-launch the stored app-ID
    launch/11?contentID=14'

    At a set interval, keep relaunching current appp-ID


Basically I just want to keep my Roku playing TV all day without needing to babysit it.
0 Kudos