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 - fergalom - 2016-12-16

Can anyone help with deciphering whats the issue is with my install on a rpi2?

Code:
pi@raspberrypi ~/kodi-alexa $ sudo python deploy-to-lambda.py
2016-12-16 14:37:03:INFO:botocore.credentials: Found credentials in environment variables.
2016-12-16 14:37:04:INFO:lambda_deploy: Packaging lambda kodi-alexa
2016-12-16 14:37:04: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!
2016-12-16 14:37:04:WARNING:lambda_deploy: Skipping inclusion of of .env file - use LAMBDA_ENV_VARS instead (see documentation for more information)
2016-12-16 14:38:43:INFO:botocore.vendored.requests.packages.urllib3.connectionpool: Starting new HTTPS connection (1): lambda.us-east-1.amazonaws.com
2016-12-16 14:38:44:INFO:lambda_deploy: Adding new kodi-alexa lambda
Traceback (most recent call last):
  File "/usr/local/bin/lambda-deploy", line 9, in <module>
    load_entry_point('lambda-deploy==0.1.2', 'console_scripts', 'lambda-deploy')()
  File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 376, in main
    method()
  File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
    Publish=True
  File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 251, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 513, in _make_api_call
    api_params, operation_model, context=request_context)
  File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 566, in _convert_to_request_dict
    api_params, operation_model)
  File "/usr/local/lib/python2.7/dist-packages/botocore/validate.py", line 272, in serialize_to_request
    operation_model)
  File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 416, in serialize_to_request
    serialized, shape, shape_members)
  File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 461, in _serialize_payload
    partitioned['body_kwargs'], shape)
  File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 527, in _serialize_body_params
    return json.dumps(serialized_body).encode(self.DEFAULT_ENCODING)
MemoryError
Downloading/unpacking requests (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 1))
  Running setup.py egg_info for package requests

    warning: no files found matching 'test_requests.py'
Downloading/unpacking gunicorn (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 2))
  Running setup.py egg_info for package gunicorn

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Downloading/unpacking yaep (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 3))
  Downloading yaep-0.0.6.tar.gz
  Running setup.py egg_info for package yaep

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
Downloading/unpacking pycountry (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 4))
  Running setup.py egg_info for package pycountry

    warning: no previously-included files matching 'src/pycountry' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
Downloading/unpacking pytz (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 5))
  Running setup.py egg_info for package pytz

Downloading/unpacking fuzzywuzzy (from -r /home/pi/kodi-alexa/kodi-alexa/requirements.txt (line 6))
  Downloading fuzzywuzzy-0.14.0.tar.gz
  Running setup.py egg_info for package fuzzywuzzy

Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
  Found existing installation: requests 0.12.1
    Uninstalling requests:
      Successfully uninstalled requests
  Running setup.py install for requests

    warning: no files found matching 'test_requests.py'
  Running setup.py install for gunicorn

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
    SyntaxError: ('invalid syntax', ('/tmp/tmpzRVaV3/lib/python/gunicorn/workers/_gaiohttp.py', 84, 26, '                yield from self.wsgi.close()\n'))

    Installing gunicorn_paster script to /tmp/tmpzRVaV3/bin
    Installing gunicorn script to /tmp/tmpzRVaV3/bin
    Installing gunicorn_django script to /tmp/tmpzRVaV3/bin
  Found existing installation: yaep 0.0.6
    Uninstalling yaep:
      Successfully uninstalled yaep
  Running setup.py install for yaep

    warning: no previously-included files matching '__pycache__' found under directory '*'
    warning: no previously-included files matching '*.py[co]' found under directory '*'
  Running setup.py install for pycountry

    warning: no previously-included files matching 'src/pycountry' found anywhere in distribution
    warning: no previously-included files matching '*.pyc' found anywhere in distribution
  Running setup.py install for pytz

  Running setup.py install for fuzzywuzzy

Successfully installed requests gunicorn yaep pycountry pytz fuzzywuzzy
Cleaning up...

Have pip installed all the requirements and tried both sudo and non sudo on python deploy-to-lambda.py


RE: Amazon Echo skill for Kodi - jingai - 2016-12-18

