summaryrefslogtreecommitdiff
path: root/src/text_tv_bornhack.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/text_tv_bornhack.py')
-rw-r--r--src/text_tv_bornhack.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/text_tv_bornhack.py b/src/text_tv_bornhack.py
index 9514da2..1a5a290 100644
--- a/src/text_tv_bornhack.py
+++ b/src/text_tv_bornhack.py
@@ -3,20 +3,19 @@ import os
import flask
-from program_parser import ProgramParser
+from program_parser import program_parser_factory
+program_parser = program_parser_factory()
+
app = flask.Flask(__name__, template_folder='templates', static_folder='static', static_url_path='')
-program_path = os.environ["PROGRAM_PATH"] if "PROGRAM_PATH" in os.environ else './programs/current.json'
-override_date = datetime.datetime.fromisoformat(os.environ["OVERRIDE_DATE"]) if "OVERRIDE_DATE" in os.environ else None
-program_parser = ProgramParser(program_path=program_path, override_date=override_date)
debug = 'PROD' not in os.environ
@app.route('/top')
def top():
- now = datetime.datetime.now() if not override_date else override_date
+ now = datetime.datetime.now() if not program_parser.override_date else program_parser.override_date
return f'BornHack S105 {now.strftime("%a %d %b %R:%S")} '
@@ -40,7 +39,7 @@ def index():
def main():
global app
- app.run(debug=debug)
+ app.run(debug=debug, host='0.0.0.0', port=1337)
if __name__ == '__main__':