add error message
This commit is contained in:
parent
8f2744ced7
commit
3fc31165e5
11
stream.py
11
stream.py
@ -27,6 +27,7 @@ for key in proxies:
|
||||
playlist = None
|
||||
icecast_server = os.environ.get("ICECAST_SERVER")
|
||||
stream_server = os.environ.get("STREAM_SERVER")
|
||||
|
||||
if icecast_server is not None and stream_server is not None:
|
||||
with open("/app/sources.json", "r") as f:
|
||||
data = json.loads(f.read())
|
||||
@ -43,7 +44,7 @@ if icecast_server is not None and stream_server is not None:
|
||||
playlist += stream_server + key + "\n"
|
||||
|
||||
class MainHandler(tornado.web.RequestHandler):
|
||||
def handle_any(self):
|
||||
def handle_any(self, write):
|
||||
provider = self.get_query_argument("provider", None)
|
||||
endpoint = None
|
||||
if provider is not None and provider in providers.keys():
|
||||
@ -67,13 +68,15 @@ class MainHandler(tornado.web.RequestHandler):
|
||||
print(str(e))
|
||||
endpoint = None
|
||||
if endpoint is None:
|
||||
self.set_status(404, reason="stream not found")
|
||||
self.set_status(404)
|
||||
if write:
|
||||
self.write("stream not found")
|
||||
else:
|
||||
self.redirect(endpoint, status=303)
|
||||
def get(self):
|
||||
self.handle_any()
|
||||
self.handle_any(True)
|
||||
def head(self):
|
||||
self.handle_any()
|
||||
self.handle_any(False)
|
||||
|
||||
class FileHandler(tornado.web.RequestHandler):
|
||||
def get(self):
|
||||
|
Loading…
Reference in New Issue
Block a user