Foundation is laid for a generic 'play' command. When I've got something that I think is good, I'll merge it into master and solicit some testing.

In the meantime, for those of you still here, if you'd please pull down the current code and update, I'd appreciate testing it as it is. Not much is fundamentally different yet, but it'd be nice to get a good baseline test in. If anyone notices anything wrong, please report back here.

I've started the generic play mods with playlists. You can currently ask it to play/listen to/watch/shuffle any playlists you have. You can say things like:

"Alexa, tell Kodi to watch video playlist My Cool Music Videos"
"Alexa, tell Kodi to shuffle video playlist My Cool Music Videos"
"Alexa, tell Kodi to watch playlist My Cool Music Videos"
"Alexa, tell Kodi to listen to audio playlist My Totally Not Outdated Music"
"Alexa, tell Kodi to shuffle audio playlist My Totally Not Outdated Music"
"Alexa, tell Kodi to listen to playlist My Totally Not Outdated Music"


The first generic commands are with the "shuffle" verb. So you can say these:

"Alexa, tell Kodi to shuffle playlist My Totally Not Outdated Music"
"Alexa, tell Kodi to shuffle playlist My Cool Music Videos"

Note the lack of the media type qualifiers "audio" or "video".


If all goes well, this will extend soon to the "play" commands, so you can say things like:

"Alexa, tell Kodi to play The Big Lebowski"
"Alexa, tell Kodi to play Stone Temple Pilots"
"Alexa, tell Kodi to play Some Random Playlist"

etc etc.. and it'll just figure it out.

As noted before, it will be slower to figure out what you want if you don't specify the media type, but it will at least work.


RE: Amazon Echo skill for Kodi - zaraki7 - 2016-12-18

Hi, everybody first thank's for the job that have been done.

I went through all the step but I got stuck at the step of running the command "python deploy-to-lambda.py"

There is a copy of the error:

osmc@osmc:~/kodi-alexa$ sudo python deploy-to-lambda.py
2016-12-18 15:34:53:INFO:botocore.vendored.requests.packages.urllib3.connectionpool: Starting new HTTP connection (1): 169.254.169.254
Traceback (most recent call last):
File "/usr/local/bin/lambda-deploy", line 11, in <module>
sys.exit(main())
File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 360, in main
name=options.name
File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 75, in __init__
self.client = boto3.client('lambda')
File "/usr/local/lib/python2.7/dist-packages/boto3/__init__.py", line 83, in client
return _get_default_session().client(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/boto3/session.py", line 263, in client
aws_session_token=aws_session_token, config=config)
File "/usr/local/lib/python2.7/dist-packages/botocore/session.py", line 828, in create_client
client_config=config, api_version=api_version)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 69, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 222, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "/usr/local/lib/python2.7/dist-packages/botocore/args.py", line 44, in get_client_args
endpoint_url, is_secure, scoped_config)
File "/usr/local/lib/python2.7/dist-packages/botocore/args.py", line 101, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 295, in resolve
service_name, region_name)
File "/usr/local/lib/python2.7/dist-packages/botocore/regions.py", line 122, in construct_endpoint
partition, service_name, region_name)
File "/usr/local/lib/python2.7/dist-packages/botocore/regions.py", line 135, in _endpoint_for_partition
raise NoRegionError()
botocore.exceptions.NoRegionError: You must specify a region.


Here's an attached picture of my .env.lambda file. Thank's to all for your help.

watch gallery





RE: Amazon Echo skill for Kodi - jingai - 2016-12-18

@zaraki7, you need to copy .env.lambda to .env before editing, not just edit .env.lambda directly.


RE: Amazon Echo skill for Kodi - zaraki7 - 2016-12-18

@ Jingai thank you for your answer. What you mean by "copy .env.lambda to .env" what is .env"?


RE: Amazon Echo skill for Kodi - jingai - 2016-12-18

I mean you make a copy of the file, call it ".env", then edit it.


RE: Amazon Echo skill for Kodi - zaraki7 - 2016-12-18

Ok i'll explain you how i proceed i'm probably doing something wrong. i'm editing .env.lambda on windows then send it to my raspberry pi through ssh.what it change if i change the name of the file? sorry for all those questions i'm completly lost.


