diff options
Diffstat (limited to 'src/program_parser.py')
| -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)}') - +''' |
