From c3f06171491af2e98eae8e4de90a7a31a9e01212 Mon Sep 17 00:00:00 2001 From: Pierluigi D'Andrea Date: Wed, 17 Jul 2024 20:22:41 +0200 Subject: [PATCH] Support live tv streams --- jellyfin_mpv_shim/media.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/jellyfin_mpv_shim/media.py b/jellyfin_mpv_shim/media.py index 84c1177..94a5c1a 100644 --- a/jellyfin_mpv_shim/media.py +++ b/jellyfin_mpv_shim/media.py @@ -207,11 +207,21 @@ class Video(object): if self.media_source["SupportsDirectStream"]: self.is_transcode = False log.debug("Using direct url.") - return "%s/Videos/%s/stream?static=true&MediaSourceId=%s&api_key=%s" % ( + query_params = { + "static": "true", + "MediaSourceId": self.media_source["Id"], + "api_key": self.client.config.data["auth.token"], + } + + if "LiveStreamId" in self.media_source: + query_params["LiveStreamId"] = self.media_source["LiveStreamId"] + + query = urllib.parse.urlencode(query_params) + + return "%s/Videos/%s/stream?%s" % ( self.client.config.data["auth.server"], self.item_id, - self.media_source["Id"], - self.client.config.data["auth.token"], + query, ) elif self.media_source["SupportsTranscoding"]: log.debug("Using transcode url.")