-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
41 lines (33 loc) · 1.22 KB
/
Copy pathmain.py
File metadata and controls
41 lines (33 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from convert_slots_to_events import convert_slots_to_events
from data.xlsx_scrapper import *
from name_to_email.email_resolver import email_resolver, close_db
from event_sender import send_multiple_events
# Generowanie slotów z pliku Excel
sloty = generuj_sloty_osob('./data/ekawa-harmo2.xlsx')
# Konwersja aliasów na emaile
sloty_email = {}
for alias, slots in sloty.items():
email = email_resolver(alias)
sloty_email[email] = slots
print("Sloty z emailami:")
print(sloty_email)
print("\n" + "="*50 + "\n")
# Konwersja slotów na eventy Google Calendar
events = convert_slots_to_events(sloty_email)
print(f"Wygenerowano {len(events)} wydarzeń:")
for event in events:
print(f" - {event.get('summary')} | {event.get('start', {}).get('dateTime')}")
print("\n" + "="*50 + "\n")
# Wysłanie wszystkich eventów do Google Calendar
if events:
confirm = input(f"Czy chcesz wysłać {len(events)} wydarzeń do kalendarza? (tak/nie): ")
if confirm.lower() in ['tak', 't', 'yes', 'y']:
results = send_multiple_events(events)
else:
print("Anulowano wysyłanie wydarzeń.")
else:
print("Brak wydarzeń do wysłania.")
# Zamknięcie połączenia z bazą danych
close_db()
# wyswietl_sloty(sloty)
# print(sloty)