Fix Jellyfin erroring on media items without a source (#67697)
* Fix erroring on media items with a source * code style improvementpull/67812/head
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…
Reference in New Issue