fwestenberg / reolink_dev

Home Assistant Reolink addon
MIT License
553 stars 101 forks source link

Media browser doesn't work with NVR clips #548

Open xcomputerman opened 1 year ago

xcomputerman commented 1 year ago

When I try to browse NVR clips using the media browser, it displays "Unknown error" once I open a folder.

In the system log, this is what I see:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/reolink_dev/media_source.py:303
Integration: Home Assistant WebSocket API ([documentation](https://www.home-assistant.io/integrations/websocket_api), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+websocket_api%22))
First occurred: 1:16:37 PM (2 occurrences)
Last logged: 1:16:47 PM

[281472334212272] Error handling message: Unknown error (unknown_error)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 27, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 161, in websocket_browse_media
    media = await async_browse_media(hass, msg.get("media_content_id", ""))
  File "/usr/src/homeassistant/homeassistant/components/media_source/__init__.py", line 112, in async_browse_media
    item = await _get_media_item(hass, media_content_id, None).async_browse()
  File "/usr/src/homeassistant/homeassistant/components/media_source/models.py", line 86, in async_browse
    return await self.async_media_source().async_browse_media(self)
  File "/config/custom_components/reolink_dev/media_source.py", line 161, in async_browse_media
    return await self._async_browse_media(source, camera_id, event_id, base)
  File "/config/custom_components/reolink_dev/media_source.py", line 336, in _async_browse_media
    media.children = await create_vod_children()
  File "/config/custom_components/reolink_dev/media_source.py", line 303, in create_vod_children
    evt_id = f"{camera_id}/{quote_plus(file['name'])}"
KeyError: 'name'

Cameras are RLC-820A 4K cameras and DVR model is RLN8-410.