Skip to content

Added media browsing request#50

Draft
albaintor wants to merge 3 commits intounfoldedcircle:mainfrom
albaintor:media_browsing
Draft

Added media browsing request#50
albaintor wants to merge 3 commits intounfoldedcircle:mainfrom
albaintor:media_browsing

Conversation

@albaintor
Copy link

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_media request is handled at this time. I will add support for play_media and then :

  • clear_playlist
  • browse_media
  • search_media
  • search_media_classes

@albaintor albaintor marked this pull request as draft March 4, 2026 11:47
@zehnm
Copy link
Contributor

zehnm commented Mar 4, 2026

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!
Also the reference implementation to verify the API is not yet finished.

@albaintor
Copy link
Author

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.

Copy link
Contributor

@zehnm zehnm left a comment

Choose a reason for hiding this comment

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

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 :-)

Comment on lines +151 to +187
# 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
Copy link
Contributor

Choose a reason for hiding this comment

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

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:

@zehnm
Copy link
Contributor

zehnm commented Mar 18, 2026

I can offer to do the refactoring after the next release is out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants