diff options
| author | user@node5.net <user@node5.net> | 2026-07-06 15:52:31 +0200 |
|---|---|---|
| committer | user@node5.net <user@node5.net> | 2026-07-10 13:15:02 +0200 |
| commit | 2b17ed3b444e7169ce9910422ecb9b8ab02141ae (patch) | |
| tree | 1cad7805b5003b4fc65a3e1e4e878470c67f17a6 /src | |
| parent | 43dd5ac61f260ff28d13ef3cb6969e4d804c952e (diff) | |
fix: default parameter for width
Diffstat (limited to 'src')
| -rw-r--r-- | src/text_tv.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/text_tv.py b/src/text_tv.py index abd86e2..af7d744 100644 --- a/src/text_tv.py +++ b/src/text_tv.py @@ -12,9 +12,8 @@ app = flask.Flask(__name__, template_folder='templates', static_folder='static', debug = 'PROD' not in os.environ -@app.route('/top', defaults={'width': 34}) +@app.route('/top', defaults={'width': 50}) @app.route('/top/<width>') -@app.route('/top') def top(width: int): now = datetime.datetime.now() if not program_parser.override_date else program_parser.override_date parts = ['BornHack', 'S105', now.strftime("%a %d %b"), now.strftime("%R:%S")] @@ -26,12 +25,13 @@ def top(width: int): top = top + " " * remainder return top -@app.route('/update') -def update(): - return top() + '\n' + flask.render_template('program.html', parts=text()) +@app.route('/update', defaults={'width': 50}) +@app.route('/update/<width>') +def update(width: int): + return top(width=width) + '\n' + flask.render_template('program.html', parts=text(width=width)) -@app.route('/program.json', defaults={'width': 34}) +@app.route('/program.json', defaults={'width': 50}) @app.route('/program.json/<width>') def program(width: int): title_max_length = width - 17 # Truncate the title minus the length of the date, icon and associated whitespace @@ -41,7 +41,7 @@ def program(width: int): return events_to_show -@app.route("/text/", defaults={'width': 34}) +@app.route("/text/", defaults={'width': 50}) @app.route("/text/<width>") def text(width: int) -> dict[str, str]: return {part: eval(part)(width=width) for part in ['top', 'program']} |
