diff options
Diffstat (limited to 'modules/mensa.py')
-rw-r--r-- | modules/mensa.py | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/modules/mensa.py b/modules/mensa.py index daee81d..2dd71dc 100644 --- a/modules/mensa.py +++ b/modules/mensa.py @@ -59,7 +59,7 @@ class Module(ModuleBase): r = re.compile(r'\s*<td class="schrift_(gerichte|spezial)">(.+?)</td>', re.DOTALL) match = r.match(mealstr, pos) while match: - meals.append((match.group(2), match.group(1) == 'spezial')) + meals.append(match.group(2)) if len(meals) >= 4: break @@ -102,36 +102,21 @@ class Module(ModuleBase): s = s.replace('"', '"') s = s.replace('<br />', ' ‒ ') s = re.sub('\s+', ' ', s) + s = re.sub(r'<span[^>]*>(.+?)</span>', r'\1', s) return s - meals = map(lambda (s, special): (unescape(s), special), meals) + meals = map(unescape, meals) prices = map(unescape, prices) reply = 'Mensa-Menü für den %s\n\n' % day.strftime('%d.%m.%y') - if meals[0][0]: - if meals[0][1]: - reply += 'Mensatipp: ' - else: - reply += 'Eintopf: ' - reply += '%s (%s)\n' % (meals[0][0], prices[0]) - if meals[1][0]: - if meals[1][1]: - reply += 'Mensatipp: ' - else: - reply += 'Hauptgericht 1: ' - reply += '%s (%s)\n' % (meals[1][0], prices[1]) - if meals[2][0]: - if meals[2][1]: - reply += 'Mensatipp: ' - else: - reply += 'Hauptgericht 2: ' - reply += '%s (%s)\n' % (meals[2][0], prices[2]) - if meals[3][0]: - if meals[3][1]: - reply += 'Mensatipp: ' - else: - reply += 'Vegetarisches Hauptgericht: ' - reply += '%s (%s)\n' % (meals[3][0], prices[3]) + if meals[0]: + reply += 'Eintopf: %s (%s)\n' % (meals[0].strip(), prices[0].strip()) + if meals[1]: + reply += 'Hauptgericht 1: %s (%s)\n' % (meals[1].strip(), prices[1].strip()) + if meals[2]: + reply += 'Hauptgericht 2: %s (%s)\n' % (meals[2].strip(), prices[2].strip()) + if meals[3]: + reply += 'Vegetarisches Hauptgericht: %s (%s)\n' % (meals[3].strip(), prices[3].strip()) return reply |