specify ports and locations via cmd line

This commit is contained in:
zuckerberg 2021-08-28 09:56:34 -04:00
parent b6a53eafef
commit d0a08a202b

View File

@ -7,11 +7,12 @@ from flask import Flask, request
from queue import Queue from queue import Queue
import json import json
import requests import requests
import sys
app = Flask(__name__) app = Flask(__name__)
host = "localhost:8001" host = sys.argv[1]
stream = "stream.mp3" stream = sys.argv[2]
class Radio(object): class Radio(object):
def __init__(self): def __init__(self):
@ -93,7 +94,7 @@ def listeners():
return str(r.listenerCount()) return str(r.listenerCount())
def run(): def run():
app.run(host="0.0.0.0") app.run(host="0.0.0.0", port=int(sys.argv[3]))
if __name__ == "__main__": if __name__ == "__main__":
run() run()