From 66a80f5526e9528314c43723bd97dfb6d0f47cc4 Mon Sep 17 00:00:00 2001 From: Roy Olav Purser Date: Mon, 27 Dec 2021 16:57:19 +0100 Subject: [PATCH] fix distutils and streamlink --- backend/stream.py | 5 +++-- backend/stream_providers.py | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/stream.py b/backend/stream.py index e757c7a..1dd8bde 100755 --- a/backend/stream.py +++ b/backend/stream.py @@ -5,7 +5,6 @@ import os import re import base64 import logging -import distutils.util import asyncio import tornado.web import tornado.routing @@ -161,7 +160,8 @@ class UpstreamHandler(): raw_str = handler.get_query_argument("raw", None) if isinstance(raw_str, str): try: - self.raw = bool(distutils.util.strtobool(raw_str)) + true_values = ['y', 'yes', 't', 'true', 'on', '1'] + self.raw = (raw_str.lower() in true_values) except ValueError as e: logger.info(e) if self.provider in providers.keys(): @@ -274,6 +274,7 @@ class MainHandler(tornado.web.RequestHandler): if video_info is not None: script = template_script.generate(info=json.dumps(video_info)) b64 = str(base64.b64encode(script), "ascii") + data = {} script_file = f'data:text/javascript;charset=utf-8;base64,{b64}' data["script"] = script_file data["videojs_version"] = videojs_version diff --git a/backend/stream_providers.py b/backend/stream_providers.py index cb6a22d..12e19c6 100755 --- a/backend/stream_providers.py +++ b/backend/stream_providers.py @@ -193,7 +193,12 @@ class StreamlinkRunner(StreamProvider): else: session = streamlink_sessions.get(self.proxy) media = session.resolve_url(self.upstream) - streams = media.streams() + streams = None + if isinstance(media, tuple): + plugin = media[0](media[1]) + streams = plugin.streams() + else: + streams = media.streams() if streams is not None: for key in reversed(streams): stream = streams.get(key)