WIP
This commit is contained in:
parent
51d71b748f
commit
10422d0499
@ -75,6 +75,9 @@ class CExtractor(Extractor):
|
||||
|
||||
def find_timeslot(text):
|
||||
text = re.sub(' +', ' ', text).split(' ')
|
||||
if len(text) < 3:
|
||||
return None
|
||||
|
||||
day_name = text[0]
|
||||
day_num = text[1]
|
||||
hours = text[2]
|
||||
@ -88,6 +91,7 @@ class CExtractor(Extractor):
|
||||
day_num = int(day_num[0])
|
||||
|
||||
hours = CExtractor.find_hours(hours)
|
||||
|
||||
if hours is None:
|
||||
return None
|
||||
|
||||
@ -109,6 +113,7 @@ class CExtractor(Extractor):
|
||||
for e in p.stripped_strings:
|
||||
day = CExtractor.find_timeslot(e)
|
||||
if not day is None:
|
||||
print('on a une date', day)
|
||||
if not date is None and is_open:
|
||||
# we reach a new day
|
||||
result.append((date, slot))
|
||||
@ -124,12 +129,14 @@ class CExtractor(Extractor):
|
||||
continue
|
||||
|
||||
if CExtractor.is_nickname(e):
|
||||
print('on a un nickname', e)
|
||||
# we found a nickname
|
||||
is_open = True
|
||||
continue
|
||||
|
||||
hours = CExtractor.find_hours(e)
|
||||
if not hours is None:
|
||||
print('on a une heure', hours)
|
||||
if slot is None:
|
||||
slot = hours
|
||||
else:
|
||||
@ -137,6 +144,7 @@ class CExtractor(Extractor):
|
||||
continue
|
||||
|
||||
if CExtractor.is_canceled(e):
|
||||
print('on a un cancel')
|
||||
is_open = False
|
||||
continue
|
||||
|
||||
@ -166,10 +174,8 @@ class CExtractor(Extractor):
|
||||
# annule
|
||||
# menage
|
||||
for p in description.select('p'):
|
||||
CExtractor.find_timeslots(p)
|
||||
|
||||
if not '@' in p.text:
|
||||
continue
|
||||
ts = CExtractor.find_timeslots(p)
|
||||
print(ts, when, title)
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user