Conversation
|
Please wait with enhancing the integration library: the Integration-API specification for media browsing and searching is not yet finalized in the core-api repository and might still change! |
|
Ok sorry, I was anticipating a little bit too much : I just want to have a working solution, then it won't be a problem to bring some changes. I can keep going with my simulator and raise questions on discord channel. |
zehnm
left a comment
There was a problem hiding this comment.
The Python integration library should be similar as the Node.js library.
Instead of a generic params: dict[str, Any] browse parameter, it is much more convenient for integration developers to know what they are getting, and what to send back.
Please check https://github.com/unfoldedcircle/integration-node-library/blob/main/lib/entities/media_player.ts for all definitions.
They can easily be converted into Python classes with your AI agent of choice, including Python docs :-)
| # pylint: disable=W0613 | ||
| async def browse_media( | ||
| self, | ||
| params: dict[str, Any], | ||
| *, | ||
| websocket: Any, | ||
| ) -> dict[str, Any] | StatusCodes: | ||
| """ | ||
| Execute entity browsing request. | ||
|
|
||
| Returns NOT_IMPLEMENTED if no handler is installed. | ||
|
|
||
| :param params: browsing parameters | ||
| :param websocket: optional websocket connection. Allows for directed event | ||
| callbacks instead of broadcasts. | ||
| :return: browsing response or status code if any error occurs | ||
| """ | ||
| return StatusCodes.NOT_IMPLEMENTED | ||
|
|
||
| # pylint: disable=W0613 | ||
| async def search_media( | ||
| self, | ||
| params: dict[str, Any], | ||
| *, | ||
| websocket: Any, | ||
| ) -> dict[str, Any] | StatusCodes: | ||
| """ | ||
| Execute media search request. | ||
|
|
||
| Returns NOT_IMPLEMENTED if no handler is installed. | ||
|
|
||
| :param params: search parameters | ||
| :param websocket: optional websocket connection. Allows for directed event | ||
| callbacks instead of broadcasts. | ||
| :return: search response or status code if any error occurs | ||
| """ | ||
| return StatusCodes.NOT_IMPLEMENTED |
There was a problem hiding this comment.
browse_media and search_media need to be in the MediaPlayer class.
The IntegrationAPI needs to check if the provided entity ID relates to a media player entity and return "404 not found" if not found or mismatch.
Functionality should be similar to the Node.js implementation:
|
I can offer to do the refactoring after the next release is out. |
Hi Markus @zehnm ,
To begin with the new media browsing in Kodi integration, I modified the Python integration library with new request/messages.
For now I simulate requests and it seems to work correctly.
Only
browse_mediarequest is handled at this time. I will add support forplay_mediaand then :