Enhance quote matching regex

master
Nikola Forró 7 years ago
parent d80638dd8b
commit 72bfeb19b5

@ -67,7 +67,7 @@ def main():
if last:
videos = [v for v in videos if v['date'] >= last.date]
last_id = last.id
QUOTE = re.compile(r'^\!quote\s+add\s+(.+)$')
QUOTE = re.compile(r'^\!quote\s+add\s+(?P<q>")?(?P<text>.+)(?(q)")$')
quotes = []
for video in videos:
app.logger.info('Processing video %d (%s)', video['id'], video['title'])
@ -76,7 +76,7 @@ def main():
m = QUOTE.match(comment)
if m:
quotes.append(dict(
text=m.group(1),
text=m.group('text'),
video_id=video['id'],
game=video['game'],
date=video['date']))

Loading…
Cancel
Save