RE: Amazon Echo skill for Kodi - jingai - 2016-12-18

Don't edit that file directly.... Make a copy. Call the copy ".env"


RE: Amazon Echo skill for Kodi - zaraki7 - 2016-12-18

@jingai, It's seems to work the way you said. but i can't see any new function appearing in my lambda aws console any idea? thx again.


osmc@osmc:~/kodi-alexa$ sudo python deploy-to-lambda.py
2016-12-18 22:08:10:INFO:botocore.credentials: Found credentials in environment variables.
2016-12-18 22:08:10:INFO:lambda_deploy: Packaging lambda kodi-alexa
2016-12-18 22:08:10: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!
2016-12-18 22:08:10: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/dist-packages/lambda_deploy/lambda_deploy.py", line 376, in main
method()
File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
Publish=True
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 251, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 513, in _make_api_call
api_params, operation_model, context=request_context)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 566, in _convert_to_request_dict
api_params, operation_model)
File "/usr/local/lib/python2.7/dist-packages/botocore/validate.py", line 272, in serialize_to_request
operation_model)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 416, in serialize_to_request
serialized, shape, shape_members)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 461, in _serialize_payload
partitioned['body_kwargs'], shape)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 527, in _serialize_body_params
return json.dumps(serialized_body).encode(self.DEFAULT_ENCODING)
MemoryError
Collecting requests (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 1))
Using cached requests-2.12.4-py2.py3-none-any.whl
Collecting gunicorn (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 2))
Using cached gunicorn-19.6.0-py2.py3-none-any.whl
Collecting yaep (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 3))
Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 4))
Using cached pycountry-16.11.27.1.tar.gz
Collecting pytz (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 5))
Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting fuzzywuzzy (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 6))
Using cached fuzzywuzzy-0.14.0-py2.py3-none-any.whl
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Running setup.py install for pycountry: started
Running setup.py install for pycountry: finished with status 'done'
Successfully installed fuzzywuzzy-0.14.0 gunicorn-19.6.0 pycountry-16.11.27.1 pytz-2016.10 requests-2.12.4 yaep-0.0.6
Starting new HTTPS connection (1): lambda.us-east-1.amazonaws.com
Adding new kodi-alexa lambda

osmc@osmc:~/kodi-alexa$


RE: Amazon Echo skill for Kodi - fergalom - 2016-12-19

(2016-12-18, 23:14)zaraki7 Wrote: @jingai, It's seems to work the way you said. but i can't see any new function appearing in my lambda aws console any idea? thx again.


osmc@osmc:~/kodi-alexa$ sudo python deploy-to-lambda.py
2016-12-18 22:08:10:INFO:botocore.credentials: Found credentials in environment variables.
2016-12-18 22:08:10:INFO:lambda_deploy: Packaging lambda kodi-alexa
2016-12-18 22:08:10: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!
2016-12-18 22:08:10: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/dist-packages/lambda_deploy/lambda_deploy.py", line 376, in main
method()
File "/usr/local/lib/python2.7/dist-packages/lambda_deploy/lambda_deploy.py", line 215, in deploy
Publish=True
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 251, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 513, in _make_api_call
api_params, operation_model, context=request_context)
File "/usr/local/lib/python2.7/dist-packages/botocore/client.py", line 566, in _convert_to_request_dict
api_params, operation_model)
File "/usr/local/lib/python2.7/dist-packages/botocore/validate.py", line 272, in serialize_to_request
operation_model)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 416, in serialize_to_request
serialized, shape, shape_members)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 461, in _serialize_payload
partitioned['body_kwargs'], shape)
File "/usr/local/lib/python2.7/dist-packages/botocore/serialize.py", line 527, in _serialize_body_params
return json.dumps(serialized_body).encode(self.DEFAULT_ENCODING)
MemoryError
Collecting requests (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 1))
Using cached requests-2.12.4-py2.py3-none-any.whl
Collecting gunicorn (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 2))
Using cached gunicorn-19.6.0-py2.py3-none-any.whl
Collecting yaep (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 3))
Using cached yaep-0.0.6-py2-none-any.whl
Collecting pycountry (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 4))
Using cached pycountry-16.11.27.1.tar.gz
Collecting pytz (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 5))
Using cached pytz-2016.10-py2.py3-none-any.whl
Collecting fuzzywuzzy (from -r /home/osmc/kodi-alexa/kodi-alexa/requirements.txt (line 6))
Using cached fuzzywuzzy-0.14.0-py2.py3-none-any.whl
Installing collected packages: requests, gunicorn, yaep, pycountry, pytz, fuzzywuzzy
Running setup.py install for pycountry: started
Running setup.py install for pycountry: finished with status 'done'
Successfully installed fuzzywuzzy-0.14.0 gunicorn-19.6.0 pycountry-16.11.27.1 pytz-2016.10 requests-2.12.4 yaep-0.0.6
Starting new HTTPS connection (1): lambda.us-east-1.amazonaws.com
Adding new kodi-alexa lambda

