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 - newoski - 2016-11-01

(2016-11-01, 17:41)jingai Wrote: The JSON call, VideoLibrary.GetMovies, is taking somewhere between 10 and 11 *seconds*. I couldn't tell you why, but that is how long it took Kodi to process and return the data.

Do you have a really, really slow uplink...?

You might put Kodi into debug mode, try the request again, and then examine the Kodi log to see if it's actually spending 10 seconds getting the list of movies, or if it's the act of sending the results that's the issue.

Comcast. 10MB uplink. Working on a log file


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 17:41)jingai Wrote: The JSON call, VideoLibrary.GetMovies, is taking somewhere between 10 and 11 *seconds*. I couldn't tell you why, but that is how long it took Kodi to process and return the data.

Do you have a really, really slow uplink...?

You might put Kodi into debug mode, try the request again, and then examine the Kodi log to see if it's actually spending 10 seconds getting the list of movies, or if it's the act of sending the results that's the issue.

Here's my log, from GetMovies through Alexa launching playback

http://pastebin.com/xuq2Lxyx

From the line below, it looks like the query is only taking 24 ms?
11:45:09 T:140153851582208 DEBUG: RunQuery took 24 ms for 1836 items query: select * from movie_view

Any insights would be greatly appreciated!


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

@newoski, I'm not totally sure, honestly. There's a ton of other requests to Kodi's webserver there.. I don't know if that's normal or not with Emby.

I'm thinking the origin of the request (HTTP vs your remote/keyboard) might be triggering a different path. I really don't think this has anything to do with the skill per se, since it seems the skill is otherwise executing within 1 second, disregarding the time it takes to get the movie list from Kodi.

If you have access to curl somewhere on one of your local machines, try this:

Code:
curl --data-binary '{"jsonrpc":"2.0", "method":"Player.Open", "params":{"item":{"movieid":391}}, "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

Leave debugging enabled in Kodi so you can see what's going on there too. Tell me how long that takes.


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 18:52)jingai Wrote: @newoski, I'm not totally sure, honestly. There's a ton of other requests to Kodi's webserver there.. I don't know if that's normal or not with Emby.

I'm thinking the origin of the request (HTTP vs your remote/keyboard) might be triggering a different path. I really don't think this has anything to do with the skill per se, since it seems the skill is otherwise executing within 1 second, disregarding the time it takes to get the movie list from Kodi.

If you have access to curl somewhere on one of your local machines, try this:

Code:
curl --data-binary '{"jsonrpc":"2.0", "method":"Player.Open", "params":{"item":{"movieid":391}}, "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

Leave debugging enabled in Kodi so you can see what's going on there too. Tell me how long that takes.

Sadly, I can't do this. Comcast doesn't allow you to access DDNS from within your own network. I could testit from outside my network, but not from within...


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

Huh? Just use the local IP address of the machine on which Kodi is running.


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 19:16)jingai Wrote: Huh? Just use the local IP address of the machine on which Kodi is running.
Figured that out. Standby....

Sent from my HTC6535LVW


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

If I try that immediately after my Chromebox running LibreELEC boots, that command doesn't seem to do anything. If I give it a few minutes and then run it... it launches the movie nearly instantly.


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

Ok, now do:

Code:
time curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

See how long that takes. If it doesn't work with the time command in front, just remove that and roughly gauge the time it takes to finish returning the response.


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 19:37)jingai Wrote: Ok, now do:

Code:
time curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

See how long that takes. If it doesn't work with the time command in front, just remove that and roughly gauge the time it takes to finish returning the response.

This one seems to just hang/time out


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 19:37)jingai Wrote: Ok, now do:

Code:
time curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

See how long that takes. If it doesn't work with the time command in front, just remove that and roughly gauge the time it takes to finish returning the response.

Sorry, didn't catch the second part. Without the time parameter, it's nearly instant.


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

Well, I'm thoroughly confused then.. the only thing left it can be is that it's just, for whatever reason, taking 10 seconds to return the list of movies to the skill.

Are you perhaps currently saturating your uplink?


RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 19:43)jingai Wrote: Well, I'm thoroughly confused then.. the only thing left it can be is that it's just, for whatever reason, taking 10 seconds to return the list of movies to the skill.

Are you perhaps currently saturating your uplink?
Not at all

Sent from my HTC6535LVW


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

Is it at all possible for you to repeat the last command remotely?

Code:
curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc



RE: Amazon Echo skill for Kodi - newoski - 2016-11-01

(2016-11-01, 19:47)jingai Wrote: Is it at all possible for you to repeat the last command remotely?

Code:
curl --data-binary '{"jsonrpc":"2.0", "method":"VideoLibrary.GetMovies", "id":1}' -H 'content-type: application/json;' -u username:password http://host:port/jsonrpc

Currently, I'm on all Windows 7 PCs. I've been using Putty to log into my local Unraid server and then send the curls via Putty/Unraid.

I could put the Windows 7 machine behind a VPN, and then repeat the process, which would emulate remote access.

Would that be helpful? Otherwise, I'm unclear how to go about sending the commands remotely...


RE: Amazon Echo skill for Kodi - jingai - 2016-11-01

Well, I think if you really want to diagnose the problem, executing the command remotely is the next step.

The two commands I gave you to try via curl are the exact commands the PlayMovie Intent sends in this case.

The only other thing I can think is even a little feasible is that maybe Comcast is throttling bandwidth on certain ports. If you're using port 80 or 8080, they may be throttling it to prevent you from running a web server at home. It's a long shot, but maybe try changing the port to something else.

If you're not afraid of going into the code a little, in alexa_play_movie() in wsgi.ini (around line 973 if your copy is current) you can add some additional print statements around things to see how long they're taking to execute. Particularly, I'd check around kodi.GetMovies(), kodi.matchHeard(), and kodi.PlayMovie(). I think kodi.matchHeard() is the only thing left here that could be the problem, but it'd be odd for this to take 10 seconds.