def _parse_overview(self, content, location, rec_depth = 0): c1, c2 = location text = content.replace("\\'", "'") a = json.loads(text.replace('\t', ' ')) points = [] if not 'cc' in a['cs']: if 'count' in a['cs'] and 'count' != 0: # let's try to download one half of the geocaches first mlat = (c1.lat + c2.lat)/2 nc1 = geo.Coordinate(min(c1.lat, c2.lat), min(c1.lon, c2.lon)) mc1 = geo.Coordinate(mlat, max(c1.lon, c2.lon)) mc2 = geo.Coordinate(mlat, min(c1.lon, c2.lon)) nc2 = geo.Coordinate(max(c1.lat, c2.lat), max(c1.lon, c2.lon)) #print "recursing..." CacheDownloader.lock.release() points += self.get_geocaches((nc1, mc1), rec_depth + 1) points += self.get_geocaches((mc2, nc2), rec_depth + 1) CacheDownloader.lock.acquire(False) return points for b in a['cs']['cc']: c = GeocacheCoordinate(b['lat'], b['lon'], b['gc']) c.title = b['nn'] if b['ctid'] in self.CTIDS: c.type = self.CTIDS[b['ctid']] else: c.type = GeocacheCoordinate.TYPE_UNKNOWN c.found = b['f'] if not b['ia']: c.status = GeocacheCoordinate.STATUS_DISABLED points.append(c) return points