From 0dcc088bf637d981c280cb71bb3c11263e6ea34f Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Thu, 28 Jul 2016 23:44:47 -0500 Subject: [PATCH 1/6] Update index.html Initial map location automatically updates based on user settings "unique_coordinates" If "unique_coordinates" is set to false the map will initialize on user 0 lat, lng if set to true the map will initialize on "standard_coordinates" --- index.html | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index f0c3ce6..bb0b7ad 100644 --- a/index.html +++ b/index.html @@ -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']; + 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 @@ - \ No newline at end of file + From b5c893dfce12f900ff97891df447f73de5f9c38b Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Fri, 29 Jul 2016 03:06:32 -0500 Subject: [PATCH 2/6] Update usersettings.json --- res/usersettings.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/res/usersettings.json b/res/usersettings.json index b7303be..237ad4d 100644 --- a/res/usersettings.json +++ b/res/usersettings.json @@ -82,4 +82,7 @@ } } ] -} \ No newline at end of file +} + "_comment15": "Set your Pushbullet API key and what pokemon you wish to be notified of here. Format is [1,2,3,76,138]", + "PB_ApiKey": "YOUR_PB_API_KEY", + "Pokemon_to_Push": [0] From c527b1dc71ae989ec43b7e55928b0c112de97a50 Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Fri, 29 Jul 2016 03:10:48 -0500 Subject: [PATCH 3/6] Update main0.py --- main0.py | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/main0.py b/main0.py index aeafd0d..0b976dc 100644 --- a/main0.py +++ b/main0.py @@ -7,6 +7,7 @@ import POGOProtos.Data_pb2 import POGOProtos.Enums_pb2 import POGOProtos.Inventory_pb2 +import POGOProtos.Inventory_pb2 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 +import os.path 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: + pb = Pushbullet(PBKEY) + POKEMONS_PUSH=allsettings['Pokemon_to_Push'] + + + + 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: + 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 From 1b646081e5cac6bcc64610dd87c5a94f9b9b3b87 Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Fri, 29 Jul 2016 03:20:31 -0500 Subject: [PATCH 4/6] Added info for Pushbullet Support --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 395a29f..22680c1 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ * Edit the 'usersettings.json' file in the res subfolder to your liking. Don't worry, if you don't understand every setting, some are for more specific uses. * 'standard_coordinates' and the first 'profile' have to be edited and if you want the map functionality the 'api_key' setting as well * 'pip install -r requirements.txt' or if that fails 'pip install --user -r requirements.txt' +* 'pip install pushbullet.py' to install the pushbullet API +* You will need an API key from https://www.pushbullet.com/#settings +* Make sure to add the Pokemon ID's you want to be notifuied about to the configuration file * 'python main0.py' to run the program * 'python -m SimpleHTTPServer 8000' to run the local map server and make it accessible from your browser From c900d94fcd8c6b62f8637a1734930347356ccb82 Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Fri, 29 Jul 2016 03:51:27 -0500 Subject: [PATCH 5/6] Fixed a typo --- res/usersettings.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/res/usersettings.json b/res/usersettings.json index 237ad4d..411d6b2 100644 --- a/res/usersettings.json +++ b/res/usersettings.json @@ -82,7 +82,9 @@ } } ] -} + "_comment15": "Set your Pushbullet API key and what pokemon you wish to be notified of here. Format is [1,2,3,76,138]", "PB_ApiKey": "YOUR_PB_API_KEY", "Pokemon_to_Push": [0] + +} From 3aa0f4341a1419ca813b224bb98b436a909bbe9b Mon Sep 17 00:00:00 2001 From: shadowsyllvet Date: Fri, 29 Jul 2016 03:59:44 -0500 Subject: [PATCH 6/6] Another typo. I hate commas --- res/usersettings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/res/usersettings.json b/res/usersettings.json index 411d6b2..2450a83 100644 --- a/res/usersettings.json +++ b/res/usersettings.json @@ -81,7 +81,7 @@ "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]", "PB_ApiKey": "YOUR_PB_API_KEY",