Copyright 2013 NPR. All rights reserved. No part of these materials may be reproduced, modified, stored in a retrieval system, or retransmitted, in any form or by any means, electronic, mechanical or otherwise, without prior written permission from NPR.
(Want to use this code? Send an email to firstname.lastname@example.org!)
Tiny Desk Concerts Roku app
Put your Roku into Dev Mode.
Your Roku will tell you its IP address and have you set a developer password. Set these in your
export ROKU_IP="10.0.1.2" export ROKU_PASSWORD="mypassword"
Install the Python requirements:
$ mkvirtualenv roku-tinydesk $ pip install requirements.txt
Generate JSON feed
This step is not necessary to run the app.
To regenerate the API feed you will need a superuser NPR API key and our AWS keys. Set the API key in your
.bash_profile like so:
s3cmd and configure it with the
nprapps AWS keys:
$ s3cmd --configure
To generate (and deploy) the Tiny Desk API feed:
$ workon roku-tinydesk $ ./update_feed.py
Package & Deploy
To package up the code and deploy it to your Roku:
Distribute the app
Note: If this process isn't completed with Chris' Roku keys, users of the app will lose their registry data. The way around this is to "rekey" each developer's Roku with the same RSA key. Read more here:
Note part 2: This is probably irrelevant anyway, because you would need Chris' Roku credentials to access the upload page. Ergo, these docs are really just for him.
Distributing the app to Roku requires jumping through additional hoops. First, you'll need to generate crypotgraphic keys on your Roku. Do this like so:
$ telnet $ROKU_IP 8080 > genkey
Your password will be print out: save it. Exit the telnet session by typing
Add this new password to your
Now to generate a shippable zip, simply run:
$ ./ship.sh 1.0
You must supply a version number as the first argument.
Now take your new package and upload it at: https://owner.roku.com/Developer/Apps/Packages/23962
To connect to your Roku for debugging:
$ telnet $ROKU_IP 8085
The following events are tracked in Google Analytics:
|Category||Action||Label||Value||Custom 1||Custom 2|
|Tiny Desk||Feed Unavailable|
- The Shutdown action isn't recorded until the next time the application is run, because there is no reliable shutdown event in a Roku app. As a result,
sessionDurationwill always be approximate.
- The Stop action is reported alongside the Finish action when a video is completed, for purposes of tracking playtimes.
- There is no concept of a ping in this event model, so users will appear inactive on the Google Analytics dashboard while in the middle of a long video or sitting on a menu. Their
sessionDurationrecorded in the Shutdown event will correctly include the this time.
- The Feed Unavailable action occurs if the
feed.jsonfile can not be downloaded from S3 after several attempts. (Do to an error or poor connectivity.)
- Completion added in April, 2015. Reported values are
[25, 50, 75, 100].
Because Roku dev lacks strong (or any) code conventions, I'm defining my own.
- Variables, public members and public functions:
- Public member functions:
GridScreen.refreshLists = GridScreen_refreshLists
- Private member functions
GridScreen._initLists = _GridScreen_initLists
- Private member vars:
- Keywords: lowercase, e.g.
All rules for function names also apply when calling case-insensitive built-in functions, e.g.
Leave a line of whitespace after
function and before
sub. Always use
In class constructors define the class object as
this. In member functions redefine the class object as
this = m. Never use
m to refer to the global namespace.
Comments describing a functions purpose should precede the function defintion.
Modules should begin with a block comment explaning their purpose:
' ' Explainer goes here ' function main() blah blah