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 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 + 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 diff --git a/res/usersettings.json b/res/usersettings.json index b7303be..2450a83 100644 --- a/res/usersettings.json +++ b/res/usersettings.json @@ -81,5 +81,10 @@ "alt": 0 } } - ] -} \ 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] + +}