2023-12-22 11:38:42 +01:00
#!/usr/bin/python3
# coding: utf-8
import os
2023-12-23 09:53:30 +01:00
import json
2024-01-26 13:35:47 +01:00
import sys
2023-12-22 11:38:42 +01:00
2024-01-26 13:35:47 +01:00
# getting the name of the directory
# where the this file is present.
current = os . path . dirname ( os . path . realpath ( __file__ ) )
# Getting the parent directory name
# where the current directory is present.
parent = os . path . dirname ( current )
# adding the parent directory to
# the sys.path.
sys . path . append ( parent )
2023-12-22 11:38:42 +01:00
2024-01-26 13:35:47 +01:00
from src . agenda_culturel . import_tasks . downloader import *
from src . agenda_culturel . import_tasks . extractor import *
from src . agenda_culturel . import_tasks . importer import *
from src . agenda_culturel . import_tasks . extractor_ical import *
2023-12-22 11:38:42 +01:00
if __name__ == " __main__ " :
u2e = URL2Events ( SimpleDownloader ( ) , ICALExtractor ( ) )
url = " https://calendar.google.com/calendar/ical/programmation.lesaugustes %40g mail.com/public/basic.ics "
url_human = " https://www.cafelesaugustes.fr/la-programmation/ "
2023-12-22 15:45:21 +01:00
events = u2e . process ( url , url_human , cache = " cache-augustes.ical " , default_values = { " category " : " Autre " , " location " : " Café lecture les Augustes " } , published = True )
2023-12-22 11:38:42 +01:00
2023-12-23 09:53:30 +01:00
exportfile = " events-augustes.json "
print ( " Saving events to file {} " . format ( exportfile ) )
with open ( exportfile , " w " ) as f :
json . dump ( events , f , indent = 4 , default = str )