Skip to content

Commit

Permalink
Add feature PokemonGoF#1257: Ignore to parse the Pokemon by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
Spiritvn committed Sep 11, 2016
1 parent f45e88b commit e07b2b0
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions config/config.ini.example
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#no-gyms: # disables gym scanning (default false)
#no-pokemon: # disables pokemon scanning (default false)
#no-pokestops: # disables pokestop scanning (default false)
#ignore-list: # list of Pokemon IDs to ignore scanning (default [])
#scan-delay: # default 10
#step-limit: # default 12
#gym-info: # enables detailed gym info collection (default false)
Expand Down
31 changes: 17 additions & 14 deletions pogom/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -595,26 +595,29 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue):

printPokemon(p['pokemon_data']['pokemon_id'], p['latitude'],
p['longitude'], d_t)
pokemons[p['encounter_id']] = {
'encounter_id': b64encode(str(p['encounter_id'])),
'spawnpoint_id': p['spawn_point_id'],
'pokemon_id': p['pokemon_data']['pokemon_id'],
'latitude': p['latitude'],
'longitude': p['longitude'],
'disappear_time': d_t
}

if args.webhooks:
wh_update_queue.put(('pokemon', {
# Not in Ignore list
if str(p['pokemon_data']['pokemon_id']) not in args.ignore_list:
pokemons[p['encounter_id']] = {
'encounter_id': b64encode(str(p['encounter_id'])),
'spawnpoint_id': p['spawn_point_id'],
'pokemon_id': p['pokemon_data']['pokemon_id'],
'latitude': p['latitude'],
'longitude': p['longitude'],
'disappear_time': calendar.timegm(d_t.timetuple()),
'last_modified_time': p['last_modified_timestamp_ms'],
'time_until_hidden_ms': p['time_till_hidden_ms']
}))
'disappear_time': d_t
}

if args.webhooks:
wh_update_queue.put(('pokemon', {
'encounter_id': b64encode(str(p['encounter_id'])),
'spawnpoint_id': p['spawn_point_id'],
'pokemon_id': p['pokemon_data']['pokemon_id'],
'latitude': p['latitude'],
'longitude': p['longitude'],
'disappear_time': calendar.timegm(d_t.timetuple()),
'last_modified_time': p['last_modified_timestamp_ms'],
'time_until_hidden_ms': p['time_till_hidden_ms']
}))

for f in cell.get('forts', []):
if config['parse_pokestops'] and f.get('type') == 1: # Pokestops
Expand Down
3 changes: 3 additions & 0 deletions pogom/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ def get_args():
parser.add_argument('-nk', '--no-pokestops',
help='Disables PokeStops from the map (including parsing them into local db)',
action='store_true', default=False)
parser.add_argument('-igl', '--ignore-list',
help='Ignores Pokemon from the map (including parsing them into local db)',
action='append', default=[])
parser.add_argument('-ss', '--spawnpoint-scanning',
help='Use spawnpoint scanning (instead of hex grid). Scans in a circle based on step_limit when on DB', nargs='?', const='nofile', default=False)
parser.add_argument('--dump-spawnpoints', help='dump the spawnpoints from the db to json (only for use with -ss)',
Expand Down

0 comments on commit e07b2b0

Please sign in to comment.