Kodi Community Forum
Release Kanzi: Amazon Alexa skill for Kodi - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Supplementary Tools for Kodi (https://forum.kodi.tv/forumdisplay.php?fid=116)
+--- Thread: Release Kanzi: Amazon Alexa skill for Kodi (/showthread.php?tid=254502)



RE: Amazon Echo skill for Kodi - m0ngr31 - 2017-04-19

The HowToGeek article is out of date. It is being updated, but might not be live for a few more days.

At this point, I'd delete the function from lambda and try again.

I was just notified that the HowToGeek article was updated this morning, so maybe it'll be easier to follow if you start over?


RE: Amazon Echo skill for Kodi - bsollenb54 - 2017-04-20

Yup - I don't know what exactly I did differently, but following the new HowToGeek article update, it's working like a charm!

Maybe I haven't found it in the SampleUtterances yet, but is there a way to stop playback? or to exit Kodi?....I see suspend and shutdown commands, but they didnt work on my FireTV....maybe ARM devices behave differently.

Either way, this is super tight! I finally have a good use for my Echo! Thanks m0ngr31!

You have a patreon or something for donations? I didnt see it in the README - this is definitely worth a few bucks to me,


RE: Amazon Echo skill for Kodi - jingai - 2017-04-20

"Alexa, tell Kodi to stop"

And "shutdown" can be configured to mean quit in your env file, but I honestly don't know if it works on the Fire TV.

Sent from my D5803


RE: Amazon Echo skill for Kodi - bsollenb54 - 2017-04-20

What about to stop playback of whatever show/movie you're watching?


RE: Amazon Echo skill for Kodi - jingai - 2017-04-20

"Alexa, tell Kodi to stop" will stop playback.

Sent from my D5803


RE: Amazon Echo skill for Kodi - ex_directory - 2017-04-27

Having followed the how to geek and github, felt like everything was set-up perfect. But Alexa was having troubles talking to Kodi.

I found the howtogeek easiest to follow using windows and python 2.7.

I found the test page on aws also very useful, could have done with this being highlighted in howtogeek to check it is all working.

At first i tried

"ask living room to play a movie"

I got "There was an error calling the remote endpoint, which returned HTTP 500 : Internal Server Error"

Turns out this was my mistake, i had the wrong password in my .env file, so i ran the zappa update dev command

Then the test page was working but still alexa was having troubles.

I solved this by adding UK language, I am in the UK and have a UK Echo. So not sure if this was the issue but after adding UK it worked, I deleted US language and it still worked.

Now randomly going through my music and movie collection and the hit rate is very high!!

Thanks - love this skill Big Grin


RE: Amazon Echo skill for Kodi - realjohngalt - 2017-04-29

I've attempted to use heroku with the app (as well as rolling back git from master HEAD to when heroku was added), but get the following (log from current HEAD using link in README.md):

Code:
017-04-28T23:16:04.390693+00:00 app[web.1]: [2017-04-28 23:16:04,388] ERROR in app: Exception on / [POST]

2017-04-28T23:16:04.390708+00:00 app[web.1]: Traceback (most recent call last):

2017-04-28T23:16:04.390710+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app

2017-04-28T23:16:04.390711+00:00 app[web.1]:     response = self.full_dispatch_request()

2017-04-28T23:16:04.390712+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request

2017-04-28T23:16:04.390713+00:00 app[web.1]:     rv = self.handle_user_exception(e)

2017-04-28T23:16:04.390714+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception

2017-04-28T23:16:04.390715+00:00 app[web.1]:     reraise(exc_type, exc_value, tb)

2017-04-28T23:16:04.390715+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request

2017-04-28T23:16:04.390716+00:00 app[web.1]:     rv = self.dispatch_request()

2017-04-28T23:16:04.390716+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request

2017-04-28T23:16:04.390717+00:00 app[web.1]:     return self.view_functions[rule.endpoint](**req.view_args)

2017-04-28T23:16:04.390717+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask_ask/core.py", line 594, in _flask_view_func

2017-04-28T23:16:04.390719+00:00 app[web.1]:     result = self._map_intent_to_view_func(self.request.intent)()

2017-04-28T23:16:04.390720+00:00 app[web.1]:   File "/app/alexa.py", line 52, in alexa_new_show_inquiry

2017-04-28T23:16:04.390721+00:00 app[web.1]:     card_title = render_template('looking_for_show', heard_show=heard_show).encode("utf-8")

2017-04-28T23:16:04.390721+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/flask/templating.py", line 133, in render_template

2017-04-28T23:16:04.390722+00:00 app[web.1]:     return _render(ctx.app.jinja_env.get_or_select_template(template_name_or_list),

2017-04-28T23:16:04.390724+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 869, in get_or_select_template

2017-04-28T23:16:04.390724+00:00 app[web.1]:     return self.get_template(template_name_or_list, parent, globals)

2017-04-28T23:16:04.390725+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 830, in get_template

2017-04-28T23:16:04.390726+00:00 app[web.1]:     return self._load_template(name, self.make_globals(globals))

2017-04-28T23:16:04.390726+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 804, in _load_template

2017-04-28T23:16:04.390727+00:00 app[web.1]:     template = self.loader.load(self, name, globals)

2017-04-28T23:16:04.390728+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/loaders.py", line 125, in load

2017-04-28T23:16:04.390729+00:00 app[web.1]:     code = environment.compile(source, name, filename)

2017-04-28T23:16:04.390729+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 581, in compile

2017-04-28T23:16:04.390731+00:00 app[web.1]:     defer_init=defer_init)

2017-04-28T23:16:04.390731+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/environment.py", line 543, in _generate

2017-04-28T23:16:04.390732+00:00 app[web.1]:     optimized=self.optimized)

