mirror of
https://github.com/home-assistant/core.git
synced 2025-07-12 07:47:08 +00:00
Fix Jellyfin erroring on media items without a source (#67697)
* Fix erroring on media items with a source * code style improvement
This commit is contained in:
parent
a9cc2d2322
commit
2f25d52f69
@ -324,6 +324,9 @@ class JellyfinSource(MediaSource):
|
|||||||
|
|
||||||
def _media_mime_type(media_item: dict[str, Any]) -> str:
|
def _media_mime_type(media_item: dict[str, Any]) -> str:
|
||||||
"""Return the mime type of a media item."""
|
"""Return the mime type of a media item."""
|
||||||
|
if not media_item[ITEM_KEY_MEDIA_SOURCES]:
|
||||||
|
raise BrowseError("Unable to determine mime type for item without media source")
|
||||||
|
|
||||||
media_source = media_item[ITEM_KEY_MEDIA_SOURCES][0]
|
media_source = media_item[ITEM_KEY_MEDIA_SOURCES][0]
|
||||||
path = media_source[MEDIA_SOURCE_KEY_PATH]
|
path = media_source[MEDIA_SOURCE_KEY_PATH]
|
||||||
mime_type, _ = mimetypes.guess_type(path)
|
mime_type, _ = mimetypes.guess_type(path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user