aboutsummaryrefslogtreecommitdiff
path: root/mensa/backends/studentenwerk.py
diff options
context:
space:
mode:
Diffstat (limited to 'mensa/backends/studentenwerk.py')
-rw-r--r--mensa/backends/studentenwerk.py25
1 files changed, 18 insertions, 7 deletions
diff --git a/mensa/backends/studentenwerk.py b/mensa/backends/studentenwerk.py
index b1f00fd..9c4cf02 100644
--- a/mensa/backends/studentenwerk.py
+++ b/mensa/backends/studentenwerk.py
@@ -11,8 +11,11 @@ import multiprocessing
import datetime
from collections import OrderedDict
+boring = ["Desserts", "Salate"] # categories which are considered boring because they contain the same food every day.
+
from yapsy import NormalizePluginNameForModuleName as normalize
mensenliste = {"TU Hardenbergstraße" : ["mensa-tu-hardenbergstra%C3%9Fe", (52.5097684, 13.3259478)],
+ "TU Veggie 2.0" : ["veggie2.0", (52.5097684, 13.3259478)],
"TU Marchstraße": ["cafeteria-tu-marchstra%C3%9Fe", ( 52.5166071, 13.3234066)],
"TU Skyline": ["cafeteria-tu-skyline", (52.5128648, 13.3200313)],
"TU Architektur": ["cafeteria-tu-architektur", (52.5137508, 13.3234541)],
@@ -43,16 +46,22 @@ class Studentenwerk(IPlugin) :
for h,n in mensenliste.items() :
r = Restaurant(normalize(h), h, self, "dummy", [n[0]], pos=n[1])
register_restaurant(r)
- def get_food_items(self, mensa="mensa-tu-hardenbergstra%C3%9Fe", ignore_nudelauswahl=False, **options) :
+ def get_food_items(self, mensa="mensa-tu-hardenbergstra%C3%9Fe", **options) :
document = self.fetch_page(mensa)
groupsel = CSSSelector('.splGroupWrapper')
groups = [e for e in groupsel(document)]
fl = OrderedDict()
+ no_boring = False
+ if "args" in options :
+ no_boring = options["args"].no_boring
for group in groups :
try:
category = CSSSelector('.splGroup')(group)[0].text
except:
- raise NoMenuError from None
+ continue
+ #raise NoMenuError from None
+ if no_boring and category in boring :
+ continue
if not category in fl :
fl[category] = []
sel = CSSSelector('.splMeal')
@@ -60,15 +69,17 @@ class Studentenwerk(IPlugin) :
for m in meals :
namesel = CSSSelector('.bold')
nm = namesel(m)[0].text
- if ignore_nudelauswahl and "Nudelauswahl" in nm :
+ if no_boring and "Nudelauswahl" in nm :
continue
pricesel = CSSSelector('.col-md-3')
veg = 0
if len(pricesel(m)[0]) >= 2 :
- if "15" in pricesel(m)[0][1].attrib["src"] :
- veg = 2
- elif "1.png" in pricesel(m)[0][1].attrib["src"] :
- veg = 1
+ for k in pricesel(m)[0]:
+ if "src" in k.attrib :
+ if "15" in k.attrib["src"] :
+ veg = 2
+ elif "1.png" in k.attrib["src"] :
+ veg = 1
price = pricesel(m)[-1].text.strip()
if "only_student_prices" in options and options["only_student_prices"] :
price = only_student_prices(price)