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)



Amazon Echo skill for Kodi - digiltd - 2017-03-26

@deboyd what is your upload speed like?


RE: Amazon Echo skill for Kodi - deboyd - 2017-03-26

@digiltd I just tested it at 900kbps


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-26

(2017-03-25, 18:52)deboyd Wrote: @digiltd

I am back again with (slightly) more skill. I have progressed through all my issues and now, have landed upon this "time" issue like many other people on this thread. If it is true that my PC time is out of sync with the destination clock, then changing my PC time to equal the destination clock should fix the problem.

My PC clock is currently in Central Time and the destination clock is US-West-2. I changed my PC clock to be Pacific Time and re-ran the command to upload .env to AWS. It took the same 10 minutes and had the exact same error. Am I using the right time zone for US-West-2? Any other thoughts?

Here is my specific error read out:


botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170325T155703Z is now earlier than 20170325T160002Z (20170325T160502Z - 5 min.)

Thank you in advance!

I have this issue as well. Synced my time and tried to deploy on Mac and Linux machines with no progress.

Please, if you make some progress let us know and I will do the same.


Amazon Echo skill for Kodi - digiltd - 2017-03-27

How are you both deploying?

10 minutes to upload is a little slow, and that might be causing this time issue. To see if it is can you try opening up the requirements file and removing all the text in it (making sure you have kept a backup somewhere). Then try the deploy. This will not give you a working skill, the stuff in the requirements needs to be there for the skill to work. But it will lighten the upload package to see if that is the cause of the problem. If it is then we can see if there is an alternative way to deploy for you.


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-27

(2017-03-27, 00:42)digiltd Wrote: How are you both deploying?

$ python deploy-to-lambda.py
2017-03-26 18:43:53:INFO:botocore.credentials: Found credentials in environment variables.
2017-03-26 18:43:53:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-03-26 18:43:53:WARNING:lambda_deploy: A .env file exists in your Lambda directory - be careful that it does not contain any secrets you don't want uploaded to AWS!
2017-03-26 18:43:53:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
Traceback (most recent call last):
File "/usr/local/bin/lambda-deploy", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 376, in main
method()
File "/usr/local/lib/python2.7/site-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
Publish=True
File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/site-packages/botocore/client.py", line 543, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidSignatureException) when calling the CreateFunction operation: Signature expired: 20170326T224359Z is now earlier than 20170326T224551Z (20170326T225051Z - 5 min.)
Collecting requests (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 1))
Using cached requests-2.13.0-py2.py3-none-any.whl
Collecting gunicorn (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 2))
Using cached gunicorn-19.7.1-py2.py3-none-any.whl
Collecting yaep (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 3))
Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 4))
Collecting pytz (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 5))
Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting fuzzywuzzy (from -r /Users/user/kodi-alexa/kodi-alexa/requirements.txt (line 6))
Using cached fuzzywuzzy-0.15.0-py2.py3-none-any.whl
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Successfully installed fuzzywuzzy-0.15.0 gunicorn-19.7.1 pycountry-17.1.8 pytz-2016.10 requests-2.13.0 yaep-0.0.6
Starting new HTTPS connection (1): lambda.us-east-1.amazonaws.com
Adding new kodi-alexa lambda


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-27

(2017-03-27, 00:42)digiltd Wrote: 10 minutes to upload is a little slow, and that might be causing this time issue. To see if it is can you try opening up the requirements file and removing all the text in it (making sure you have kept a backup somewhere). Then try the deploy. This will not give you a working skill, the stuff in the requirements needs to be there for the skill to work. But it will lighten the upload package to see if that is the cause of the problem. If it is then we can see if there is an alternative way to deploy for you.

Well, let's look at some alternative way:

$ python deploy-to-lambda.py
2017-03-26 19:07:47:INFO:botocore.credentials: Found credentials in environment variables.
2017-03-26 19:07:47:INFO:lambda_deploy: Packaging lambda kodi-alexa
2017-03-26 19:07:47:WARNING:lambda_deploy: A .env file exists in your Lambda directory - be careful that it does not contain any secrets you don't want uploaded to AWS!
2017-03-26 19:07:47:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
You must give at least one requirement to install (see "pip help install")
Starting new HTTPS connection (1): lambda.us-east-1.amazonaws.com
Adding new kodi-alexa lambda
Successfully deployed kodi-alexa version 1


