add nextcloud support

This commit is contained in:
Roy Olav Purser 2021-05-22 19:08:44 +02:00
parent 23596f3c1b
commit cabccfa7b5
Signed by: roypur
GPG Key ID: E14D26A036F21656

View File

@ -22,6 +22,11 @@ providers["nrk"] = "https://tv.nrk.no"
providers["svt"] = "https://svtplay.se"
providers["youtube"] = "https://www.youtube.com/watch?v="
providers["twitch"] = "https://twitch.tv"
nextcloud_server = os.environ.get("NEXTCLOUD_SERVER")
if nextcloud_server is not None:
providers["nextcloud"] = nextcloud_server
playlist = None
icecast_server = os.environ.get("ICECAST_SERVER")
stream_server = os.environ.get("STREAM_SERVER")
@ -341,8 +346,11 @@ class MainHandler(tornado.web.RequestHandler):
self.write("HTML template missing.")
async def handle_stream(self, handler, redir):
streams = None
upstream = await stream_providers.get_any(handler.upstream, handler.proxy, logger)
upstream = None
if handler.provider == "nextcloud":
upstream = handler.upstream
else:
upstream = await stream_providers.get_any(handler.upstream, handler.proxy, logger)
if upstream is None:
logger.info(f'invalid upstream ({handler.provider})')
self.set_status(404)