pogom icon indicating copy to clipboard operation
pogom copied to clipboard

Displaying Pokestops + LuredPokestops

Open Unknown66 opened this issue 8 years ago • 26 comments

Displaying Pokestops + LuredPokestops. ~~(lure_expiration data only for next 3 minutes available.)~~

Unknown66 avatar Aug 23 '16 22:08 Unknown66

Very nice work! Please merge this!

Korzakov avatar Aug 24 '16 14:08 Korzakov

does this display the lured pokemon from the lured stop?

djv2 avatar Aug 25 '16 03:08 djv2

Tested it! Very good work!

RafaelKaczmarczyk avatar Aug 25 '16 09:08 RafaelKaczmarczyk

@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.

Made123 avatar Aug 29 '16 11:08 Made123

I have try this but is not 100% accure pokèstop lures,but shows all pokèstops,thanks for improvement.

M3G4THEKING avatar Aug 30 '16 15:08 M3G4THEKING

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.

untitled

gatomiaurex avatar Aug 31 '16 09:08 gatomiaurex

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.

smartcuc avatar Aug 31 '16 13:08 smartcuc

Don't know why there's only data for the next 3minutes. There's possibly something wrong with the calculated date inside the db.

Unknown66 avatar Aug 31 '16 18:08 Unknown66

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.

smartcuc avatar Aug 31 '16 20:08 smartcuc

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'}

smartcuc avatar Sep 02 '16 23:09 smartcuc

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

smartcuc avatar Sep 03 '16 12:09 smartcuc

Seems like you got an older version of this one. In current master its not a temp pokemon_id anymore.

Unknown66 avatar Sep 03 '16 18:09 Unknown66

It should display lured pokestops and remaining time as well. Today’s test was successful.

smartcuc avatar Sep 03 '16 20:09 smartcuc

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.

smartcuc avatar Sep 03 '16 21:09 smartcuc

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.

Unknown66 avatar Sep 03 '16 23:09 Unknown66

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)

models.dff.txt

smartcuc avatar Sep 04 '16 09:09 smartcuc

...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.

smartcuc avatar Sep 04 '16 09:09 smartcuc

Is there a way to get and show the picture of the pokestops?

smartcuc avatar Sep 04 '16 09:09 smartcuc

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.

Unknown66 avatar Sep 04 '16 23:09 Unknown66

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!!!!

smartcuc avatar Sep 05 '16 12:09 smartcuc

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:

Unknown66 avatar Sep 05 '16 14:09 Unknown66

@smartcuc can you make a separate PR with your changes? i have yet to getting any working lured pokestop/pokemon working

djv2 avatar Sep 05 '16 16:09 djv2

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..

Unknown66 avatar Sep 06 '16 21:09 Unknown66

#375 fine to use with this to have less traffic. (pokestops need much traffic in citys)

Unknown66 avatar Sep 06 '16 23:09 Unknown66

I dont if someone have the same issue but for only show this http://prntscr.com/cp2ym8 .

M3G4THEKING avatar Oct 02 '16 23:10 M3G4THEKING

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.

Unknown66 avatar Oct 05 '16 02:10 Unknown66