nextcloud video url

This commit is contained in:
Roy Olav Purser 2021-05-25 10:59:30 +02:00
parent d4d786041d
commit c03ffa885f
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -364,19 +364,19 @@ class MainHandler(tornado.web.RequestHandler):
self.write("HTML template missing.") self.write("HTML template missing.")
async def handle_stream(self, handler, redir): async def handle_stream(self, handler, redir):
meta = await handler.meta() if handler.provider != "nextcloud":
image = meta.get("og:image") meta = await handler.meta()
if isinstance(image, str): image = meta.get("og:image")
if handler.provider == "youtube" and image.endswith("hqdefault.jpg"): if isinstance(image, str):
image = image.removesuffix("hqdefault.jpg") + "maxresdefault.jpg" if handler.provider == "youtube" and image.endswith("hqdefault.jpg"):
image = await handler.proxy.proxy_url(image, None) image = image.removesuffix("hqdefault.jpg") + "maxresdefault.jpg"
if isinstance(image, str): image = await handler.proxy.proxy_url(image, None)
self.set_header("Custom-Poster", image) if isinstance(image, str):
self.set_header("Custom-Poster", image)
upstream = None upstream = None
if handler.provider == "nextcloud": if handler.provider == "nextcloud":
upstream = urllib.parse.urljoin(handler.upstream, "download") upstream = urllib.parse.urljoin(handler.upstream, "/download")
logger.info(upstream)
else: else:
upstream = await stream_providers.get_any(handler.upstream, handler.proxy, logger) upstream = await stream_providers.get_any(handler.upstream, handler.proxy, logger)
if upstream is None: if upstream is None: