def execute(self, request, user): lookup = (request.REQUEST.get("lookup") or "").strip() if not lookup: if user.is_member(): return HttpResponseRedirect(reverse("dashboard", kwargs={"username":user.name})) return HttpResponseRedirect("/") scans = scanre.findall(lookup) groups = scangrpre.findall(lookup) if len(scans) or len(groups): for url in scans: parse(user.id, "scan", url).start() for url in groups: parse(user.id, "group", url).start() return HttpResponseRedirect(reverse("requests")) m = self.coord.match(lookup) if m is None: alliance = Alliance.load(lookup) if lookup else None if alliance: return HttpResponseRedirect(reverse("alliance", kwargs={"name":alliance.name})) elif not user.is_member(): return HttpResponseRedirect(reverse("alliance_ranks")) else: member = User.load(lookup, exact=False, access="member") if lookup else None if member: return HttpResponseRedirect(reverse("dashboard", kwargs={"username":member.name})) else: Q = session.query(Planet) Q = Q.join(Planet.intel) Q = Q.filter(Planet.active == True) Q = Q.filter(Intel.nick.ilike(lookup+"%")) planet = Q.first() if planet: return HttpResponseRedirect(reverse("planet", kwargs={"x":planet.x, "y":planet.y, "z":planet.z})) else: return HttpResponseRedirect(reverse("alliance_ranks")) elif m.group(5) is not None: return HttpResponseRedirect(reverse("planet", kwargs={"x":m.group(1), "y":m.group(3), "z":m.group(5)})) elif m.group(3) is not None: return HttpResponseRedirect(reverse("galaxy", kwargs={"x":m.group(1), "y":m.group(3)}))
def catcher(message): try: user = User.load(name=message.get_pnick()) uid = user.id if user else None except PNickParseError: uid = None share = True if Config.has_option("Channels", "share"): if message.get_chan().lower() == Config.get("Channels", "share").lower(): share = False for m in scanre.finditer(message.get_msg()): parse(uid, "scan", m.group(1), share).start() for m in scangrpre.finditer(message.get_msg()): parse(uid, "group", m.group(1), share).start()
def catcher(message): try: user = User.load(name=message.get_pnick()) uid = user.id if user else None except PNickParseError: uid = None for m in scanre.finditer(message.get_msg()): parse(uid, "scan", m.group(1)).start() if Config.has_option("Channels", "share"): sharechan = Config.get("Channels", "share") if message.get_chan().lower() != sharechan.lower(): if Config.get("Misc", "shareto"): message.privmsg(m.group(0), Config.get("Misc","shareto"), priority=+3) for m in scangrpre.finditer(message.get_msg()): parse(uid, "group", m.group(1)).start() if Config.has_option("Channels", "share"): sharechan = Config.get("Channels", "share") if message.get_chan().lower() != sharechan.lower(): if Config.get("Misc", "shareto"): message.privmsg(m.group(0), Config.get("Misc","shareto"), priority=+3)
#!/usr/bin/env python import re from Hooks.scans.parser import parse from time import sleep import gc scanre = re.compile( "https?://[^/]+/(?:showscan|waves).pl\?scan_id=([0-9a-zA-Z]+)") i = 0 with open("1000scans.txt") as f: for x in f: i += 1 print "Processing scan %d..." % (i) scanid = scanre.match(x).group(1) parse(1, "scan", scanid).start() sleep(2) gc.collect() print "Done."
#!/usr/bin/env python import re from Hooks.scans.parser import parse from time import sleep import gc scanre=re.compile("https?://[^/]+/(?:showscan|waves).pl\?scan_id=([0-9a-zA-Z]+)") i=0 with open("1000scans.txt") as f: for x in f: i+=1 print "Processing scan %d..." % (i) scanid = scanre.match(x).group(1) parse(1, "scan", scanid).start() sleep(2) gc.collect() print "Done."