diff options
| author | user <user@node5.net> | 2024-07-20 13:48:41 +0200 |
|---|---|---|
| committer | user <user@node5.net> | 2024-07-20 13:48:41 +0200 |
| commit | 6f219b4c7fde4753c042da42a7e2653ab659bf1b (patch) | |
| tree | b5d03fb7571fa5281304c79f8324f46ed48948c4 | |
| parent | 2b428ce5f6ad5303f8bdd3e7a6e90be5b2b2f791 (diff) | |
Program parser - Remove write to file, add unknown icon
| -rwxr-xr-x | src/program_parser.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/program_parser.py b/src/program_parser.py index 59f1159..872b5c4 100755 --- a/src/program_parser.py +++ b/src/program_parser.py @@ -5,9 +5,7 @@ import datetime import copy import dataclasses -input_file_path = '../../content/program.json' -tmp_file_path = '/tmp/teletext/bh_events_to_show_TMP' -output_file_path = '/tmp/teletext/bh_events_to_show' +input_file_path = './program.json' title_max_length = 30 #current_date = datetime.datetime(year=2024, month=7, day=18, hour=14, minute=59) # DEBUG @@ -77,7 +75,10 @@ def get_events_to_show(program: list[Event], programs_to_show_count=4) -> list[E event.day = event.start_date.strftime('%a') start_time = event.start_date.strftime('%H:%M') end_time = event.end_date.strftime('%H:%M') - event.icon = icons[event.room] + event.icon = icons.get(event.room) + if event.icon == None: + event.icon = '?' + print(f"NEW ICON NEEDED!!! for {event.room}") event.time = f"{start_time}-{end_time}" return f"{event.title} {event.day} {start_time}-{end_time} {event.icon}" @@ -92,13 +93,13 @@ def get_events_to_show(program: list[Event], programs_to_show_count=4) -> list[E program: list[Event] = get_program() events_to_show: list[Event] = get_events_to_show(program) +''' # Convert to the output string events_to_show_string = '\n'.join([a.pretty for a in events_to_show]) print(f"{events_to_show_string}\n") - # Write to output file with open(tmp_file_path, 'w') as tmp_file: tmp_file.write(events_to_show_string) os.rename(tmp_file_path, output_file_path) print(f'Written to {output_file_path} length: {len(events_to_show_string)}') - +''' |
