core icon indicating copy to clipboard operation
core copied to clipboard

Jellyfin Integration : Reopen Issue Request #94801 - KeyError: 'RunTimeTicks' when streaming Live TV from another device

Open timkeefer1 opened this issue 1 year ago • 2 comments

The problem

I have another device on my network (Roku) streaming live TV from Jellyfin. The streaming is from the Roku Jellyfin channel, using a HDHomeRun. None of the playing was initiated from HA, and the Jellyfin instance is even running on another server (docker container on other physical hardware). This error begins when my live TV streaming is initiated and is logged approximately every 10 seconds.

What version of Home Assistant Core has the issue?

core-2024.1.1

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant Container

Integration causing the issue

Jellyfin

Link to integration documentation on our website

https://www.home-assistant.io/integrations/jellyfin/

Diagnostics information

config_entry-jellyfin-48b9887d485c30a7496e3473a69235bf.json.txt

Example YAML snippet

No response

Anything in the logs that might be useful for us?

`
KeyError: 'RunTimeTicks'
2024-01-12 06:11:47.078 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 243, in _handle_refresh_interval
    await self._async_refresh(log_failures=True, scheduled=True)
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 399, in _async_refresh
    self.async_update_listeners()
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 182, in async_update_listeners
    update_callback()
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/media_player.py", line 116, in _handle_coordinator_update
    self._update_from_session_data()
  File "/usr/src/homeassistant/homeassistant/components/jellyfin/media_player.py", line 152, in _update_from_session_data
    media_duration = int(self.now_playing["RunTimeTicks"] / 10000000)
                         ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
`

Additional information

No response

timkeefer1 avatar Jan 12 '24 13:01 timkeefer1

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)

home-assistant[bot] avatar Jan 12 '24 13:01 home-assistant[bot]

Hi @timkeefer1,

Thanks for reporting this. I did not write the MediaPlayer part of this integration, but I think I see what the problem is. Jellyfin probably does not report a duration for live media. The API also defines it as optional, so I think it is safe to say we should check whether Jellyfin reports any duration and otherwise ignore it.

I have no way to verify the fix though as I do not use live tv, but I'll get a PR opened to get this fixed.

j-stienstra avatar Jan 14 '24 18:01 j-stienstra