diff --git a/backend/stream.py b/backend/stream.py index e6fae55..0670962 100755 --- a/backend/stream.py +++ b/backend/stream.py @@ -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)