Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kodi platform: following jsonrpc-request version bump (0.3), let kodi… #2398

Merged
merged 1 commit into from Jun 30, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion homeassistant/components/media_player/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,4 @@ def media_seek(self, position):

def play_media(self, media_type, media_id, **kwargs):
"""Send the play_media command to the media player."""
self._server.Player.Open({media_type: media_id}, {})
self._server.Player.Open({"item": {"file": str(media_id)}})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are now hardcoding media_type to be file instead of allowing the user to specify it. Does Kodi have any other media types?

Copy link
Author

@ghost ghost Jun 30, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kodi's files api doesn't need a media type to be specified, just a path, should it be an url ("http://myfavoritewebcast.xyz:9999") or any reachable path actually ("plugin://plugin.video.youtube/?action=play_video&videoid=VWu5FAJrUpQ", "nfs://" and "smb://" included).

One might definitely be in need for the media_type when implementing ATTR_MEDIA_ENQUEUE as kodi seems to offer media-type dedicated queues/playlists but must come with a plan and/or tests first.

Please have a look at http://kodi.wiki/view/JSON-RPC_API/#Player.Open for interesting specs and http://kodi.wiki/view/JSON-RPC_API/Examples for playful reference ... 😊 from the first example, given an instance and curl, I find the result of this cmdline very readable:

curl -s -H "Content-type: application/json" -d '{"jsonrpc":"2.0","method":"JSONRPC.Introspect", "params":{"filter":{ "id": "Player.Open", "type": "method" } }, "id": 1 }' http://kodi.local/jsonrpc | python -mjson.tool | pygmentize -f terminal256 -l javascript

I'm totally amazed, blasted! by both kodi and ha and I'd love to elaborate more on the platform, especially collaboratively ...