Exemple #1
0
def init(mods):
    store = Store()
    for fn in store.all("timer"):
        o = Event().load(fn)
        if "time" not in o: continue
        if time.time() < int(o.time):
            timer = Timer(int(o.time), o)
            launcher.launch(timer.start)
Exemple #2
0
def deleted(event):
    if not event.args: return
    store = Store()
    key = event.args[0]
    nr = 0
    for fn in store.all(key):
       obj = Object().load(fn) 
       if "deleted" not in obj: continue
       res = obj.get(key, "")
       if res: event.reply(res)
       nr += 1
Exemple #3
0
def rm(event):
    try: key, match = event.rest.split(" ", 1)
    except ValueError: return
    nr = 0
    store = Store()
    for fn in store.all(key):
        obj = Object().load(fn)
        if key not in obj: continue
        if match not in obj[key]: continue
        obj.deleted = True
        obj.sync()
        nr += 1
    event.ok(nr)
Exemple #4
0
def restore(event):
    try: key, match = event.args
    except ValueError: return
    nr = 0
    store = Store()
    for fn in store.all(*event.args):
        obj = Object().load(fn)
        if key not in obj: continue
        if match not in obj[key]: continue
        if "deleted" not in obj: continue
        obj.deleted = False
        obj.sync()
        nr += 1
    p.ok(nr)
Exemple #5
0
def fetcher(event):
    result = []
    thrs = []
    store = Store()
    for fn in store.all("rss"):
        obj = Object().load(fn)
        if "deleted" in obj and obj.deleted:
            continue
        if "rss" not in obj:
            continue
        if "http" not in obj.rss:
            continue
        if cfg.rss.ignore and cfg.rss.ignore in obj.rss:
            continue
        fetch(obj)
    seen.sync()
    return result