def parse_N(self, scan_id, scan, page): #incoming fleets #<td class=left valign=top>Incoming</td><td valign=top>851</td><td class=left valign=top>We have detected an open jumpgate from Tertiary, located at 18:5:11. The fleet will approach our system in tick 855 and appears to have roughly 95 ships.</td> for m in re.finditer('<td class="left" valign="top">Incoming</td><td valign="top">(\d+)</td><td class="left" valign="top">We have detected an open jumpgate from ([^<]+), located at (\d+):(\d+):(\d+). The fleet will approach our system in tick (\d+) and appears to have roughly (\d+) ships.</td>', page): fleetscan = FleetScan() newstick = m.group(1) fleetname = m.group(2) originx = m.group(3) originy = m.group(4) originz = m.group(5) arrivaltick = int(m.group(6)) numships = m.group(7) fleetscan.mission = "Unknown" fleetscan.fleet_name = fleetname fleetscan.launch_tick = newstick fleetscan.landing_tick = arrivaltick fleetscan.fleet_size = numships owner=Planet.load(originx,originy,originz) if owner is None: continue fleetscan.owner = owner fleetscan.target = scan.planet try: scan.fleets.append(fleetscan) session.commit() except Exception, e: session.rollback() print "Exception in news: "+e.__str__() traceback.print_exc() continue print 'Incoming: ' + newstick + ':' + fleetname + '-' + originx + ':' + originy + ':' + originz + '-' + arrivaltick + '|' + numships
def parse_N(self, scan_id, scan, page): #incoming fleets #<td class=left valign=top>Incoming</td><td valign=top>851</td><td class=left valign=top>We have detected an open jumpgate from Tertiary, located at 18:5:11. The fleet will approach our system in tick 855 and appears to have roughly 95 ships.</td> for m in re.finditer( '<td class="left" valign="top">Incoming</td><td valign="top">(\d+)</td><td class="left" valign="top">We have detected an open jumpgate from ([^<]+), located at <a[^>]+>(\d+):(\d+):(\d+)</a>. The fleet will approach our system in tick (\d+) and appears to have (\d+) visible ships.</td>', page): fleetscan = FleetScan() newstick = m.group(1) fleetname = m.group(2) originx = m.group(3) originy = m.group(4) originz = m.group(5) arrivaltick = m.group(6) numships = m.group(7) fleetscan.mission = "Unknown" fleetscan.fleet_name = fleetname fleetscan.launch_tick = newstick fleetscan.landing_tick = int(arrivaltick) fleetscan.fleet_size = numships owner = PlanetHistory.load_planet( originx, originy, originz, newstick, closest=not Config.getboolean("Misc", "catchup")) if owner is None: continue fleetscan.owner = owner fleetscan.target = scan.planet fleetscan.in_cluster = fleetscan.owner.x == fleetscan.target.x fleetscan.in_galaxy = fleetscan.in_cluster and fleetscan.owner.y == fleetscan.target.y try: scan.fleets.append(fleetscan) session.commit() except Exception, e: session.rollback() scanlog("Exception in news: %s" % (str(e), ), traceback=True) continue scanlog('Incoming: ' + newstick + ':' + fleetname + '-' + originx + ':' + originy + ':' + originz + '-' + arrivaltick + '|' + numships)
def parse_N(self, scan_id, scan, page): #incoming fleets #<td class=left valign=top>Incoming</td><td valign=top>851</td><td class=left valign=top>We have detected an open jumpgate from Tertiary, located at 18:5:11. The fleet will approach our system in tick 855 and appears to have roughly 95 ships.</td> for m in re.finditer('<td class="left" valign="top">Incoming</td><td valign="top">(\d+)</td><td class="left" valign="top">We have detected an open jumpgate from ([^<]+), located at <a[^>]+>(\d+):(\d+):(\d+)</a>. The fleet will approach our system in tick (\d+) and appears to have (\d+) visible ships.</td>', page): fleetscan = FleetScan() newstick = m.group(1) fleetname = m.group(2) originx = m.group(3) originy = m.group(4) originz = m.group(5) arrivaltick = m.group(6) numships = m.group(7) fleetscan.mission = "Unknown" fleetscan.fleet_name = fleetname fleetscan.launch_tick = newstick fleetscan.landing_tick = int(arrivaltick) fleetscan.fleet_size = numships owner = PlanetHistory.load_planet(originx,originy,originz,newstick,closest=not Config.getboolean("Misc", "catchup")) if owner is None: continue fleetscan.owner = owner fleetscan.target = scan.planet fleetscan.in_cluster = fleetscan.owner.x == fleetscan.target.x fleetscan.in_galaxy = fleetscan.in_cluster and fleetscan.owner.y == fleetscan.target.y try: scan.fleets.append(fleetscan) session.commit() except Exception, e: session.rollback() scanlog("Exception in news: %s"%(str(e),), traceback=True) continue scanlog('Incoming: ' + newstick + ':' + fleetname + '-' + originx + ':' + originy + ':' + originz + '-' + arrivaltick + '|' + numships)
#<td class=left valign=top>Launch</td><td valign=top>848</td><td class=left valign=top>The Disposable Heroes fleet has been launched, heading for 15:9:8, on a mission to Attack. Arrival tick: 857</td> for m in re.finditer( '<td class="left" valign="top">Launch</td><td valign="top">(\d+)</td><td class="left" valign="top">The ([^,]+) fleet has been launched, heading for <a[^>]+>(\d+):(\d+):(\d+)</a>, on a mission to Attack. Arrival tick: (\d+)</td>', page): fleetscan = FleetScan() newstick = m.group(1) fleetname = m.group(2) originx = m.group(3) originy = m.group(4) originz = m.group(5) arrivaltick = m.group(6) fleetscan.mission = "Attack" fleetscan.fleet_name = fleetname fleetscan.launch_tick = newstick fleetscan.landing_tick = arrivaltick target = PlanetHistory.load_planet( originx, originy, originz, newstick, closest=not Config.getboolean("Misc", "catchup")) if target is None: continue fleetscan.owner = scan.planet fleetscan.target = target fleetscan.in_cluster = fleetscan.owner.x == fleetscan.target.x fleetscan.in_galaxy = fleetscan.in_cluster and fleetscan.owner.y == fleetscan.target.y
#launched attacking fleets #<td class=left valign=top>Launch</td><td valign=top>848</td><td class=left valign=top>The Disposable Heroes fleet has been launched, heading for 15:9:8, on a mission to Attack. Arrival tick: 857</td> for m in re.finditer('<td class="left" valign="top">Launch</td><td valign="top">(\d+)</td><td class="left" valign="top">The ([^,]+) fleet has been launched, heading for (\d+):(\d+):(\d+), on a mission to Attack. Arrival tick: (\d+)</td>', page): fleetscan = FleetScan() newstick = m.group(1) fleetname = m.group(2) originx = m.group(3) originy = m.group(4) originz = m.group(5) arrivaltick = m.group(6) fleetscan.mission = "Attack" fleetscan.fleet_name = fleetname fleetscan.launch_tick = newstick fleetscan.landing_tick = arrivaltick target=Planet.load(originx,originy,originz) if target is None: continue fleetscan.owner = scan.planet fleetscan.target = target try: scan.fleets.append(fleetscan) session.commit() except Exception, e: session.rollback() print "Exception in news: "+e.__str__() traceback.print_exc()