2017-04-28T23:16:04.390733+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/jinja2/compiler.py", line 78, in generate

2017-04-28T23:16:04.390733+00:00 app[web.1]:     raise TypeError('Can\'t compile non template nodes')

2017-04-28T23:16:04.390734+00:00 app[web.1]: TypeError: Can't compile non template nodes

Edit: I set it up on my own webserver and got the same error.

Edit2: even simple commands such as "back" cause this TypeError, with the following preceding the above:
Code:
Navigate: Back
Sending request to http://redacted:8080/jsonrpc



RE: Amazon Echo skill for Kodi - jingai - 2017-04-29

@realjohngalt, I don't have time to figure out why just this moment, but it appears Flask-Ask 0.9.2 broke something. Not sure who's at fault, but downgrading to 0.9.1 makes it work.


RE: Amazon Echo skill for Kodi - superwad - 2017-04-29

I'm probably doing something blindingly stupid, but I can't find wsgi.py. It's not on the git repo, it's not in my local directory. I can see the file in Google's cache, but I can't actually find the copy for the latest version.

I'm trying to self-host if this makes a difference. My apache logs have these lines in them on startup:

Code:
[Fri Apr 28 18:46:27.469269 2017] [wsgi:error] [pid 21835] [client 10.0.0.250:40922] Target WSGI script not found or unable to stat: /srv/www/vhosts/server/kodi-alexa/wsgi.py

And sure enough, there's no .py file in that directory by that name.


RE: Amazon Echo skill for Kodi - realjohngalt - 2017-04-29

(2017-04-29, 03:14)jingai Wrote: @realjohngalt, I don't have time to figure out why just this moment, but it appears Flask-Ask 0.9.2 broke something. Not sure who's at fault, but downgrading to 0.9.1 makes it work.

Thank you, it works perfectly by downgrading to 0.9.1. This is a ridiculously cool project.
(2017-04-29, 04:41)superwad Wrote: I'm probably doing something blindingly stupid, but I can't find wsgi.py. It's not on the git repo, it's not in my local directory. I can see the file in Google's cache, but I can't actually find the copy for the latest version.

I'm trying to self-host if this makes a difference. My apache logs have these lines in them on startup:

Code:
[Fri Apr 28 18:46:27.469269 2017] [wsgi:error] [pid 21835] [client 10.0.0.250:40922] Target WSGI script not found or unable to stat: /srv/www/vhosts/server/kodi-alexa/wsgi.py

And sure enough, there's no .py file in that directory by that name.

