Commit d8540cb7 authored by Koen Martens's avatar Koen Martens

lfhelper: refactor for dict of hgexp, add festival of lights

parent cc7e01f2
......@@ -3,14 +3,29 @@ from helper import Helper
from lib.category import Category
class LfHelper(Helper):
bondagere = re.compile("bondage ranch",re.I)
hgexp = re.compile('lfgrid.com:8002:([^:]+)', flags=re.I)
expr = {
re.compile("bondage ranch",flags=re.I) : 'lfgrid.com:8002:Bondage Ranch',
re.compile("luminaria",flags=re.I) : 'lfgrid.com:8002:Luminaria',
re.compile("festival of lights",flags=re.I) : 'lfgrid.com:8002:Luminaria',
}
def customizeEvent(self, event):
event = super(LfHelper, self).customizeEvent(event)
if event.hgurl!=None and event.hgurl.strip()!="":
if LfHelper.bondagere.search(event.title):
event.hgurl = "lfgrid.com:8002:Bondage Ranch"
if LfHelper.hgexp.search(event.hgurl)==None:
for exp in LfHelper.expr:
if exp.search(event.hgurl):
event.hgurl = LfHelper.expr[exp]
break
if event.hgurl==None or LfHelper.hgexp.search(event.hgurl)==None:
for exp in LfHelper.expr:
if exp.search(event.title):
event.hgurl = LfHelper.expr[exp]
break
return event
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment