|
@@ -37,6 +37,7 @@ def parse(msg):
|
|
|
for article_text in articles_text.split('\n\n'):
|
|
|
article_match = re.match(
|
|
|
ur' *(?P<name>.*)\s'
|
|
|
+ + ur'( *von (?P<authors>.*)\s)?'
|
|
|
+ ur' *(?P<price_brutto_currency>[A-Z]+) (?P<price_brutto>\d+,\d+)\s'
|
|
|
+ ur'( *Zustand: (?P<state>.*)\s)?'
|
|
|
+ ur' *Verkauft von: (?P<reseller>.*)'
|
|
@@ -48,6 +49,10 @@ def parse(msg):
|
|
|
sys.stderr.write(repr(article_text))
|
|
|
raise Exception('could not match article')
|
|
|
article = article_match.groupdict()
|
|
|
+ if article['authors']:
|
|
|
+ article['authors'] = article['authors'].split(',')
|
|
|
+ else:
|
|
|
+ del article['authors']
|
|
|
article['price_brutto'] = float(article['price_brutto'].replace(',', '.'))
|
|
|
order['articles'].append(article)
|
|
|
|