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