Jump to content

Emby with Amazon Alexa


chef

Recommended Posts

nxenos83

Something just occurred to me. Maybe Luke could make sense of it.

 

You know that page for emby connect where you can "add a server"

 

What if people shared their server with someone who hosted a domain.

 

Then the domain could sit as an Internet access point for anyone who wanted to login to their server through the domain.

 

Then there could theoroetically only have to be one domain with an SSL with a list of severs attached to it.

 

Then all we would need is the plugin.

 

Does that make sense.

 

I think we are thinking the same thing here.  Endpoint in the skill setup would point to emby connect on port 443.  Amazon offers a way to link the skill to an account; in the setup you provide a url for the sign-in page and send back an access token. Every request json will contain the access token along with an unique amazon id. The connect server would then need to validate the access token to find the user, and then forward on to the user's server.

Link to comment
Share on other sites

I think we are thinking the same thing here. Endpoint in the skill setup would point to emby connect on port 443. Amazon offers a way to link the skill to an account; in the setup you provide a url for the sign-in page and send back an access token. Every request json will contain the access token along with an unique amazon id. The connect server would then need to validate the access token to find the user, and then forward on to the user's server.

Like the unique ID of the server, or emby user ID.

Link to comment
Share on other sites

nxenos83

I'm not sure how emby connect server works with routing but here's my assumption:

 

After successfully authenticating, an access token is granted for the user id. The user id and access token are stored in browser cache or cookie.

After selecting a server, record for the access token is updated with the serverId.

 

With subsequent requests, DNS is resolved by using the userid + accesstoken from browser cache is to lookup the IP of the user's emby server based upon the serverid.. If userid + accesstoken are not found, dns resolves to the emby connect loggin server.

 

If all of this is correct, we need to create a new endpoint  for DNS resolution. Instead of using userid + accesstoken in a browser's cache to find the server's IP, we need to parse the alexa response to extract the access token, match the access token to a server id and IP and resolve to that ip.

 

@@Luke, can you clarify any of this?

Link to comment
Share on other sites

nxenos83

 

Here is what I got. 

 

Awesome!!! Now the rest will come easy! 

 

We should work out all of the functions that should be made available and try to use a single plugin for google home integration.

Edited by nxenos83
Link to comment
Share on other sites

Awesome!!! Now the rest will come easy!

 

We should work out all of the functions that should be made available and try to use a single plugin for google home integration.

We'll also have to create a list of general intents that can be used, since people will have to create their own.

Could be a text file DL that is cut and paste.

 

I wish there was an easier way to request new movie names without having to compare run times of the media item.

 

In the video above the last name mentioned is the recent Walkig Dead episode. It gets mentioned because it is over the 46 minutes run time comparison used to determine movies from tv episodes.

Link to comment
Share on other sites

nxenos83

I wish there was an easier way to request new movie names without having to compare run times of the media item.

 

In the video above the last name mentioned is the recent Walkig Dead episode. It gets mentioned because it is over the 46 minutes run time comparison used to determine movies from tv episodes.

 

Try using this. I haven't verified that it'll work, but it seems correct:

var results = _libraryManager.GetItemsResult(new InternalItemsQuery
            {
                User = user.id,
                IncludeItemTypes = new string[]{ "Movie" },
                MinDateCreated = DateTime.Now.AddDays(-15)
            }); 
Edited by nxenos83
  • Like 1
Link to comment
Share on other sites

Nevermind I see how to get ItemTypes now... 

 

Thanks I figured it out just as you posted.

Edited by chef
Link to comment
Share on other sites

Okay so I got something cool.

 

 I look at user favorites/recommendation to determine how Alexa is going to speak.

 

It decides from a dictionary<boolean, string>  of common phrases, how to describe the new movies (or media...whatever...)  to the user.  

 

Bool - user would like it or not

string - common phrase to try and make the bot sound more human.

 

kind of cool... not for everyone I'm sure. But, coding was getting tedious so I made up something fun.

I have a feeling the dictionary could get rather large.

Edited by chef
Link to comment
Share on other sites

nxenos83

Nice! Have you guys managed playback control, yet?

 As long as emby device is running (appears in the Active Devices section), I've been able to send play state changes (play, pause, skip, etc), and was able to send "Watch {Movies} on Xbox" and "Listen to Pink Floyd Instant Mix on Receiver".

 

Working on how to perform a fuzzy search instead of a direct comparison.

Link to comment
Share on other sites

Guest asrequested

As long as emby device is running (appears in the Active Devices section), I've been able to send play state changes (play, pause, skip, etc), and was able to send "Watch {Movies} on Xbox" and "Listen to Pink Floyd Instant Mix on Receiver".

 

Working on how to perform a fuzzy search instead of a direct comparison.

Is that only on Google home?

 

And what happens if there are multiple active devices?

Edited by Doofus
Link to comment
Share on other sites

nxenos83

Is that only on Google home?

 

Got that on both.  I'm hoping that chef and I can create a single emby plugin that can handle both types of request the same.

 

Defining Google api.Ai conversation and Amazon Alexa skills are very similar (there are some differences, but the in the end in both you define intents based upon sample utterances that include slots for the parameters. Only major difference that I can tell is that way the two handle re-prompting and maintaining conversation context.

  • Like 3
Link to comment
Share on other sites

nxenos83

Can we collectively come up with a list of commands that are expected from an Alexa/Google Home integration. Some ideas:

 

INFO:

Next Up Episodes

New Movies

New Albums

What is being played / what movie is this/what song is/ etc

Upcoming tv shows

 

SERVER ADMIN ACTIONS:

Restart Sever

Scan Library

 

PLAY MEDIA

Play Movie [on Device]

Play TV Show [on Device]

Play Music Artist [on Device]

Play Next Up [on device]

Play Music Artist Instant Mix [on device]

Play Album [on device]

 

PLAY CONTROL

Play

Pause

Next track

Previous track

Edited by nxenos83
Link to comment
Share on other sites

Guest asrequested

What about play TV show season x episode x? Or play episode by name? For example, "Alexa, play episode trouble with tribbles"

Link to comment
Share on other sites

Can we collectively come up with a list of commands that are expected from an Alexa/Google Home integration. Some ideas:

 

INFO:

Next Up Episodes

New Movies

New Albums

What is being played / what movie is this/what song is/ etc

Upcoming tv shows

 

SERVER ADMIN ACTIONS:

Restart Sever

Scan Library

 

PLAY MEDIA

Play Movie [on Device]

Play TV Show [on Device]

Play Music Artist [on Device]

Play Next Up [on device]

Play Music Artist Instant Mix [on device]

Play Album [on device]

 

PLAY CONTROL

Play

Pause

Next track

Previous track

How about logging on a specific user?

Link to comment
Share on other sites

What about play TV show season x episode x? Or play episode by name? For example, "Alexa, play episode trouble with tribbles"

Oh that's a Star Trek nod! Nice!

 

I wonder how to create slots programagically on amazons severs with all the episode names??

Edited by chef
Link to comment
Share on other sites

So if you slot in for each of your emby ready devices it seems possible to send commands to any of them (playback anyway... As mentioned above)

 

I'm about to try playto commands and see how the code looks for that.

 

I can't seem to see how to slot in titles for movies without creating a rather large intent though.

Link to comment
Share on other sites

Overseer

What about play TV show season x episode x? Or play episode by name? For example, "Alexa, play episode trouble with tribbles"

 

Or also, 'Play latest episode of {show}' or 'Play unwatched episode(s) of {show}'.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...