add provider test
This commit is contained in:
parent
db96538980
commit
7531786cfb
12
stream.py
12
stream.py
@ -113,10 +113,13 @@ class UpstreamHandler():
|
|||||||
async def setup(self, handler):
|
async def setup(self, handler):
|
||||||
self.provider = handler.get_query_argument("provider", None)
|
self.provider = handler.get_query_argument("provider", None)
|
||||||
render_str = handler.get_query_argument("render", "false")
|
render_str = handler.get_query_argument("render", "false")
|
||||||
if render_str.lower() == "true":
|
self.render = False
|
||||||
self.render = True
|
|
||||||
self.stream = False
|
self.stream = False
|
||||||
if self.provider in providers.keys():
|
if self.provider in providers.keys():
|
||||||
|
if render_str.lower() == "true":
|
||||||
|
self.render = True
|
||||||
|
else:
|
||||||
|
self.stream = True
|
||||||
path = handler.request.path
|
path = handler.request.path
|
||||||
if self.provider == "youtube":
|
if self.provider == "youtube":
|
||||||
path = path.strip("/")
|
path = path.strip("/")
|
||||||
@ -316,9 +319,8 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
|
|
||||||
async def handle_stream(self, handler, redir):
|
async def handle_stream(self, handler, redir):
|
||||||
upstream = None
|
upstream = None
|
||||||
if handler.proxy is not None:
|
|
||||||
try:
|
try:
|
||||||
logger.info(proxy)
|
logger.info(handler.proxy)
|
||||||
streams = handler.proxy.stream().streams(handler.upstream)
|
streams = handler.proxy.stream().streams(handler.upstream)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.info(e)
|
logger.info(e)
|
||||||
@ -345,7 +347,7 @@ class MainHandler(tornado.web.RequestHandler):
|
|||||||
logger.info(upstream)
|
logger.info(upstream)
|
||||||
data = None
|
data = None
|
||||||
if "mpegurl" in ctype.lower():
|
if "mpegurl" in ctype.lower():
|
||||||
data = await rewrite(upstream, proxy)
|
data = await rewrite(upstream, handler.proxy)
|
||||||
logger.info(data)
|
logger.info(data)
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
self.set_header("Content-Type", "application/vnd.apple.mpegurl")
|
self.set_header("Content-Type", "application/vnd.apple.mpegurl")
|
||||||
|
Loading…
Reference in New Issue
Block a user