osmc@osmc:~/kodi-alexa$


@zaraki7 similar to me, you are probably trying to use a Raspberry Pi to deploy to Lambda, I noticed you are getting the same error - "MemoryError"
This is related to the python deploy-to-lambda.py trying to pip install the requirements in requirements.txt.

Pip is trying to read everything into memory before caching it - this can be overcome using "pip install <package_name> --no-cache-dir"
Reference: http://stackoverflow.com/questions/29466663/memory-error-while-using-pip-install-matplotlib

I got this up and running by using another Ubuntu Linux machine I had available.
Works a treat now.


RE: Amazon Echo skill for Kodi - slicck - 2016-12-19

Can someone help me get this to work? This is what I get when I run the command to deploy in the windows command prompt.

D:\kodi-alexa-master>C:\Python27\Scripts\lambda-deploy.exe deploy
2016-12-19 07:32:23: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 828, in create_client
client_config=config, api_version=api_version)
File "c:\python27\lib\site-packages\botocore\client.py", line 69, in create_client
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "c:\python27\lib\site-packages\botocore\client.py", line 222, in _get_client_args
verify, credentials, scoped_config, client_config, endpoint_bridge)
File "c:\python27\lib\site-packages\botocore\args.py", line 44, in get_client_args
endpoint_url, is_secure, scoped_config)
File "c:\python27\lib\site-packages\botocore\args.py", line 101, in compute_client_args
service_name, region_name, endpoint_url, is_secure)
File "c:\python27\lib\site-packages\botocore\client.py", line 295, 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.

This is what's in my .env file

KODI_ADDRESS = *
KODI_PORT = 8080
KODI_USERNAME = *
KODI_PASSWORD = *

SKILL_APPID =
SKILL_TZ = US/Pacific

LAMBDA_ENV_VARS = KODI_ADDRESS,KODI_PORT,KODI_USERNAME,KODI_PASSWORD,SKILL_APPID,SKILL_TZ

AWS_DEFAULT_REGION = us-east-1
LAMBDA_TIMEOUT = 60
LAMBDA_MEMORY_SIZE = 128
LAMBDA_HANDLER = wsgi.lambda_handler

AWS_ACCESS_KEY_ID = *
AWS_SECRET_ACCESS_KEY = *
LAMBDA_ROLE = *


RE: Amazon Echo skill for Kodi - jingai - 2016-12-19

@slicck, I literally just answered this question.. like 3 times.. lol

But anyway.. don't edit .env.lambda directly. Copy it to .env first, then edit it.


RE: Amazon Echo skill for Kodi - DoubleT - 2016-12-19

Thanks for great work here!

Just looking to see if someone has documented an update procedure yet?

Presuming its download new code from GIT
Ensure .env file is not over-written
Deploy to lambda

Any further steps required here? And anything i should look out for when processing an update?


RE: Amazon Echo skill for Kodi - jingai - 2016-12-19

@DoubleT, yes you need to also update your Intents and Utterances from the files "alexa.intents" and "alexa.utterances".


RE: Amazon Echo skill for Kodi - DoubleT - 2016-12-19

I've had to add some new custom slots in - and having issues getting them to save.
I think its down to the order im adding the new ones in and whether intents or utterances have been updated yet or not.

Will see how i get on


This forum uses Lukasz Tkacz MyBB addons.