pogom
pogom copied to clipboard
Displaying Pokestops + LuredPokestops
Displaying Pokestops + LuredPokestops. ~~(lure_expiration data only for next 3 minutes available.)~~
Very nice work! Please merge this!
does this display the lured pokemon from the lured stop?
Tested it! Very good work!
@Unknown66 Why does the lure expiration time shows only the next 3 minutes and not his final time expiration ?
And i can see that the lures pokemons are not shown.
I have try this but is not 100% accure pokèstop lures,but shows all pokèstops,thanks for improvement.
Using this breaks the ability to hide pokemons, it breaks the box to type the name and the ability to click on them and hide them manually.
This is also missing a switch to show only lured pokestops.
Well, by using the last version with db-support, lured PS are only shown for 2-3 minute. @gatomiaurex : display is working on all browsers I have tested. Maybe you meshed something up.
Don't know why there's only data for the next 3minutes. There's possibly something wrong with the calculated date inside the db.
Could it be that there is something wrong in the models.py (line 172 - 193)? Once the pokestop has been seen in lure, within the next scan cycle 'lure_expiration' is set to NULL in the db as well as active_pokemon_id. Either setting l_e and a_p_ip to NULL or the math could be a problem.
| last_modified | lure_expiration | active_pokemon_id | +---------------------+---------------------+-------------------+ | 2016-08-31 19:31:06 | 2016-08-31 19:34:06 | 21 | +---------------------+---------------------+-------------------+
8 minutes later: | 2016-08-31 19:31:06 | 2016-08-31 19:40:06 | 10 |
8 minutes later: | 2016-08-31 19:31:06 | 2016-08-31 19:49:06 | 13 |
5 minutes later: | 2016-08-31 19:31:06 | 2016-08-31 19:52:06 | 16 |
4 minutes later: | 2016-08-31 19:31:06 | 2016-08-31 19:55:06 | 13 |
lure_expiration and active_pokemon_id are NULL between they show up again.
Ok. @Unknown66: Your code seems to be right. The issue is in models.py (lines 177, 179 and 180 ). lure_info is not everytime part of f. So, 'active_fort_modifier' would be a better indicator for lure state or not.
2016-09-03 01:40:56,252 [ models] [INFO] {'last_modified_timestamp_ms': 1472858303738L, 'enabled': True, 'longitude': 6.988225, 'active_fort_modifier': [501], 'latitude': 50.815297, 'type': 1, 'id': u'ea54118027fb460ab6217c20dcf405bf.16'}
Got it, at least a quick fix:
pogom/models.py:
line 9:
from datetime import datetime timedelta
line 176:
if f.get('type') == 1: # Pokestops
if 'active_fort_modifier' in f:
lure_expiration = datetime.utcfromtimestamp(
f['last_modified_timestamp_ms'] / 1000.0) + timedelta(minutes=30)
active_pokemon_id = 21 # Jut temp. Need more investigation.
else:
lure_expiration, active_pokemon_id = None, None
Seems like you got an older version of this one. In current master its not a temp pokemon_id anymore.
It should display lured pokestops and remaining time as well. Today’s test was successful.
Got it. When you want to catch the lured pokemons, add an if / else with new fields beginning at line 180 with your if 'lure_info' in f: code. Best would be to extend or a new the base model for this.
We've only got to return pokemon inside model.py if pokestop is lured. Then it should work. Therefor another query inside Pokemon.get_active should be enough.
Here we go with a diff. It displays on the map:
- Pokestops
- Lured Pokestops with remaining
- Lured Pokémons with remaining time (always ~3 minutes)
...and the models.py renamed to .txt for upload.... models.py.txt
Before it gets lost: There maybe is the need to add the on or other meter / inch to the lured pokemon to avoid overlap with a second lured pokemon.
Is there a way to get and show the picture of the pokestops?
Mhh dont know if: + timedelta(minutes=30)
is a good idea.
If you scan a lured pokestop lets say 5min before deactivation you would think it remains for about 30min.
And another thought. pokemons['encounter_id']
should be pokemons[f['lure_info']['encounter_id']]
else you would only overwrite the entry 'encounter_ID' inside the dict.
Please correct me if I missed something.
Well, maybe I'm wrong, but my understanding is that 'last_modified_timestamp_ms' is the time, when the pokestop has been switched into lure mode. Lure expiration should be 30 minutes later. Even when the scan is detecting the lured pokestop 5min before deactivation, the timestamp is still valid and lure will expire in 5min.
Updated pokemons['encounter_id'] to pokemons[f['lure_info']['encounter_id']] .
Many thanks!!!!
Checked it. You're right last_modified_timestamp_ms
is the the time from lure!
And lure_expiration
seems to be the time when the pokemon is gone. (But its only 3min in the future and sometimes the pokemon_id don't change)
Will change my code this evening! Thanks for your help :+1:
@smartcuc can you make a separate PR with your changes? i have yet to getting any working lured pokestop/pokemon working
The other lines are wrong.
The wrong behaviour came from static/app.py
line 173:
if request.args.get('pokestops', 'false') == 'true':
Forgot the write this yesterday..
#375 fine to use with this to have less traffic. (pokestops need much traffic in citys)
I dont if someone have the same issue but for only show this http://prntscr.com/cp2ym8 .
That is normal! The 2nd line is the unique ID of the pokestop (real name would issue another API Call). The third line tells you the time when the lure module ends.