Alexa news-flash scripts for New Zealand
In http://alexa.vagabond.net.nz/ you'll find the alexa scripts which you can set as the feed source in the Amazon developer settings.
The same files are in the source directory http://alexa.vagabond.net.nz/source/ but not interpreted, i.e. so you view the source code.
Setting up a feed for your Alexa:
- Register for a free developer account on developer.amazon.com
- Click Alexa->Alexa skills kit
- Click "Add a new skill"
- Click "Flash briefing skill API"
- Fill in each of the stages up to testing. For the news feed, you'll need a file hosted somewhere that returns the appropriate json data. The amazon documentation gives you an example of what you need.
- Click "Yes" for start testing this skill.
- Go to the alexa app (or alexa.amazon.com) and click skills. In the top right, click "Your skills" and search for the name you entered at step 5.
- Click on the skill and then click "Enable"
- Then go to settings->flash briefing and enable it.
About the feeds
- Most are just static as the URL doesn't change for the news feed, and I haven't done any processing of the audio on them.
- The radio NZ scripts are different. What you see is the processed result, i.e. what alexa expects to see.
- http://alexa.vagabond.net.nz/rnznews_not_normalised.php Just looks to see if the news for the current hour has been posted yet, and if so it returns the link to this. If it hasn't been posted yet (it's normally 6-10 mins after the hour for it to be posted) then it returns the previous hour's bulletin.
- http://alexa.vagabond.net.nz/rnznews.php uses a volume adjusted and silence trimmed version of the feed, and the logic is similar to the other Radio NZ script. However, processing the audio file on the fly with my budget shared hosting server is too slow for alexa to accept, so this is done via a separate cronscript. So, the process prioritises latest news over volume. I.e. It checks for a processed version of the current hour's news, if that doesn't exist it looks for the live version of the current hour (this could occur if you ask for news in the wrong two-minute window). If the current hour hasn't been published online it repeats the process for the previous hour's news.
Notes:
- I'm not the content owner, so can't publish the skill for others to use. Until the rightful owner sets up a feed, or states that they're happy for it to be published, you need to set up your own feed and leave it in testing mode on the amazon developer site.
- Feeds should be served via https according to Amazon. In testing mode at least, they will work over http. You'll see a warning on the amazon site. It'll still work.
- Feeds should be 256kb/s according to Amazon. The source for these feeds aren't, so I see no point in upscaling them. They still work in their native resolution.
- The feeds are not set at the volume level that Amazon expects, so will be quiet. If you have a particular feed you need adjusted, feel free to either do that (see the process_rnz.php script) or ask nicely and I'll consider it.