home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
71.06k stars 29.72k forks source link

Unable to browse media with jellyfin media player #119025

Open EuleMitKeule opened 3 months ago

EuleMitKeule commented 3 months ago

The problem

When trying to browse media on a Jellyfin media player entity, a popup with the text "Unknown error" is displayed. An exception is logged which I provided below.

What version of Home Assistant Core has the issue?

core-2024.6

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

Integration causing the issue

jellyfin

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

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_player/__init__.py", line 1308, in websocket_browse_media
    payload = await player.async_browse_media(media_content_type, media_content_id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/media_player.py", line 300, in async_browse_media
    return await build_root_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/browse_media.py", line 72, in build_root_response
    if folder["CollectionType"] in SUPPORTED_COLLECTION_TYPES
       ~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'CollectionType'

Additional information

No response

home-assistant[bot] commented 3 months ago

Hey there @j-stienstra, @ctalkington, mind taking a look at this issue as it has been labeled with an integration (jellyfin) you are listed as a code owner for? Thanks!

Code owner commands Code owners of `jellyfin` can trigger bot actions by commenting: - `@home-assistant close` Closes the issue. - `@home-assistant rename Awesome new title` Renames the issue. - `@home-assistant reopen` Reopen the issue. - `@home-assistant unassign jellyfin` Removes the current integration label and assignees on the issue, add the integration domain after the command. - `@home-assistant add-label needs-more-information` Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue. - `@home-assistant remove-label needs-more-information` Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


jellyfin documentation jellyfin source (message by IssueLinks)

FibreFoX commented 3 months ago

@EuleMitKeule Which version of Jellyfin are you using?

EuleMitKeule commented 3 months ago

@FibreFoX I am using 10.9.5 which should be (one of) the latest versions.

FibreFoX commented 3 months ago

Did you upgrade from a 10.8.x version? Right now I see multiple issues with the new Jellyfin server version, probably related to the used old python library (which is newer on GitHub, but never released AFAIK)

EuleMitKeule commented 3 months ago

I am not sure which version I had running before. Do you know a way to find that out?

j-stienstra commented 2 months ago

Hi @EuleMitKeule, sorry to hear the integration is not working for you. I just checked in my own deployment and the browse functionality is working for me when connected to a 10.9.6 version server. I don't think that minor version will make the difference, so I guess something else is at play.

Can you enable debug logging by adding the following to your configuration and reproduce?

logger:
  default: info
  logs:
    homeassistant.components.jellyfin: debug
    Jellyfin: debug
FibreFoX commented 2 months ago

@j-stienstra Don't get distracted this begin listed as a minor version ;) semver is hard sometimes. Plus: it is not only the server version, but the used python library too.

j-stienstra commented 2 months ago

Hi @FibreFoX, yes the used python library could use an update although I am not sure that this actually the issue. I have requested an updated version of the API be posted on pypi. Let's see how that progresses.

nchaney commented 1 week ago

Discovered I am also having this issue; Just started using the Integration, so can't speak to which version it broke on. Jellyfin Version 10.9.10 HA Core 2024.4.3

Debug log: Logger: homeassistant.components.websocket_api.http.connection Source: components/jellyfin/browse_media.py:72 integration: Home Assistant WebSocket API (documentation, issues) First occurred: 12:10:24 AM (1 occurrences) Last logged: 12:10:24 AM

[139982537153728] Error handling message: Unknown error (unknown_error) Nathan Chaney from 192.168.1.21 (Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0) 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_player/init.py", line 1312, in websocket_browse_media payload = await player.async_browse_media(media_content_type, media_content_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/jellyfin/media_player.py", line 300, in async_browse_media return await build_root_response( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/components/jellyfin/browse_media.py", line 72, in build_root_response if folder["CollectionType"] in SUPPORTED_COLLECTION_TYPES


KeyError: 'CollectionType'
amylizzle commented 4 days ago

Also having this issue. Jellyfin: 10.9.8 HA: 2024.8.3

Debug log identical to others:

2024-09-03 17:42:32.762 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140502267066496] Error handling message: Unknown error (unknown_error) Amy from 192.168.1.34 (Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/decorators.py", line 28, in _handle_async_response
    await func(hass, connection, msg)
  File "/usr/src/homeassistant/homeassistant/components/media_player/__init__.py", line 1304, in websocket_browse_media
    payload = await player.async_browse_media(media_content_type, media_content_id)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/media_player.py", line 299, in async_browse_media
    return await build_root_response(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/browse_media.py", line 72, in build_root_response
    if folder["CollectionType"] in SUPPORTED_COLLECTION_TYPES
       ~~~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'CollectionType'
2024-09-03 17:42:53.965 DEBUG (MainThread) [homeassistant.components.jellyfin] Finished fetching jellyfin data in 0.012 seconds (success: True)

The issue occurs on all HA clients I've tried. Jellyfin otherwise works fine.