PGSS scans raid near by images and identifies Gym,Raid Egg/Boss and time and then updates monocle hydro database. PGSS also works as backend for RealDeviceRaidMap (https://github.com/123FLO321/RealDeviceRaidMap/). Most of gym images are identified automatically.
- Read raid near by sighting images and identify
- gym
- raid boss
- start time
- Parameters to identify gym and raid boss are stored in
gym_imagesandpokemon_imagestable automatically. - Update raids and fort_sightings tables in monocle (Hydro) database
- Download gym(fort) url images and find matching gym automatically. Up to 99% of gyms are detected successfully.
- Discord bot to download user submitted screenshot in your discord server
- MySQL and Postgresql supported.
- Python 3.6
- Tesseract
- Linux/macOS. Never tested on Windows.
- macOS and iOS are required for RealDeviceRaidMap(https://github.com/123FLO321/RealDeviceRaidMap/) to fully automate raids scan.
Read all raid near by screen shot image cropped by crop.py in process_img directory and extract gym/raid boss/hatch time information and update raids and fort_sightings table for monocle Hydro database. If raidnearby.py can't identify the gym then the gym image is stored in unknown_img as FortImage_xxx.png. Once gym is identified, check level and time. If time is Ongoing(Raid), then try to identify raid boss by checking with pokemon_images table. If the raid boss is unknown, then store the raid boss image into non_find_img as PokemonImage_xxx.png.
Read all gym images in unknown_img and identify the gym(fort) image by comparing fort URL images in url_img. If findfort.py finds matching gym(fort) in url_img, then update gym_images table to set identified fort_id. findfort.py checks images every 30 seconds. Fort URL images need to be downloaded by downloadfortimg.py before running findfort.py. If findfort.py can't find matching jpg image in url_img, the gym image stored in not_find_img and you need to submit manually by renaming the image to Fort_fortid.png and run python3.6 manualsubmit.py.
Download all fort URL images in Forts table. Set MAP_START and MAP_END in config.py to limit fort URL images to download if you want.
manualsubmit.py update fort_id in gym_images and pokemon_id in pokemon_images by reading Fort_xxx.png and Pokemon_yyy.png in not_find_img. User need to set xxx for fort_id and yyy for pokedex id manually. This part need to be integrated with Frontend of RealDeviceRaidMap in the future.
Discord bot to download user submitted raid nearby in your discord server. It saves to SCREENSHOT_SAVE_PATH in config.py. To create discord bot, check here https://github.com/reactiflux/discord-irc/wiki/Creating-a-discord-bot-&-getting-a-token
- Copy config.example.py and rename to config.py. Configure config.py based on your setup.
- Run
python3.6 downloadfortimg.pyonce to download all gym(fort) URL images - Run
python3.6 raidscan.pystart raid image scanning. With this command,crop.py,raidnearby.pyandfindfort.pyrun all together. If you run withpython3.6 raidscan.py NO_FINDFORT,findfort.pydosen't run and need to runfindfort.pyseparately. This option is recommanded when you start raid scan in new area and most of gym images are unknown. - If you run
raidscan.pywith NO_FINDFORT option, run open another terminal and activatevenv, then runpython3.6 findfort.py. - Optional. Run
python3.6 rssbot.pyto start downloading user posted screenshot image on your discord server - If PGSS can't find gym then the gym image is saved in
not_find_img. Check the images in the directory and identify the gym. Then rename the image toFort_xxx.pngorPokemon_yyy.png. Then Runpython3.6 manualsubmit.py.manualsubmit.pyupdatesfort_idto xxx inraid_imagesandpokemon_id (Pokedex#)to yyy inpokemon_imagestable.
- Install Python 3.6
- macOS : I downloaded from here https://www.python.org/downloads/release/python-365/ and installed
- Linux (Ubuntu example)
There are many other way to install python3.6. Google it.
apt-get install build-essential sudo add-apt-repository ppa:jonathonf/python-3.6 apt-get update sudo apt-get install python3.6 python3.6-dev wget https://bootstrap.pypa.io/get-pip.py sudo python3.6 get-pip.py
- Install tesseract
- macOS :
brew install tesseract(Install Homebrew if you don't already have it https://brew.sh/) - Linux
apt-get update sudo apt-get install tesseract-ocr
- Create venv
python3.6 -m venv path/to/create/venvexample:python3.6 -m venv ~/venv_pgss - Activate venv
source ~/venv_pgss/bin/activate - Install requirements
pip3.6 install -r requirements.txt -U- If you don't have MySQL on your machine, comment out mysqlclient
- If you don't have Postgresql on your machine, commment out psycopg2 and psycopg2-binary
- Configure config.py to set your monocle database and set discord server setting if you use rssbot.py
- Run
python3.6 downloadfortimg.py. If you don't want to download whole fort images in database, setMAP_STARTandMAP_ENDinconfig.py. - Run
python3.6 raidscan.pyfrom the command line. When first run, raid_images and pokemon_images tables are added automatically. - Note. If you were running crop.bash for Frontend of ReadDevicePokeMap, stop crop.bash before running raidscan.py. raidscan.py itself gets screenshot image and crop with crop.py. Don't worry, PGSS can identify gym images up to 99% of gyms automatically (without user input).
- Run
python3.6 rssbot.pyto start downloading user posted screenshot image on your discord server - Wait until all gyms are identified. Check
success_imgdirectory to make sure all gym images are correctly identified. If pgss can't find matching gym inurl_img, the raid sighting image is stored innot_find_imgand you have to manually assign fort id to the gym image. Rename the gym image to Fort_fortid.png and runpython3.6 manualsubmit.py. PokemonImage_xxx.pngfiles are stored innot_find_imgdirectory. Rename the file toPokemon_PokemonId.png(e.g.Pokemon_380.pngfor Latias) and runpython3.6 manualsubmit.py. This will train pokemon raid boss. Usually only one time training should be enough.- If screenshot image size is not in config.py save the iamge to
not_find_imgasImage_aaaxbbb.pngand you have to configureRAID_NEARBY_SIZE.
When you run raidscan.py, gym_images and pokemon_images tables are automatically created if these tables are not in your database. If for some reason(error), these tables are not created, then you can create manually these tables as follow.
CREATE TABLE gym_images (
id SERIAL NOT NULL,
fort_id INTEGER,
param_1 INTEGER,
param_2 INTEGER,
param_3 INTEGER,
param_4 INTEGER,
param_5 INTEGER,
param_6 INTEGER,
created INTEGER,
PRIMARY KEY (id)
);
CREATE TABLE pokemon_images (
id SERIAL NOT NULL,
pokemon_id INTEGER,
param_1 INTEGER,
param_2 INTEGER,
param_3 INTEGER,
param_4 INTEGER,
param_5 INTEGER,
param_6 INTEGER,
param_7 INTEGER,
created INTEGER,
PRIMARY KEY (id)
);
CREATE TABLE gym_images (
id INTEGER NOT NULL AUTO_INCREMENT,
fort_id INTEGER,
param_1 INTEGER,
param_2 INTEGER,
param_3 INTEGER,
param_4 INTEGER,
param_5 INTEGER,
param_6 INTEGER,
created INTEGER,
PRIMARY KEY (id)
);
CREATE TABLE pokemon_images (
id INTEGER NOT NULL AUTO_INCREMENT,
pokemon_id INTEGER,
param_1 INTEGER,
param_2 INTEGER,
param_3 INTEGER,
param_4 INTEGER,
param_5 INTEGER,
param_6 INTEGER,
param_7 INTEGER,
created INTEGER,
PRIMARY KEY (id)
)