Skip to content

Commit 7c818bf

Browse files
authored
Merge pull request #1 from PokemonGoMap/develop
Update to latest dev
2 parents 9940ee8 + 91076c3 commit 7c818bf

File tree

9 files changed

+416
-251
lines changed

9 files changed

+416
-251
lines changed

LICENSE

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,8 +629,8 @@ to attach them to the start of each source file to most effectively
629629
state the exclusion of warranty; and each file should have at least
630630
the "copyright" line and a pointer to where the full notice is found.
631631

632-
<one line to give the program's name and a brief idea of what it does.>
633-
Copyright (C) <year> <name of author>
632+
Live visualization of all the pokemon in your area... and more!
633+
Copyright (C) 2017 PokemonGo-Map Team
634634

635635
This program is free software: you can redistribute it and/or modify
636636
it under the terms of the GNU Affero General Public License as published

config/config.ini.example

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,22 +26,26 @@
2626
#min-seconds-left: # time that must be left on a spawn before considering it too late and skipping it (default 0)
2727
#status-name: # enables writing status updates to the database - if you use multiple processes, each needs a unique value
2828

29-
#Pokemon IV
29+
# Pokemon IV
3030
#encounter: # Set to true to start encounters to pull more info, like IVs or movesets. (default false)
3131
#encounter-delay: # delay in seconds before starting an encounter. Must not be zero. (default 1)
3232
#encounter-whitelist: # whitelist of pokemon ids to encounter. Syntax [id,id,id,id] (Do not use with blacklist)
3333
#encounter-blacklist: # blacklist of pokemon ids to NOT encounter. Syntax [id,id,id,id] (Do not use with whitelist)
3434

3535
# Misc
36-
#gmaps-key: # your Google Maps API key
36+
#gmaps-key: # Your Google Maps API key
3737
#proxy: # Proxy URL e.g. socks5://127.0.0.1:9050 or a list of proxies e.g. [socks5://127.0.0.1:9050,socks5://127.0.0.1:9050]
3838
#proxy-timeout: # Timeout before proceeding with next proxy while checking if the proxy works, (default 5)
3939
#proxy-display: # Used with -ps, full = display complete proxy address. Index = displays just the index for that proxy (default index)
4040
#proxy-file: # Load proxy list from text file (one proxy per line), overrides #proxy
4141
#proxy-refresh: # Period of proxy file reloading, in seconds. Works only with #proxy-file (0 to disable), (default 0)
4242
#proxy-rotation: # Enable proxy rotation with account changing for search threads (none/round/random), (default='none')
43-
#webhook: # webhook URL (including http://)
44-
#webhook-updates-only: # only send updates to webhooks, (excludes gyms & non-lured pokéstops)
43+
#webhook: # Webhook URL e.g. http://127.0.0.1:12345 or a list for multiple webhooks [http://127.0.0.1:1345,http://127.0.0.1:12346]
44+
#webhook-updates-only: # Only send updates to webhooks (excludes gyms & non-lured pokéstops).
45+
#wh-retries: # Number of times to retry sending webhook data on failure (default: 5).
46+
#wh-timeout: # Timeout (in seconds) for webhook requests (default: 2).
47+
#wh-backoff-factor: # Factor (in seconds) by which the delay until next retry will increase (default: 0.25).
48+
#wh-lfu-size: # Webhook LFU cache max size (default: 1000).
4549

4650
# Webserver settings
4751
#host: # address to listen on (default 127.0.0.1)
@@ -52,6 +56,6 @@
5256
#encrypt-lib: # path to encrypt lib to be used instead of the shipped ones
5357
#status-page-password: # enables and protects the /status page to view status of all workers
5458

55-
#Uncomment a line when you want to change its default value (Remove # at the beginning)
56-
#Please ensure to leave a space after the : (example setting: value)
57-
#username, password, location and gmaps-key are required
59+
# Uncomment a line when you want to change its default value (Remove # at the beginning)
60+
# Please ensure to leave a space after the colon (:) (example setting: value)
61+
# Username, password, location and gmaps-key are required

