feat: handling various timeslot descriptions

This commit is contained in:
Jean-Marie Favreau 2024-10-12 19:30:20 +02:00
parent b56cbf66a0
commit 2feb6219f7

View File

@ -63,9 +63,14 @@ class CExtractor(Extractor):
if not date is None and is_open:
# we reach a new day
result.append((date, tstart, tend))
date = day
tstart = None
tend = None
if isinstance(day, tuple):
date = day[0]
tstart = day[1]
tend = day[2]
else:
date = day
tstart = None
tend = None
is_open = False
continue
elif not is_open:
@ -79,8 +84,14 @@ class CExtractor(Extractor):
hours = CExtractor.find_hours(e)
if not hours is None:
# we found hours
tstart = hours[0]
tend = hours[1]
if tstart is None:
tstart = hours[0]
else:
tstart = min(tstart, hours[0])
if tend is None:
tend = hours[1]
else:
tend = max(tend, hours[1])
continue
if CExtractor.is_canceled(e):