From 59d63b9587f6724e675e45811884d3479d6eef78 Mon Sep 17 00:00:00 2001 From: stolencatkarma Date: Tue, 26 Jul 2016 10:39:56 -0400 Subject: [PATCH] Removal of location from this example This example doesn't need to access any location information for it to work. removed (hopefully) all references to getting/setting location. --- examples/pogo-optimizer/pogo-optimizer-cli.py | 39 ------------------- 1 file changed, 39 deletions(-) diff --git a/examples/pogo-optimizer/pogo-optimizer-cli.py b/examples/pogo-optimizer/pogo-optimizer-cli.py index fa0fdaed..1e78d853 100644 --- a/examples/pogo-optimizer/pogo-optimizer-cli.py +++ b/examples/pogo-optimizer/pogo-optimizer-cli.py @@ -45,41 +45,11 @@ # other stuff from google.protobuf.internal import encoder -from geopy.geocoders import GoogleV3 -from s2sphere import Cell, CellId, LatLng from tabulate import tabulate from collections import defaultdict - log = logging.getLogger(__name__) -def get_pos_by_name(location_name): - geolocator = GoogleV3() - loc = geolocator.geocode(location_name, timeout=10) - if not loc: - return None - - log.info('Your given location: %s', loc.address.encode('utf-8')) - log.info('lat/long/alt: %s %s %s', loc.latitude, loc.longitude, loc.altitude) - - return (loc.latitude, loc.longitude, loc.altitude) - -def get_cell_ids(lat, long, radius = 10): - origin = CellId.from_lat_lng(LatLng.from_degrees(lat, long)).parent(15) - walk = [origin.id()] - right = origin.next() - left = origin.prev() - - # Search around provided radius - for i in range(radius): - walk.append(right.id()) - walk.append(left.id()) - right = right.next() - left = left.prev() - - # Return everything - return sorted(walk) - def encode(cellid): output = [] encoder._VarintEncoder()(output.append, cellid) @@ -101,7 +71,6 @@ def init_config(): required=required("auth_service")) parser.add_argument("-u", "--username", help="Username", required=required("username")) parser.add_argument("-p", "--password", help="Password") - parser.add_argument("-l", "--location", help="Location", required=required("location")) parser.add_argument("-d", "--debug", help="Debug Mode", action='store_true') parser.add_argument("-t", "--test", help="Only parse the specified location", action='store_true') parser.set_defaults(DEBUG=False, TEST=False) @@ -122,7 +91,6 @@ def init_config(): return config - def main(): # log settings # log format @@ -143,19 +111,12 @@ def main(): logging.getLogger("pgoapi").setLevel(logging.DEBUG) logging.getLogger("rpc_api").setLevel(logging.DEBUG) - position = get_pos_by_name(config.location) - if not position: - return - if config.test: return # instantiate pgoapi api = pgoapi.PGoApi() - # provide player position on the earth - api.set_position(*position) - if not api.login(config.auth_service, config.username, config.password): return