Want to take your software engineering career to the next level? Join the mailing list for career tips & advice Click here

roku-tinydesk

Tiny Desk Concerts Roku app

Subscribe to updates I use roku-tinydesk


Statistics on roku-tinydesk

Number of watchers on Github 28
Number of open issues 30
Average time to close an issue 2 months
Main language Brightscript
Open pull requests 1+
Closed pull requests 0+
Last commit over 3 years ago
Repo Created over 7 years ago
Repo Last Updated over 2 years ago
Size 3.43 MB
Homepage http://www.npr.or...
Organization / Authornprapps
Contributors3
Page Updated
Do you use roku-tinydesk? Leave a review!
View open issues (30)
View roku-tinydesk activity
View on github
Book a Mock Interview With Me (Silicon Valley Engineering Leader, 100s of interviews conducted)
Software engineers: It's time to get promoted. Starting NOW! Subscribe to my mailing list and I will equip you with tools, tips and actionable advice to grow in your career.
Evaluating roku-tinydesk for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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 nprapps@npr.org!)

Tiny Desk Concerts Roku app

Setup

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 .bash_profile:

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:

export NPR_API_KEY="SUPERUSER_KEY_HERE"

Install 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:

$ ./install.sh

Enjoy!

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:

http://sdkdocs.roku.com/display/RokuSDKv48/Channel+Packaging+And+Publishing#ChannelPackagingAndPublishing-30PackagingApplications

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 quit.

Add this new password to your ~/.bash_profile:

export ROKU_GENKEY_PASSWORD="YOUR_PASSWORD_HERE"

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

Debugging

To connect to your Roku for debugging:

$ telnet $ROKU_IP 8085

Google Analytics

The following events are tracked in Google Analytics:

Category Action Label Value Custom 1 Custom 2
Tiny Desk Startup rokuModel rokuFirmware
Tiny Desk Shutdown sessionDuration numWatched numFinished
Tiny Desk Start title fromList searchTerm
Tiny Desk Continue title fromList searchTerm
Tiny Desk Finish title
Tiny Desk Stop title playtime stoppedAtPct
Tiny Desk Search term
Tiny Desk Feed Unavailable
Tiny Desk Completion percent

Notes:

  • 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, sessionDuration will 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 sessionDuration recorded in the Shutdown event will correctly include the this time.
  • The Feed Unavailable action occurs if the feed.json file 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].

Code conventions

Because Roku dev lacks strong (or any) code conventions, I'm defining my own.

Syntax

  • Constants: UPPERCASE
  • Variables, public members and public functions: camelCase
  • Objects/Constructors: TitleCase
  • Public member functions: GridScreen.refreshLists = GridScreen_refreshLists
  • Private member functions GridScreen._initLists = _GridScreen_initLists
  • Private member vars: _underscorePrefixed
  • Keywords: lowercase, e.g. function and end function

All rules for function names also apply when calling case-insensitive built-in functions, e.g. createObject() and count().

Code organization

Leave a line of whitespace after function and before end function

Never use sub. Always use function.

Classes

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

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
roku-tinydesk open issues Ask a question     (View All Issues)
  • over 5 years Re-insert live Roku ad url
  • over 6 years Move assets out of repo so we can MIT license it
  • over 7 years Maybe update the splash screen
  • over 7 years Interstitial typography
  • over 7 years Context clue for radio mode
  • over 7 years CMS for greatest hits list
  • over 7 years Do fancier sponsor messages natively (instead of as lead-in to the video)
  • over 7 years Organize by mood
  • over 7 years Video corruption when playing ads a 2nd time (Roku 1?)
  • over 7 years Favorites -- mark videos as a favorite? play my favs in a batch?
  • over 7 years Lists by genre
  • over 7 years Do we have firmware requirements?
  • over 7 years tiny desk radio -- plays them pseudo randomly ??
  • over 7 years list of staff favorite videos?
  • over 7 years list of videos currently being watched by others?
  • over 7 years most popular videos list
  • over 7 years suggested videos
  • over 7 years Put a url on screen somewhere to give folks more info about the music
  • over 7 years Generate domain hash from function rather than static
  • over 7 years Analytics requests should be asynchronous
  • over 7 years restart play from beginning (restart play from where i left off is default)
  • over 7 years alphabetical list
  • over 7 years Frequent buffering in HD
  • over 7 years Need custom images for each video that include the artist name
  • over 7 years Videos getting clipped?
  • over 7 years A way to mark/unmark as watched
  • over 7 years Should play first unwatched video on load
  • over 7 years Handle video playback failure
roku-tinydesk open pull requests (View All Pulls)
  • Remove line causing compilation error
roku-tinydesk list of languages used
Other projects in Brightscript
Powered by Autocode - Instant Webhooks, Scripts and APIs
Autocode logo wordmark