sources test
This commit is contained in:
parent
e1ef84153a
commit
b247030174
29
stream.py
29
stream.py
@ -56,19 +56,22 @@ stream_server = os.environ.get("STREAM_SERVER")
|
|||||||
proxy_server = os.environ.get("PROXY_SERVER")
|
proxy_server = os.environ.get("PROXY_SERVER")
|
||||||
|
|
||||||
if icecast_server is not None and stream_server is not None:
|
if icecast_server is not None and stream_server is not None:
|
||||||
with open("/app/sources.json", "r") as f:
|
try:
|
||||||
data = json.loads(f.read())
|
with open("/app/sources.json", "r") as f:
|
||||||
playlist = "#EXTM3U\n"
|
data = json.loads(f.read())
|
||||||
for key in data:
|
playlist = "#EXTM3U\n"
|
||||||
current = data[key]
|
for key in data:
|
||||||
name = current["name"]
|
current = data[key]
|
||||||
radio = current["radio"]
|
name = current["name"]
|
||||||
if radio:
|
radio = current["radio"]
|
||||||
playlist += f'#EXTINF:0 radio="true", {name}\n'
|
if radio:
|
||||||
playlist += icecast_server + key + "\n"
|
playlist += f'#EXTINF:0 radio="true", {name}\n'
|
||||||
else:
|
playlist += icecast_server + key + "\n"
|
||||||
playlist += f'#EXTINF:0 radio="false", {name}\n'
|
else:
|
||||||
playlist += stream_server + key + "\n"
|
playlist += f'#EXTINF:0 radio="false", {name}\n'
|
||||||
|
playlist += stream_server + key + "\n"
|
||||||
|
except Exception as e:
|
||||||
|
logger.info(e)
|
||||||
|
|
||||||
template_html = None
|
template_html = None
|
||||||
template_js = None
|
template_js = None
|
||||||
|
Loading…
Reference in New Issue
Block a user