Jump to content

Currently Playing Emby ID in Kodi


rhodges
Go to solution Solved by Angelblue05,

Recommended Posts

rhodges

Is there a way to, in a Kodi plugin, determine the Emby ID of the item that is currently playing? (And maybe from a list of items?) I'm working on a plugin in Emby and Kodi and need this information to tie them together.

 

If it is possible, if you could point me to a code same, I can take it from there.

Thanks!

Link to comment
Share on other sites

Angelblue05

Check the player.py file. You'll see how to get the emby id of the currently played file.

 

 

Sent from my iPhone using Tapatalk

Link to comment
Share on other sites

  • 2 weeks later...

Thanks, I'll take a look! I can use that for one thing I'm doing.

 

On a related note, is there a way to get that thru the kodi json-rpc calls? What I'm doing is writing an Amazon Alexa skill that interacts with Emby. At some point, I will want to play an item I have queried from Emby. I will have the EmbyID but I'll need to tell Kodi the Kodi ID to play it.

 

I looked at the sync code and I noticed you have a table where you keep a map of these, but I don't think there is any way in the default json-rpc implementation to do an adhoc table query.

 

Is there a way that I'm missing, or is there a way to extend it so I can issue a json-rpc method to get the kodi id from the emby id?

 

Thanks!

Edited by rhodges
Link to comment
Share on other sites

Angelblue05

Why not communicate with the server directly? Go through the list of sessions, find the Kodi session, you'll get all the currently playing info/users in the session/playback capabilities, etc. Seems simpler, no?

Link to comment
Share on other sites

I thought about doing that, but, what would be the best way to initialize a playback on Kodi? I am indeed moving my logic to interacting with Emby directly, but after I query Emby and have the item I want to play, how would I tell Kodi to play that item? I think there is a json-rpc on Kodi to Player.Open and pass it the file name, which I guess if I'm using direct paths, that would work, but if I'm not, I think that wouldn't work. I was thinking the best way would be to tell Kodi to play the item however it was sync'd in its database, which is why I was hoping there was a way to get the Kodi ID from the EmbyID.

 

I am still working on porting my other logic from a direct kodi query to querying Emby. Once I'm done with that, I'll loop back to how to actually, play the item on Kodi.

Link to comment
Share on other sites

  • Solution
Angelblue05

Use Emby to cast playback to the session like you would using the remote control in the webclient. There's an option to send "Play to command" like playback emby Id.

 

Check the dev wiki: https://github.com/MediaBrowser/Emby/wiki/Remote-control#sending-a-play-command

 

Sent from my iPhone using Tapatalk

Edited by Angelblue05
Link to comment
Share on other sites

Thank you. That sounds like a great idea. It would definitively be nice to be as player agnostic in my code as I can be. I'll give it a go in the next few days.

 

I appreciate the recommendations.

  • Like 1
Link to comment
Share on other sites

  • 3 weeks later...
rhodges

Just a follow up. This worked out pretty good. It is cool that all the session commands are supported. While not very useful, I can tell Alexa to move up and the selected item will move up.

 

Not Kodi specific, and I'll probably post this over on the main forum, but I think there is a potential, with Emby connect, to create and host the skill on the Emby servers, and have a plugin for premiere people to control their Emby without doing the home grown developer skill I'm doing now.

 

I haven't tried it with other clients, but it seems to work well with Kodi and I can see many features that could be suggested in the way of Server controlling the client!

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...