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

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

merged 1 commit into from Jun 30, 2016

Conversation

ghost
Copy link

@ghost ghost commented Jun 30, 2016

Description:
Hand over the collection item, the url or the file to play directly to kodi's file abstraction layer

Related issue (if applicable): fixes #
fixes kodi platform's implementation of media_player.play_media()

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#

Example entry for configuration.yaml (if applicable):

Checklist:

If user exposed functionality or configuration variables are added/changed:

If code communicates with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Local tests with tox run successfully. Your PR cannot be merged unless tests pass
  • Tests have been added to verify that the new code works.

… file abstraction layer handle a collection item, url or file to play
@@ -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 ...

@balloob
Copy link
Member

balloob commented Jun 30, 2016

Looks good! 🐬

@balloob balloob merged commit 952b1a3 into home-assistant:dev Jun 30, 2016
@ghost ghost deleted the kodi_play branch July 1, 2016 01:18
@home-assistant home-assistant locked and limited conversation to collaborators Mar 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant