2024-12-30 18:07:15 +00:00
|
|
|
border_top = "╔" + "═" * 58 + "╗"
|
|
|
|
border_bottom = "╚" + "═" * 58 + "╝"
|
|
|
|
separator = "╠" + "═" * 58 + "╣"
|
|
|
|
|
2024-12-31 11:53:08 +00:00
|
|
|
def handle_curl(movies, day):
|
|
|
|
table = [border_top,
|
|
|
|
"║{:^58}║".format("CinéBrest"),
|
|
|
|
"║{:^58}║".format(day),
|
|
|
|
separator]
|
2024-12-30 18:07:15 +00:00
|
|
|
|
|
|
|
for film in movies:
|
|
|
|
title_line = f"║ {film['title']:<57}║"
|
|
|
|
table.append(title_line)
|
2024-12-31 11:53:08 +00:00
|
|
|
|
2024-12-30 18:07:15 +00:00
|
|
|
for cinema, seances in film['seances'].items():
|
|
|
|
cinema_line = f"║ ├─ {cinema:<54}║"
|
2024-12-31 11:53:08 +00:00
|
|
|
table.append(cinema_line)
|
|
|
|
|
|
|
|
# Split seances into groups of 6
|
|
|
|
groups = [seances[i:i+6] for i in range(0, len(seances), 6)]
|
|
|
|
|
|
|
|
for i, chunk in enumerate(groups):
|
|
|
|
# Use └ for last group, ├ for others
|
|
|
|
if i == len(groups) - 1:
|
|
|
|
seances_line = f"║ │ └─ {', '.join(chunk):<45}║"
|
|
|
|
else:
|
|
|
|
seances_line = f"║ │ ├─ {', '.join(chunk):<45}║"
|
|
|
|
table.append(seances_line)
|
|
|
|
|
2024-12-30 18:07:15 +00:00
|
|
|
table.append(separator)
|
2024-12-31 11:53:08 +00:00
|
|
|
|
2024-12-30 18:07:15 +00:00
|
|
|
table[-1] = border_bottom
|
2024-12-31 11:53:08 +00:00
|
|
|
return "\n".join(table)+"\n"
|