RE: Amazon Echo skill for Kodi - kiwistream - 2017-03-27

(2017-03-20, 13:29)Malachor Wrote: Hi All,

I'm following the guide here https://www.howtogeek.com/249336/how-to-control-your-kodi-media-center-with-an-amazon-echo/ but have hit a roadblock. I'm up to the bit where I have to publish the code to AWS but, after running lambda-deploy.exe deploy (from within the kodi-alexa-master folder in an elevated command prompt) I get the following error:

C:\Python27\Scripts\lambda-deploy.exe deploy
2017-03-20 11:18:15:INFO:botocore.vendored.requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): 169.254.169.254
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "c:\python27\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\Python27\Scripts\lambda-deploy.exe\__main__.py", line 9, in <module>
File "c:\python27\lib\site-packages\lambda_deploy\lambda_deploy.py", line 360, in main
name=options.name
File "c:\python27\lib\site-packages\lambda_deploy\lambda_deploy.py", line 75, in __init__
self.client = boto3.client('lambda')
File "c:\python27\lib\site-packages\boto3\__init__.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "c:\python27\lib\site-packages\boto3\session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "c:\python27\lib\site-packages\botocore\session.py", line 836, in create_client
client_config=config, api_version=api_version)
File "c:\python27\lib\site-packages\botocore\client.py", line 70, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "c:\python27\lib\site-packages\botocore\client.py", line 224, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "c:\python27\lib\site-packages\botocore\args.py", line 45, in get_client_args
endpoint_url, is_secure, scoped_config)
File "c:\python27\lib\site-packages\botocore\args.py", line 103, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "c:\python27\lib\site-packages\botocore\client.py", line 297, in resolve
service_name, region_name)
File "c:\python27\lib\site-packages\botocore\regions.py", line 122, in construct_endpoint
partition, service_name, region_name)
File "c:\python27\lib\site-packages\botocore\regions.py", line 135, in _endpoint_for_partition
raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.


What am I missing here?

I can confirm my AWS default location is us-east-1 (North Virginia). I've set up all my environment variables/users/roles etc.

One thing I cannot find clarity on (because the instructions are not clear/detailed enough) is the use of the env.lambda file. Do I leave it with this naming convention, or rename it to lambda.env? I cannot rename it to just .env because windows won't let me; but nowhere does it tell you which is which and how to do it properly.

If anyone could please clarify what I have to do next it would be very much appreciated.

Regards

Mal.

Hi Mal, I have the same upload issue but to get the .env file open lambda.env im notepad++ add in your info then go save as change file type to all types re-name file to .env hit save. Cheers


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-27

(2017-03-27, 00:42)digiltd Wrote: How are you both deploying?

10 minutes to upload is a little slow, and that might be causing this time issue. To see if it is can you try opening up the requirements file and removing all the text in it (making sure you have kept a backup somewhere). Then try the deploy. This will not give you a working skill, the stuff in the requirements needs to be there for the skill to work. But it will lighten the upload package to see if that is the cause of the problem. If it is then we can see if there is an alternative way to deploy for you.

Hey! It seems a problem with pycountry. If I remove pycountry from requirements.txt the deployment is made in about 30 seconds.


RE: Amazon Echo skill for Kodi - kiwistream - 2017-03-27

(2017-03-27, 08:48)wellsecond Wrote:
(2017-03-27, 00:42)digiltd Wrote: How are you both deploying?

10 minutes to upload is a little slow, and that might be causing this time issue. To see if it is can you try opening up the requirements file and removing all the text in it (making sure you have kept a backup somewhere). Then try the deploy. This will not give you a working skill, the stuff in the requirements needs to be there for the skill to work. But it will lighten the upload package to see if that is the cause of the problem. If it is then we can see if there is an alternative way to deploy for you.

