With the siri proxy gem (https://github.com/plamoni/SiriProxy) creating your own fun stuff for iPhone 4s’s Siri is pretty straight forward.
Trakt.tv has an amazing API and I wrote a small wrapper (see lib/trakt.tv) in the project) to fetch a users’s calendar for that night.
First off make sure you read all the documentation on the proxy github page, setting up the DNS server can be tricky if you don’t follow all the steps in the video.
Naming is very important for the siri proxy so make sure you do it right! The name you set in the siri proxy config should be the classname you extend the plugin from. The name downcased should be the gem name (with siriproxy prepended) It took me a while to figure out and get everything up and running.
def generate_calendar_response(ref_id)
object = SiriAddViews.new
object.make_root(ref_id)
object.views << SiriAssistantUtteranceView.new("Here is your trakt calendar!")
episodes = Trakt::User::Calendar.new.results.first['episodes']
episodes.each do |calendar_result|
object.views << SiriAssistantUtteranceView.new(calendar_result['show']['title'])
end
object
end
listen_for /what's on tv tonight/i do
send_object self.generate_calendar_response(last_ref_id)
request_completed
end
The listen_for tells the proxy what words to match with the response from apple, the code in the block gets executed when the words match
In the generate_calendar_response i create a new view and add every episode i get from trakt to it. The whole thing gets returned to your iPhone and siri tells you the results :)
The video below shows the result.
As always the code can be found on GitHub
Let's see if we can go node-less with Yew.
For a simple side-project, I needed to serve static JSON, with proper CORS headers.
I have rewritten my middleman site to Svelte/SvelteKit, here's what I encountered.
Or, make sure your headers match, otherwise you'll get a lot of strange errors.
Or, how something so simple cost me so much time.