Pick events class from v4
This commit is contained in:
parent
04eccbe250
commit
acded35e1a
6 changed files with 82 additions and 49 deletions
|
|
@ -14,7 +14,7 @@ yrn = datetime.today().year + 1
|
|||
|
||||
def load(context):
|
||||
d = datetime(yrn, 1, 1, 0, 0, 0) - datetime.now()
|
||||
add_event(ModuleEvent(intervalle=0, offset=d.total_seconds(), call=bonneannee))
|
||||
add_event(ModuleEvent(interval=0, offset=d.total_seconds(), call=bonneannee))
|
||||
|
||||
def bonneannee():
|
||||
txt = "Bonne année %d !" % datetime.today().year
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ def load(context):
|
|||
for evt in DATAS.index.keys():
|
||||
if DATAS.index[evt].hasAttribute("end"):
|
||||
event = ModuleEvent(call=fini, call_data=dict(strend=DATAS.index[evt]))
|
||||
event.end = DATAS.index[evt].getDate("end")
|
||||
event._end = DATAS.index[evt].getDate("end")
|
||||
idt = context.add_event(event)
|
||||
if idt is not None:
|
||||
DATAS.index[evt]["id"] = idt
|
||||
|
|
@ -101,7 +101,7 @@ def start_countdown(msg):
|
|||
strnd["end"] = datetime(now.year, now.month, now.day, hou, minu, sec)
|
||||
else:
|
||||
strnd["end"] = datetime(now.year, now.month, now.day + 1, hou, minu, sec)
|
||||
evt.end = strnd.getDate("end")
|
||||
evt._end = strnd.getDate("end")
|
||||
strnd["id"] = add_event(evt)
|
||||
except:
|
||||
DATAS.delChild(strnd)
|
||||
|
|
@ -122,8 +122,10 @@ def start_countdown(msg):
|
|||
strnd["end"] += timedelta(days=int(t)*365)
|
||||
else:
|
||||
strnd["end"] += timedelta(seconds=int(t))
|
||||
evt.end = strnd.getDate("end")
|
||||
strnd["id"] = add_event(evt)
|
||||
evt._end = strnd.getDate("end")
|
||||
eid = add_event(evt)
|
||||
if eid is not None:
|
||||
strnd["id"] = eid
|
||||
|
||||
save()
|
||||
if "end" in strnd:
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ def start_watching(site, offset=0):
|
|||
print_debug("Add event for site: %s" % o.netloc)
|
||||
evt = ModuleEvent(func=lambda url: w3m(url), cmp_data=site["lastcontent"],
|
||||
func_data=site["url"], offset=offset,
|
||||
intervalle=site.getInt("time"),
|
||||
interval=site.getInt("time"),
|
||||
call=alert_change, call_data=site)
|
||||
site["_evt_id"] = add_event(evt)
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ API_URL="http://worldcup.sfg.io/%s"
|
|||
|
||||
def load(context):
|
||||
from event import ModuleEvent
|
||||
add_event(ModuleEvent(func=lambda url: urlopen(url, timeout=10).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, intervalle=30))
|
||||
add_event(ModuleEvent(func=lambda url: urlopen(url, timeout=10).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, interval=30))
|
||||
|
||||
|
||||
def help_full ():
|
||||
|
|
@ -66,7 +66,7 @@ def cmd_watch(msg):
|
|||
def current_match_new_action(match_str, osef):
|
||||
global DATAS
|
||||
|
||||
add_event(ModuleEvent(func=lambda url: urlopen(url).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, intervalle=30))
|
||||
add_event(ModuleEvent(func=lambda url: urlopen(url).read().decode(), func_data=API_URL % "matches/current?by_date=DESC", call=current_match_new_action, interval=30))
|
||||
|
||||
matches = json.loads(match_str)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue