mirror of
https://github.com/placeAtlas/atlas.git
synced 2024-12-29 09:04:37 +01:00
Tidy up tools folder 2 (and update)
This commit is contained in:
parent
d95a02d849
commit
d6d110e28c
11 changed files with 45 additions and 25 deletions
|
@ -3,7 +3,7 @@
|
|||
import sys
|
||||
import json
|
||||
|
||||
path = "./../web/atlas.json"
|
||||
path = "./../../web/atlas.json"
|
||||
|
||||
# path override as 1st param: validate_json.py path_to_file.json
|
||||
if (len(sys.argv) > 1):
|
|
@ -1,6 +1,6 @@
|
|||
import json
|
||||
import os
|
||||
import formatter
|
||||
from aformatter import format_all_entries, per_line_entries
|
||||
import scale_back
|
||||
|
||||
from scale_back import ScaleConfig
|
||||
|
@ -10,7 +10,7 @@
|
|||
with open(merge_source_file, 'r', encoding='UTF-8') as f1:
|
||||
out_json = json.loads(f1.read())
|
||||
|
||||
formatter.format_all_entries(out_json)
|
||||
format_all_entries.format_all_entries(out_json)
|
||||
|
||||
base_image_path = os.path.join('..', 'web', '_img', 'canvas', 'place30')
|
||||
ScaleConfig.image1 = os.path.join(base_image_path, '159.png')
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
print('Writing...')
|
||||
with open('../web/atlas.json', 'w', encoding='utf-8') as atlas_file:
|
||||
atlas_file.write(formatter.per_line_entries(atlas_json))
|
||||
atlas_file.write(per_line_entries(atlas_json))
|
||||
|
||||
with open('../data/read-ids.txt', 'a', encoding='utf-8') as read_ids_file:
|
||||
with open('temp-read-ids.txt', 'r+', encoding='utf-8') as read_ids_temp_file:
|
||||
|
|
|
@ -1,6 +1,25 @@
|
|||
# Script to retroactively fix flairs
|
||||
# Only touches things flaired "New entry" that either fail JSON parsing or are already in the Atlas
|
||||
# Otherwise, it leaves them untouched
|
||||
"""
|
||||
Script to retroactively fix flairs
|
||||
Only touches things flaired "New entry" that either fail JSON parsing or are already in the Atlas
|
||||
Otherwise, it leaves them untouched
|
||||
|
||||
Setting up authentication:
|
||||
1. Head to https://www.reddit.com/prefs/apps
|
||||
2. Click "are you a developer? create an app..." on the button
|
||||
3. Enter the name and description
|
||||
4. Select "script" for the type
|
||||
5. Enter "redirect uri" as "http://localhost:8080"
|
||||
6. Create file "credentials" with the format below
|
||||
┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ [id] <- Under "personal use script" │
|
||||
│ [secret] │
|
||||
│ [username] <- For flair access, must be a mod, Don't do this... │
|
||||
│ [password] <- ...if you don't know what you are doing. │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Running:
|
||||
1. Run the script
|
||||
"""
|
||||
|
||||
import praw
|
||||
import json
|
||||
|
@ -42,7 +61,7 @@ def set_flair(submission, flair):
|
|||
total_all_flairs = 0
|
||||
rejected_count = 0
|
||||
processed_count = 0
|
||||
#for submission in reddit.subreddit('placeAtlas2').new(limit=1000):
|
||||
for submission in reddit.subreddit('placeAtlas2').new(limit=1000):
|
||||
#for submission in reddit.subreddit('placeAtlas2').search('flair:"New Entry"',limit=1000,syntax='lucene', sort="top"):
|
||||
#for submission in reddit.subreddit('placeAtlas2').search('flair:"New Entry"',limit=1000,syntax='lucene', sort="comments"):
|
||||
#for submission in reddit.subreddit('placeAtlas2').search('flair:"New Entry"',limit=1000,syntax='lucene', sort="hot"):
|
|
@ -1,23 +1,23 @@
|
|||
"""
|
||||
Auth setup
|
||||
Setting up authentication:
|
||||
1. Head to https://www.reddit.com/prefs/apps
|
||||
2. Click "create another app"
|
||||
3. Give it a name and description
|
||||
4. Select "script"
|
||||
5. Redirect to http://localhost:8080
|
||||
2. Click "are you a developer? create an app..." on the button
|
||||
3. Enter the name and description
|
||||
4. Select "script" for the type
|
||||
5. Enter "redirect uri" as "http://localhost:8080"
|
||||
6. Create file "credentials" with the format below
|
||||
┌─────────────────────────────────────────────────────┐
|
||||
│ [ID] <- Under "personal use script" │
|
||||
│ [Secret] │
|
||||
│ [Username] <- Must be a mod, don't do this if you │
|
||||
│ [Password] <- don't know what you are doing. │
|
||||
└─────────────────────────────────────────────────────┘
|
||||
7. Run Script
|
||||
┌──────────────────────────────────────────────────────────────────────────────┐
|
||||
│ [id] <- Under "personal use script" │
|
||||
│ [secret] │
|
||||
│ [username] <- For flair access, must be a mod, Don't do this... │
|
||||
│ [password] <- ...if you don't know what you are doing. │
|
||||
└──────────────────────────────────────────────────────────────────────────────┘
|
||||
|
||||
Running Script
|
||||
1. Input the next ID to use
|
||||
2. Manually resolve errors in temp-atlas-manual.json
|
||||
3 a. Use merge_out.py, or...
|
||||
Running:
|
||||
1. Run the script
|
||||
2. Input the next ID to use
|
||||
3. Manually resolve errors in temp-atlas-manual.json
|
||||
4 a. Use merge_out.py, or...
|
||||
b. a. Copy temp-atlas.json entries into web/_js/atlas.js (mind the edits!)
|
||||
b. Copy temp-read-ids.txt IDs into data/read-ids.txt
|
||||
5. Create a pull request
|
||||
|
@ -28,7 +28,7 @@
|
|||
import time
|
||||
import re
|
||||
import traceback
|
||||
from formatter import format_all, validate
|
||||
from aformatter import format_all, validate
|
||||
|
||||
with open('temp-atlas.json', 'w', encoding='utf-8') as OUT_FILE, open('temp-read-ids.txt', 'w') as READ_IDS_FILE, open('temp-atlas-manual.txt', 'w', encoding='utf-8') as FAIL_FILE:
|
||||
|
||||
|
|
1
tools/requirements.txt
Normal file
1
tools/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
praw
|
Loading…
Reference in a new issue