fix distutils and streamlink
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Roy Olav Purser 2021-12-27 16:57:19 +01:00
parent b79fd2ada8
commit 66a80f5526
Signed by: roypur
GPG Key ID: E14D26A036F21656
2 changed files with 9 additions and 3 deletions

View File

@ -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

View File

@ -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)