forked from pokealarm/pokealarm
-
Notifications
You must be signed in to change notification settings - Fork 6
Importing gyms to gym detail cache
Joddie edited this page Jul 12, 2017
·
3 revisions
This script will import a CSV file with gym details into the cache so that RM do not have to keep scanning gyms for PokeAlarm to show gym names in raids.
If you already have gym info, you may skip to step 2
- Use the
-gi
command line flag (gym-info
if you set it in the RM config file) to turn on getting names and details on gyms - Let the gym scanning stay on for an hour or so, to make sure all the raids are in your database.
- You may now turn off gym-info to save requests
- Fire up your SQL command prompt (mysql -u root -p) and run:
SELECT 'gym_id','name','description','url'
UNION ALL
SELECT TO_BASE64(gym_id) as gym_id,name,trim(TRAILING '\n' FROM description) AS description,url FROM gymdetails
INTO outfile 'exported_gyms.csv'
FIELDS TERMINATED BY ';' ENCLOSED BY '\'' LINES TERMINATED BY '\n';
You do now have a neatly exported file of gyms. Do note that the CSV file will not overwrite, and it WILL be saved wherever you run your SQL prompt from.
- Copy your new CSV file (exported_gyms.csv unless you changed the name in the last step) into the PokeAlarm folder.
note the name of your Manager - this makes things a bit easier. Defined in
config.ini
as such:
manager_name: [ MyPokeManager ]
- Execute the script:
python import_gyms.py -n MyPokeManager exported_gyms.csv
- The script will run and tell you how many gyms were imported. The result will be a file namedd
cached_MyPokeManager_gym.pkl
DO NOT DELETE THIS FILE - it is your cache.
You may delete the CSV file.
If you have several managers, you need to copy the cached_manager_gym.pkl
with similar names (WIP)