I just self hosted and can help! First do "pip install -r requirements.txt" from the cloned repo (using python2 so maybe pip2, or the virtualenv route like in README.md), then run "gunicorn alexa:app" and setup a reverse proxy in apache from 8080 to 443 with a self signed cert (you'll be using the public cert for the 3rd ssl option on amazon). I'm using nginx, so can't help too much with the apache setup. However, there's documentation all over the web for reverse proxies and self signed certs (depending on your hosting setup, you might be able to use another cert as well...).

Depending on your init system, you can set it to run as a systemd service or something else so you won't need to manually start it if your system reboots.


RE: Amazon Echo skill for Kodi - superwad - 2017-04-29

(2017-04-29, 06:05)realjohngalt Wrote:
(2017-04-29, 03:14)jingai Wrote: @realjohngalt, I don't have time to figure out why just this moment, but it appears Flask-Ask 0.9.2 broke something. Not sure who's at fault, but downgrading to 0.9.1 makes it work.

Thank you, it works perfectly by downgrading to 0.9.1. This is a ridiculously cool project.
(2017-04-29, 04:41)superwad Wrote: I'm probably doing something blindingly stupid, but I can't find wsgi.py. It's not on the git repo, it's not in my local directory. I can see the file in Google's cache, but I can't actually find the copy for the latest version.

I'm trying to self-host if this makes a difference. My apache logs have these lines in them on startup:

Code:
[Fri Apr 28 18:46:27.469269 2017] [wsgi:error] [pid 21835] [client 10.0.0.250:40922] Target WSGI script not found or unable to stat: /srv/www/vhosts/server/kodi-alexa/wsgi.py

And sure enough, there's no .py file in that directory by that name.

I just self hosted and can help! First do "pip install -r requirements.txt" from the cloned repo (using python2 so maybe pip2, or the virtualenv route like in README.md), then run "gunicorn alexa:app" and setup a reverse proxy in apache from 8080 to 443 with a self signed cert (you'll be using the public cert for the 3rd ssl option on amazon). I'm using nginx, so can't help too much with the apache setup. However, there's documentation all over the web for reverse proxies and self signed certs (depending on your hosting setup, you might be able to use another cert as well...).

Depending on your init system, you can set it to run as a systemd service or something else so you won't need to manually start it if your system reboots.

So it looks like I have Python2 and Python3 available, so I ran the commands again with pip2 (after resolving a dependency on libffi), and I managed to get all the requirements installed (under pip and pip2 for what it's worth).

Then I got the gunicorn step working. I see "Listening at: http://127.0.0.1:8000", and I'm getting an error about python-Levenshtein not being installed, but I don't think that's necessarily the problem.

My Apache setup has an SSL server running (and responding), and the cert is installed (though it looks like I'm getting self-signed issues).

Now the problem is that the page only loads a 404 instead of any other error. Apache logs agree that the wsgi.py file is still missing, and that the endpoint kodi-alexa doesn't exist on my server (even though it kinda really does).


RE: Amazon Echo skill for Kodi - superwad - 2017-04-29

I ripped out the entire kodi-alexa install, set it into it's own new subdirectory of the rest of my web stuff, re-cloned and set up the .env file, adjusted all my VirtualHost config, restarted Apache2, and while I can hit the endpoint in my browser using either the IP or the proper name, I keep getting a 404 from testing my skill.

Also, fixed the python-Levenshtein issue by simply installing it. Now gunicorn is running without any apparent errors.

The error logs are still definitely complaining about the seeming lack of wsgi.py though. @realjohngalt do you have that file in your cloned repo?


RE: Amazon Echo skill for Kodi - superwad - 2017-04-29

Ah, lovely. I seem to have it working now. I caved and downloaded the cached copy of wsgi.py and put it in. I get a 502 in the browser, and my test works. I can also control it via Alexa as well.

Fingers crossed, this seems to be working after not too much headache! Big Grin


RE: Amazon Echo skill for Kodi - jingai - 2017-04-29

@superwad, you downloaded wsgi.py from where exactly? That's not what you want to point Apache at anymore. As of 2.5, it's alexa.wsgi.


RE: Amazon Echo skill for Kodi - jingai - 2017-04-30

It's safe to update to Flask-Ask 0.9.2 now -- I've fixed the issue with it.