Hey! It seems a problem with pycountry. If I remove pycountry from requirements.txt the deployment is made in about 30 seconds.

But does it workHuh


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-27

(2017-03-27, 10:05)kiwistream Wrote:
(2017-03-27, 08:48)wellsecond Wrote:
(2017-03-27, 00:42)digiltd Wrote: How are you both deploying?

10 minutes to upload is a little slow, and that might be causing this time issue. To see if it is can you try opening up the requirements file and removing all the text in it (making sure you have kept a backup somewhere). Then try the deploy. This will not give you a working skill, the stuff in the requirements needs to be there for the skill to work. But it will lighten the upload package to see if that is the cause of the problem. If it is then we can see if there is an alternative way to deploy for you.

Hey! It seems a problem with pycountry. If I remove pycountry from requirements.txt the deployment is made in about 30 seconds.

But does it workHuh

The skill relies on pycountry for something so I chose to not conclude the setup until I can deploy all the packages.


RE: Amazon Echo skill for Kodi - digiltd - 2017-03-27

Thanks for trying that.

pycountry is quite large, it is used to expand a country language in the subtitle and audio stream switching commands (e.g. "spa" to "Spanish").

The large size is something that has been discussed and a lighter solution has been proposed for 2.5.

edit: the lighter alternative has been implemented into the current version


RE: Amazon Echo skill for Kodi - jingai - 2017-03-27

pycountry's been replaced with a lighter alternative which should solve this problem for you guys.


RE: Amazon Echo skill for Kodi - mcl22 - 2017-03-27

hi,

I'm new to alexa but I bought one actually just to control kodi with it. I installed your skill and it works. But I do have a couple of questions/wishes that I partly found in this thread. But most of them weren't really answered. Or I was too blind to find it Smile

