-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update index.html #20
Changes from all commits
0dcc088
b5c893d
c527b1d
1b64608
c900d94
3aa0f43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,9 +166,15 @@ | |
function initSite() { | ||
getFile("res/usersettings.json", false, function(tsettings) { | ||
var settings=JSON.parse(tsettings); | ||
|
||
LAT_C=settings['standard_coordinates']['lat']; | ||
LNG_C=settings['standard_coordinates']['lng']; | ||
var centralized=settings['unique_coordinates']; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to create a new variable here, just use it directly in the next line. |
||
if (centralized==false){ | ||
LAT_C=settings['standard_coordinates']['lat']; | ||
LNG_C=settings['standard_coordinates']['lng']; | ||
} | ||
else{ | ||
LAT_C=settings['profiles']['0']['coordinates']['lat']; | ||
LNG_C=settings['profiles']['0']['coordinates']['lng']; | ||
} | ||
LANGUAGE=settings['language']; | ||
excludeIDs=settings['exclude_ids']; | ||
scalesize = Math.ceil(72*settings['icon_scalefactor']); | ||
|
@@ -189,4 +195,4 @@ | |
</script> | ||
|
||
|
||
</body></html> | ||
</body></html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
import POGOProtos.Data_pb2 | ||
import POGOProtos.Enums_pb2 | ||
import POGOProtos.Inventory_pb2 | ||
import POGOProtos.Inventory_pb2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doubled? :P |
||
import POGOProtos.Map_pb2 | ||
import POGOProtos.Settings_pb2 | ||
import POGOProtos.Networking | ||
|
@@ -15,12 +16,13 @@ | |
import POGOProtos.Networking.Responses_pb2 | ||
import POGOProtos.Networking.Requests | ||
import POGOProtos.Networking.Requests.Messages_pb2 | ||
|
||
import pushbullet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant, since you do the second import below |
||
import os.path | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you import this? It's not used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I took the code from the comments on your reddit page(with some customizing). I assumed it was for the people who installed the PB API directly. |
||
import time | ||
from datetime import datetime | ||
import sys | ||
import math | ||
|
||
from pushbullet import Pushbullet | ||
from s2sphere import CellId, LatLng | ||
from gpsoauth import perform_master_login, perform_oauth | ||
from shutil import move | ||
|
@@ -93,7 +95,7 @@ def getNeighbors(): | |
access_token = None | ||
response = {} | ||
r = None | ||
|
||
pb = None | ||
|
||
SETTINGS_FILE='res/usersettings.json' | ||
|
||
|
@@ -107,7 +109,8 @@ def do_settings(): | |
global HEX_NUM | ||
global interval | ||
global F_LIMIT | ||
|
||
global POKEMONS_PUSH | ||
global pb | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument("-id", "--id", help="worker id") | ||
parser.add_argument("-r", "--range", help="scan range") | ||
|
@@ -205,7 +208,14 @@ def do_settings(): | |
F_LIMIT=int(allsettings['backup_size']*1024*1024) | ||
if F_LIMIT==0: | ||
F_LIMIT=9223372036854775807 | ||
|
||
PBKEY = allsettings['PB_ApiKey'] | ||
if pb is None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need to check, if that's None, since it always is. I only check the command line arguments for that, since they are allowed to overwrite settings. Also I'll add another boolean settings to make pushbullet optional. |
||
pb = Pushbullet(PBKEY) | ||
POKEMONS_PUSH=allsettings['Pokemon_to_Push'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. transform this into a set, they're more efficient with the in operator. |
||
|
||
|
||
|
||
|
||
def prune_data(): | ||
# prune despawned pokemon | ||
cur_time = int(time.time()) | ||
|
@@ -440,7 +450,7 @@ def get_profile(access_token, api, useauth, *reqq): | |
|
||
retry_after=0.26 | ||
while newResponse.status_code not in [1,2,53,102]: #1 for hearbeat, 2 for profile authorization, 53 for api endpoint, 52 for error, 102 session token invalid | ||
print('[-] Response error, status code: {}, retrying in {} seconds'.format(newResponse.status_code,retry_after)) | ||
#print('[-] Response error, status code: {}, retrying in {} seconds'.format(newResponse.status_code,retry_after)) | ||
time.sleep(retry_after) | ||
retry_after=min(retry_after*2,MAXWAIT) | ||
newResponse = api_req(api, access_token, req, useauth = useauth) | ||
|
@@ -630,7 +640,8 @@ def main(): | |
|
||
f.write('{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\t{}\n'.format(pokemons[wild.pokemon_data.pokemon_id],wild.pokemon_data.pokemon_id,spawnIDint,wild.latitude,wild.longitude,(wild.last_modified_timestamp_ms+wild.time_till_hidden_ms)/1000.0-900.0,wild.last_modified_timestamp_ms/1000.0,org_tth/1000.0,wild.encounter_id)) | ||
add_pokemon(wild.pokemon_data.pokemon_id,spawnIDint, wild.latitude, wild.longitude, int((wild.last_modified_timestamp_ms+wild.time_till_hidden_ms)/1000.0)) | ||
|
||
if wild.pokemon_data.pokemon_id in POKEMONS_PUSH: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will only execute, when pushbullet is active. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This works this way because the default is 0 in the config? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I meant to say, that I want it like that. Look at how I changed that in the update. |
||
push = pb.push_link("Pokemon {} found! Timer {}".format(pokemons[wild.pokemon_data.pokemon_id],int(wild.time_till_hidden_ms/1000.0)), 'http://www.google.com/maps/place/{},{}'.format(wild.latitude,wild.longitude)) | ||
if LOGGING: | ||
other = LatLng.from_degrees(wild.latitude, wild.longitude) | ||
diff = other - origin | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,5 +81,10 @@ | |
"alt": 0 | ||
} | ||
} | ||
] | ||
} | ||
], | ||
|
||
"_comment15": "Set your Pushbullet API key and what pokemon you wish to be notified of here. Format is [1,2,3,76,138]", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll shift that above the profiles, nobdy will see it here. |
||
"PB_ApiKey": "YOUR_PB_API_KEY", | ||
"Pokemon_to_Push": [0] | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be added to requirements.txt instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to do that, but I wasn't sure how.