• 1
  • 120
  • 121
  • 122(current)
  • 123
  • 124
  • 176
Release Kanzi: Amazon Alexa skill for Kodi
I get "The remote endpoint could not be called, or the response it returned was invalid." while testing it. There is nothing in the Apache log (not even with LogLevel info)...any idea how to proceed?

P.S. I'm self hosting, of course.
Reply
Alexa cannot connect to your web server.

Is port 443 not open to the outside world? Invalid SSL cert? Apache cfg blocking Amazon? Firewall?
Reply
Actually, it does connect...I changed something and now I get this error: There was an error calling the remote endpoint, which returned HTTP 301 : MOVED PERMANENTLY
Reply
OK, I changed the URL from "https://myhost.mydomain.com/kodi" to "https://myhost.mydomain.com" and now I seem to be getting somewhere... this is the Apache log

[Wed Aug 23 21:17:15.352668 2017] [wsgi:info] [pid 14341] [client 72.21.217.140:7816] mod_wsgi (pid=14341, process='', application='127.0.1.1|'): Loading WSGI script '/var/www/wsgi/kodi-alexa/alexa.wsgi'.
[Wed Aug 23 21:17:17.033039 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] Shuffling music videos
[Wed Aug 23 21:17:17.033304 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] Sending request to http://127.0.0.1:8080/jsonrpc from device None
[Wed Aug 23 21:17:17.173051 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] [2017-08-23 21:17:17,171] ERROR in app: Exception on / [POST]
[Wed Aug 23 21:17:17.173077 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] Traceback (most recent call last):
[Wed Aug 23 21:17:17.173083 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
[Wed Aug 23 21:17:17.173087 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] response = self.full_dispatch_request()
[Wed Aug 23 21:17:17.173092 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
[Wed Aug 23 21:17:17.173097 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] rv = self.handle_user_exception(e)
[Wed Aug 23 21:17:17.173102 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
[Wed Aug 23 21:17:17.173107 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] reraise(exc_type, exc_value, tb)
[Wed Aug 23 21:17:17.173124 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
[Wed Aug 23 21:17:17.173130 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] rv = self.dispatch_request()
[Wed Aug 23 21:17:17.173133 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
[Wed Aug 23 21:17:17.173138 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] return self.view_functions[rule.endpoint](**req.view_args)
[Wed Aug 23 21:17:17.173142 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/venv/local/lib/python2.7/site-packages/flask_ask/core.py", line 670, in _flask_view_func
[Wed Aug 23 21:17:17.173146 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] result = self._map_intent_to_view_func(self.request.intent)()
[Wed Aug 23 21:17:17.173149 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] File "/var/www/wsgi/kodi-alexa/alexa.py", line 2327, in alexa_shuffle_music_videos
[Wed Aug 23 21:17:17.173153 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] elif Genre:
[Wed Aug 23 21:17:17.173157 2017] [wsgi:error] [pid 14341] [client 72.21.217.140:7816] NameError: global name 'Genre' is not defined
Reply
@MoshePupkin, that's just a bug in the error handling for that Intent. I've fixed it upstream.
Reply
I notice that Amazon now has a built-in slot for:

AMAZON.MusicAlbum
AMAZON.MusicGroup
AMAZON.Musician
AMAZON.MusicPlaylist
AMAZON.MusicRecording

Have these been tried rather than the custom slots from the user's library? It might take a code change to "merge" Musicians and MusicGroups. I am thinking these might work better for people with a mid-size library, say 60 artists.
Reply
It is a code change (more than you'd think/it should be, actually). We want to use the built-ins, but they're not supported in UK/DE.

There's an Issue on Github discussing it.

edit: added link to the issue -- sorry, was on mobile and didn't feel like linking there Smile
Reply
FWIW, you can actually fill the slots with media that you don't even have if you find you don't have enough for her to pass literal strings through. I've tested this here with slots generated from my library, but pointing at someone else's Kodi installation.

Bear in mind though that the slots should still contain items that at least seem like media titles and are fairly evenly distributed in (word) length. The Slot generator does this, so one easy way to add entries if you need them would be to find a friend that would let you connect to their Kodi just to generate additional slot items. Then just merge the lists.

As a stop-gap until library built-ins are released in UK and DE, we did consider shipping the skill with curated/pre-generated slot items, but this has its own issues.

For one, we'd need different sets for different regions.

For another, it's hard to determine what language to use. For instance, there's nothing written that a German user has a library full of mostly German media. It could be mostly English, for instance.

In the end, we chose to wait for Amazon to release in all supported regions. Yes, it's possible to use them now for US, but the change to the code is significant enough it would likely mean we would have to fork it and maintain both.
Reply
What would it mean from the user perspective (to use built-in slots)? That I'd be able to say "Alexa play xyz" instead of "Alexa tell Kodi to play xyz"?
Reply
No, they are really just pre-built custom slots, so we could get rid of the Slot generators.

They would be of most use in the scenario that bill-orange mentioned, where you don't have enough samples to coax Alexa into passing literal strings.
Reply
If you're really curious, a little history might help clear up what we're talking about.

When we originally tackled the problem of matching what you said to what's in your library, we thought to utilize just custom slots, which are basically variables that will take the value of a portion of what you said. To do this, we created the slot generators to ask Kodi for all of its library titles, and we push them into the various custom slots you still see.

The idea was to have Alexa match against these and spit out the right answer; however, we found several problems with this:

  1. For some odd names, such as 2pac, Hawaii-50, etc, it wouldn't match,
  2. It would require the use to keep the slots up-to-date,
  3. The skill became large enough that it was no longer possible to store the entire library contents in the slots.

To solve these issues, we now use fuzzy matching in the skill to match what was heard with what's available in the media library. This is very accurate particularly when we know the media type, like if you say, "ask Kodi to play the movie Ghostbusters" as opposed to "ask Kodi to play Ghostbusters." We do support the latter -- and it works very well -- but there obviously can be collisions if the terms are fairly generic.

This all works fine provided there are enough samples in the slots. Alexa's propensity to send us the literal string the user said (that is, an unmatched string, transmitted literally as it was transcribed) goes up as the number of samples in the slots increases. Conversely, it goes down as the number of samples decreases. To satisfy all of the above listed problems, we depend on her to send the literal strings.

For users with large libraries and a good distribution of samples (varying string/word lengths and titles), everything works as expected; however, if a user's library is deficient in an area (such as bill-orange's 60 music artists), there is the possibility that she might not send the literal string to the skill, so we would have nothing to fuzzy match on.

As an example, if bill-orange had '2pac' in his MUSICARTISTS slot, but MUSICARTISTS only contains 60 items, the likelihood that she'll pass through a transcribed string like "two pack" is slim. And we already know she won't match directly on '2pac,' so we require the literal to even attempt to match further.

There are a number of possible solutions to this dilemma.

We could massage the data in the slot generators to account for all possible oddities, but obviously achieving 100% coverage here is not practical. We do currently filter out some things such as invalid characters, but that's the extent we'd like to go to at this stage.

We could try variants of certain substrings in the skill, such as translating number digits to number words and vice versa. We actually do do this currently. It's helpful, but doesn't cover all of the issues laid out above.

We could ship the skill with known-to-work-well slot samples. Since we fuzzy match in the skill code, it actually doesn't really matter what's in the slot samples, provided they're well-distributed to cover the types of things the user might say. This boils down to a providing a evenly-distributed variety of words, word lengths, and character lengths. The problems with this approach are as I described in an above post regarding language choice. As an aside, you may have noticed that the slot generators we have distribute the strings by word-length -- this is why that is.

Lastly (as far as I know), we could utilize Amazon's Library Built-ins. These are essentially custom slots that are populated with Amazon's own media catalog, which guarantees it to be large enough to spit out the literal string in the end if no exact match could be found. Further, it could increase the number of 'simple' (string equality) matches because Amazon could (and probably does) store variations of the titles; even if not, it's highly likely they have available to them other information to aid Alexa in making the match.

Library Built-ins are more of a code change than I think they should be, but it's something we would definitely utilize if Amazon would get off their asses and release them in the UK and Germany. So far, it's been 8 months since release in the US, and Amazon has given us no indication of when they'll be available in other regions.

Library Built-ins would both simplify the skill setup and improve the matching for users with smaller libraries, making it a win-win, but because the code change is drastic enough, it'd likely mean maintaining a fork until Amazon releases in UK and DE. This is possible, but since this is a hobby project for us, it's not ideal.

TL;DR for those that just want an improved experience now:

In the interim, users can benefit from padding low-populated-slots with samples that aren't in their libraries. An easy way to do this would be to get a friend with Kodi to allow you to point the slot generator at their library so you can combine lists. If that's not possible, you can simply enter in more samples manually. The samples can be anything, but variety is helpful and the lack of it can be detrimental, so to make it simple I'd suggest you look up actual media titles.

There is no real magic number for the slots -- it depends more on variation than anything. We currently default to 100 items in the slot generators and this seems to work out well in the end, but you can pad them as far as the builder will allow if you like. I wouldn't get too close to the ceiling though, because if we add more Intents and/or Utterances that make the skill larger, you'll be constantly trimming your slots to get it to save.
Reply
(2017-08-26, 09:09)MoshePupkin Wrote: That I'd be able to say "Alexa play xyz" instead of "Alexa tell Kodi to play xyz"?

For this, we would have to re-write the skill using Amazon's Video Skill API. This is a complete re-write (minus the Kodi-Voice library, barring some potential changes there). Basically, it's a new skill, not a modification or even a fork of the existing skill we have.

Further, Amazon requires that Video Skills are hosted with them, something I don't personally care for.
Reply
Hi

I am trying to update and have a couple of questions;

Do I use the original master files I downloaded or re-download from GitHub and create a new venv?

When I try to run 'git pull origin master' I get; 'git' is not recognized as an internal or external command, operable program or batch file.

I'm running everything from the (venv).

Thanks for all your help.
Reply
@NoFixIT, you should be able to do just as UPGRADING.md describes. Enter the directory containing the sources and activate your virtual env, then:

Code:
git pull origin master
pip install -r requirements.txt
zappa update dev

If it can't find git, you've somehow uninstalled it or it's not in your path. Try reinstalling it.

Don't forget to update the Intents, Utterances, and to rebuild your slots as well.
Reply
Hi Jingai

Yes I must have uninstalled it, I have reinstalled Git but it is now giving me this error when I run the git pull origin master;

fatal: Not a git repository (or any of the parent directories): .git

Thanks
Reply
  • 1
  • 120
  • 121
  • 122(current)
  • 123
  • 124
  • 176

Logout Mark Read Team Forum Stats Members Help
Kanzi: Amazon Alexa skill for Kodi15