Features:
pvr-function: I found a pull request on git. But before I try it myself (as said, I'm really new to this) I'd like to know if one can expect an implementation soon?

music-genre: This is really important to me. I found a request somewhere in this thread. But it seems that it wasn't ever implemented. I'd love to say something like "Alexa, ask kodi to play some rock". How about that?

language-specific:
Well, I'm from Germany. So I'd really love Alexa to speak german "Umlaute" (äöü). I found a post from popy who stated he had done some changes concerning "Umlaute". But I just don't know where to start. It sounds silly when alexa sais "playing die Arzte" instead of "die Ärzte" Smile

Next thing, and I don't know if it's really language specific, but currently it's the most annoying for me: alexa doesn't get the right matches for music artists with "special" names.
For example, there's a band called STS. Alexa understands "S.T.S." and can't find the right artist. In the tags and of course in the kodi db it's "STS".
Second example: 2Pac - also in Germany you say it in english. But alexa either matches some other artist or doesn't respond to it anyway. Same thing for a german band with an english name "H-Blockx".
ASP and SOil are other examples and, pretty funny, the german punk band WIZO. It's spoken like "wieso" and the alexa app states that it understood "w.i.z.o.". That's really wired because I would understand it if she understood "wieso". But she did it right with the "z" and without the "e" but she added the dots between the letters (just like for STS). Does this have to do with the fuzzy matching?
One thing I have to add: if I just ask alexa, not kodi, to play 2pac or sts (on prime music) she instantly recognizes the right artist and starts playing.

Custom slots:
I used your generator to populate the custom slots and except in some cases, like mentioned above, it works pretty well. But what I've learned is that if I just use like 500 movie titles (like mentioned somewhere here) alexa does not really match that often if I ask for a movie not mentioned in the slot.
I used "Terminator" as an example. As long as the movie was in the list, she found it. When I excluded this movie she found "Anatomie" (a film that was still in the list).

Last thing I wonder is how long should it take alexa for the action? I read about a guy somewhere here who stated that it took about 15 - 20 seconds. That's my experience, too. But I think I also read something about only a few seconds. So, just wondering what's normal and what one can do to improve the reaction time.

I really appreciate your work. It's awesome!!!


RE: Amazon Echo skill for Kodi - jingai - 2017-03-27

(2017-03-27, 20:09)mcl22 Wrote: pvr-function: I found a pull request on git. But before I try it myself (as said, I'm really new to this) I'd like to know if one can expect an implementation soon?

This PR will require some reworking/refactoring soon, as we changed a lot under the hood for 2.5 (coming soon).

(2017-03-27, 20:09)mcl22 Wrote: music-genre: This is really important to me. I found a request somewhere in this thread. But it seems that it wasn't ever implemented. I'd love to say something like "Alexa, ask kodi to play some rock". How about that?

It will be implemented eventually, but for now, I personally just make smart playlists for my genres. I actually prefer it this way because I can lump a bunch of genres together into one thing I can actually remember.

(2017-03-27, 20:09)mcl22 Wrote: language-specific:
Well, I'm from Germany. So I'd really love Alexa to speak german "Umlaute" (äöü). I found a post from popy who stated he had done some changes concerning "Umlaute". But I just don't know where to start. It sounds silly when alexa sais "playing die Arzte" instead of "die Ärzte" Smile

German support is coming in 2.5.

(2017-03-27, 20:09)mcl22 Wrote: Next thing, and I don't know if it's really language specific, but currently it's the most annoying for me: alexa doesn't get the right matches for music artists with "special" names.
For example, there's a band called STS. Alexa understands "S.T.S." and can't find the right artist. In the tags and of course in the kodi db it's "STS".
Second example: 2Pac - also in Germany you say it in english. But alexa either matches some other artist or doesn't respond to it anyway. Same thing for a german band with an english name "H-Blockx".
ASP and SOil are other examples and, pretty funny, the german punk band WIZO. It's spoken like "wieso" and the alexa app states that it understood "w.i.z.o.". That's really wired because I would understand it if she understood "wieso". But she did it right with the "z" and without the "e" but she added the dots between the letters (just like for STS). Does this have to do with the fuzzy matching?

Yeah.. this is just kind of how it is for music and voice recognition.

The fuzzy matching tries to catch things like this, but musicians have a tendency to go overboard with their 'creativity'...

(2017-03-27, 20:09)mcl22 Wrote: One thing I have to add: if I just ask alexa, not kodi, to play 2pac or sts (on prime music) she instantly recognizes the right artist and starts playing.

Amazon has a massive database of alternate pronunciations, spellings, etc. We do not.

They (Amazon) have introduced the idea of "built-in" intents and utterances to allow us to utilize the aforementioned database, but it's only available in the US at the moment. When it's made available worldwide, it's definitely something we're going to look into again.

(2017-03-27, 20:09)mcl22 Wrote: Custom slots:
I used your generator to populate the custom slots and except in some cases, like mentioned above, it works pretty well. But what I've learned is that if I just use like 500 movie titles (like mentioned somewhere here) alexa does not really match that often if I ask for a movie not mentioned in the slot.
I used "Terminator" as an example. As long as the movie was in the list, she found it. When I excluded this movie she found "Anatomie" (a film that was still in the list).

I am personally an advocate of including everything in the slots, up to the limit, anyway.

The answer really is: do what works for you.

(2017-03-27, 20:09)mcl22 Wrote: Last thing I wonder is how long should it take alexa for the action? I read about a guy somewhere here who stated that it took about 15 - 20 seconds. That's my experience, too. But I think I also read something about only a few seconds. So, just wondering what's normal and what one can do to improve the reaction time.

When hosting the skill in 'the cloud,' it will take longer. Your Kodi instance has to send lists of files from your library up to the skill, which is mostly dependent on your uplink bandwidth.

I host the skill on my own web server, which is co-located with the Kodi box, so I've never seen a request take > 1 second. Hosting it yourself, however, is obviously a lot more involved.


RE: Amazon Echo skill for Kodi - wellsecond - 2017-03-27

(2017-03-27, 18:45)jingai Wrote: pycountry's been replaced with a lighter alternative which should solve this problem for you guys.

Thank you, now I can deploy properly. Though I have another problem. When testing the skill on service simulator I am getting this error: "The remote endpoint could not be called, or the response it returned was invalid".

It's weird since the URL+port is accessible outside my network.

I got my URL from noip.com