docs/extras/commandline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@
194194
--db-threads DB_THREADS
195195
Number of db threads; increase if the db queue falls
196196
behind [env var: POGOMAP_DB_THREADS]
197-
-wh [WEBHOOKS [WEBHOOKS ...]], --webhook [WEBHOOKS [WEBHOOKS ...]]
197+
-wh [WEBHOOKS [-wh WEBHOOKS ...]], --webhook [WEBHOOKS [--webhook WEBHOOKS ...]]
198198
Define URL(s) to POST webhook information to [env var:
199199
POGOMAP_WEBHOOK]
200200
-gi, --gym-info Get all details about gyms (causes an additional API

pogom/models.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,9 @@ def get_seen(cls, timediff):
242242
@classmethod
243243
def get_appearances(cls, pokemon_id, timediff):
244244
'''
245-
:param pokemon_id: id of pokemon that we need appearances for
245+
:param pokemon_id: id of Pokemon that we need appearances for
246246
:param timediff: limiting period of the selection
247-
:return: list of pokemon appearances over a selected period
247+
:return: list of Pokemon appearances over a selected period
248248
'''
249249
if timediff:
250250
timediff = datetime.utcnow() - timediff
@@ -262,7 +262,7 @@ def get_appearances(cls, pokemon_id, timediff):
262262
@classmethod
263263
def get_appearances_times_by_spawnpoint(cls, pokemon_id, spawnpoint_id, timediff):
264264
'''
265-
:param pokemon_id: id of pokemon that we need appearances times for
265+
:param pokemon_id: id of Pokemon that we need appearances times for
266266
:param spawnpoint_id: spawnpoing id we need appearances times for
267267
:param timediff: limiting period of the selection
268268
:return: list of time appearances over a selected period
@@ -382,7 +382,7 @@ def get_spawnpoints_in_hex(cls, center, steps):
382382
# examples: time shifted
383383
# 0 ( 0 + 2700) = 2700 % 3600 = 2700 (0th minute to 45th minute, 15 minutes prior to appearance as time wraps around the hour.)
384384
# 1800 (1800 + 2700) = 4500 % 3600 = 900 (30th minute, moved to arrive at 15th minute.)
385-
# todo: this DOES NOT ACCOUNT for pokemons that appear sooner and live longer, but you'll _always_ have at least 15 minutes, so it works well enough.
385+
# todo: this DOES NOT ACCOUNT for Pokemon that appear sooner and live longer, but you'll _always_ have at least 15 minutes, so it works well enough.
386386
location['time'] = cls.get_spawn_time(location['time'])
387387

388388
return filtered
@@ -1016,7 +1016,7 @@ class SpawnPoint(BaseModel):
10161016
# for example, a 30 minute spawn is 'hhss'
10171017
kind = CharField(max_length=4, default='hhhs')
10181018

1019-
# links shows whether a pokemon encounter id changes between quartiles or stays the same
1019+
# links shows whether a Pokemon encounter id changes between quartiles or stays the same
10201020
# both 1x45 and 1x60h3 have the kind of 'sssh', but the different links shows when the
10211021
# encounter id changes
10221022
# same encounter id is shared between two quartiles, links shows a '+',
@@ -1031,7 +1031,7 @@ class SpawnPoint(BaseModel):
10311031
missed_count = IntegerField(default=0)
10321032

10331033
# next 2 fields are to narrow down on the valid TTH window
1034-
# seconds after the hour of the latest pokemon seen time within the hour
1034+
# seconds after the hour of the latest Pokemon seen time within the hour
10351035
latest_seen = IntegerField()
10361036

10371037
# seconds after the hour of the earliest time wasn't seen after an appearance
@@ -1275,7 +1275,7 @@ def classify(cls, sp, scan_loc, now_secs, sighting=None):
12751275
# same: whether encounter ID was same or different over that time}
12761276

12771277
# for 60 min spawns ('ssss'), the largest gap doesn't give the earliest spawn point,
1278-
# because a pokemon is always there
1278+
# because a Pokemon is always there
12791279
# use the union of all intervals where the same encounter ID was seen to find the latest_seen
12801280
# If a different encounter ID was seen, then the complement of that interval was the same
12811281
# ID, so union that complement as well
@@ -1444,7 +1444,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
14441444
sp_id_list = []
14451445
now_secs = date_secs(now_date)
14461446

1447-
# consolidate the individual lists in each cell into one list of pokemon and a list of forts
1447+
# consolidate the individual lists in each cell into one list of Pokemon and a list of forts
14481448
cells = map_dict['responses']['GET_MAP_OBJECTS']['map_cells']
14491449
for cell in cells:
14501450
nearby_pokemons += cell.get('nearby_pokemons', [])
@@ -1457,7 +1457,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
14571457
# Check for a 0/0/0 bad scan
14581458
# If we saw nothing and there should be visible forts, it's bad
14591459
if not len(wild_pokemon) and not len(forts) and ScannedLocation.visible_forts(step_location):
1460-
log.warning('Bad scan. Parsing found 0/0/0 pokemons/pokestops/gyms')
1460+
log.warning('Bad scan. Parsing found 0/0/0 Pokemon/pokestops/gyms')
14611461
log.info('Common causes: captchas, IP bans, or using -ng and -nk arguments')
14621462
return {
14631463
'count': 0,
@@ -1467,8 +1467,8 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
14671467
}
14681468

14691469
if not len(nearby_pokemons) and not len(wild_pokemon):
1470-
log.warning('Nothing on nearby_pokemons or wild. Speed violation?')
1471-
log.info("Common causes: not using -speed, deleting or dropping the WorkerStatus table without waiting before restarting, or there really aren't any pokemon in 200m")
1470+
log.warning('No nearby or wild Pokemon. Speed violation?')
1471+
log.info("Common causes: not using -speed, deleting or dropping the WorkerStatus table without waiting before restarting, or there really aren't any Pokemon in 200m")
14721472

14731473
scan_loc = ScannedLocation.get_by_loc(step_location)
14741474
done_already = scan_loc['done']
@@ -1483,7 +1483,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
14831483
.where((Pokemon.disappear_time > datetime.utcnow()) & (Pokemon.encounter_id << encounter_ids))
14841484
.dicts())
14851485

1486-
# Store all encounter_ids and spawnpoint_id for the pokemon in query (all thats needed to make sure its unique).
1486+
# Store all encounter_ids and spawnpoint_id for the Pokemon in query (all thats needed to make sure its unique).
14871487
encountered_pokemon = [(p['encounter_id'], p['spawnpoint_id']) for p in query]
14881488

14891489
for p in wild_pokemon:
@@ -1511,7 +1511,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
15111511
sighting['tth_secs'] = d_t_secs
15121512

15131513
# only update when TTH is seen for the first time
1514-
# just before pokemon migrations, Niantic sets all TTH to the exact time of the migration
1514+
# just before Pokemon migrations, Niantic sets all TTH to the exact time of the migration
15151515
# not the normal despawn time
15161516
sp['latest_seen'] = d_t_secs
15171517
sp['earliest_unseen'] = d_t_secs
@@ -1536,7 +1536,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
15361536
sp['last_scanned'] = datetime.utcfromtimestamp(p['last_modified_timestamp_ms'] / 1000.0)
15371537

15381538
if (b64encode(str(p['encounter_id'])), p['spawn_point_id']) in encountered_pokemon:
1539-
# If pokemon has been encountered before dont process it.
1539+
# If Pokemon has been encountered before don't process it.
15401540
skipped += 1
15411541
continue
15421542

@@ -1642,7 +1642,7 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
16421642
'enabled': f['enabled'],
16431643
'latitude': f['latitude'],
16441644
'longitude': f['longitude'],
1645-
'last_modified': f['last_modified_timestamp_ms'],
1645+
'last_modified_time': f['last_modified_timestamp_ms'],
16461646
'lure_expiration': l_e,
16471647
'active_fort_modifier': active_fort_modifier
16481648
}))
@@ -1691,12 +1691,13 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
16911691
f['last_modified_timestamp_ms'] / 1000.0),
16921692
}
16931693

1694-
log.info('Parsing found %d pokemons, %d pokestops, and %d gyms.',
1694+
log.info('Parsing found %d Pokemon, %d nearby, %d pokestops, and %d gyms.',
16951695
len(pokemons) + skipped,
1696+
len(nearby_pokemons),
16961697
len(pokestops) + stopsskipped,
16971698
len(gyms))
16981699

1699-
log.debug('Skipped %d Pokemons and %d pokestops.', skipped, stopsskipped)
1700+
log.debug('Skipped %d Pokemon and %d pokestops.', skipped, stopsskipped)
17001701

17011702
# look for spawnpoints within scan_loc that are not here to see if can narrow down tth window
17021703
for sp in ScannedLocation.linked_spawn_points(scan_loc['cellid']):
@@ -1709,13 +1710,13 @@ def parse_map(args, map_dict, step_location, db_update_queue, wh_update_queue, a
17091710
if clock_between(endpoints[0], now_secs, endpoints[1]):
17101711
sp['missed_count'] += 1
17111712
spawn_points[sp['id']] = sp
1712-
log.warning('%s kind spawnpoint %s has no pokemon %d times in a row',
1713+
log.warning('%s kind spawnpoint %s has no Pokemon %d times in a row',
17131714
sp['kind'], sp['id'], sp['missed_count'])
17141715
log.info('Possible causes: Still doing initial scan, or super rare double spawnpoint during hidden period, or Niantic has removed spawnpoint')
17151716

17161717
if (not SpawnPoint.tth_found(sp) and scan_loc['done'] and
17171718
(sp['earliest_unseen'] - sp['latest_seen'] - args.spawn_delay) % 3600 < 60):
1718-
log.warning('Spawnpoint %s was unable to locate a TTH, with only %ss after pokemon last seen',
1719+
log.warning('Spawnpoint %s was unable to locate a TTH, with only %ss after Pokemon last seen',
17191720
sp['id'], (sp['earliest_unseen'] - sp['latest_seen']) % 3600)
17201721
log.info('Embiggening search for TTH by 15 minutes to try again')
17211722
if sp['id'] not in sp_id_list:
@@ -1914,7 +1915,7 @@ def clean_db_loop(args):
19141915
.where(Pokestop.lure_expiration < datetime.utcnow()))
19151916
query.execute()
19161917

1917-
# If desired, clear old pokemon spawns.
1918+
# If desired, clear old Pokemon spawns.
19181919
if args.purge_data > 0:
19191920
query = (Pokemon
19201921
.delete()
@@ -2041,7 +2042,7 @@ def database_migrate(db, old_ver):
20412042
db.drop_tables([ScannedLocation])
20422043

20432044
if old_ver < 5:
2044-
# Some pokemon were added before the 595 bug was "fixed".
2045+
# Some Pokemon were added before the 595 bug was "fixed".
20452046
# Clean those up for a better UX.
20462047
query = (Pokemon
20472048
.delete()

0 commit comments

Comments
 (0)