mirror of
https://github.com/placeAtlas/atlas.git
synced 2025-01-01 02:24:40 +01:00
Merge pull request #1183 from Hans5958/fix-recursive-adding
List ids that already been read in a seperate file
This commit is contained in:
commit
4db8e85f23
2 changed files with 7165 additions and 5 deletions
7160
data/read-ids.txt
Normal file
7160
data/read-ids.txt
Normal file
File diff suppressed because it is too large
Load diff
|
@ -7,6 +7,7 @@
|
|||
from formatter import format_all
|
||||
|
||||
outfile = open('temp_atlas.json', 'w', encoding='utf-8')
|
||||
editidsfile = open('read-ids-temp.txt', 'w')
|
||||
failfile = open('manual_atlas.json', 'w', encoding='utf-8')
|
||||
|
||||
with open('credentials', 'r') as file:
|
||||
|
@ -29,13 +30,11 @@
|
|||
print("Warning: No write access. Post flairs will not be updated.")
|
||||
time.sleep(5)
|
||||
|
||||
jsonfile = open("../web/atlas.json", "r", encoding='utf-8')
|
||||
existing = json.load(jsonfile)
|
||||
|
||||
existing_ids = []
|
||||
|
||||
for item in existing:
|
||||
existing_ids.append(item['id'])
|
||||
with open('../data/edit-ids.txt', 'r') as edit_ids_file:
|
||||
for id in [x.strip() for x in edit_ids_file.readlines()]:
|
||||
existing_ids.append(id)
|
||||
|
||||
def set_flair(submission, flair):
|
||||
if has_write_access and submission.link_flair_text != flair:
|
||||
|
@ -116,6 +115,7 @@ def set_flair(submission, flair):
|
|||
"Submission invalid after validation. This may be caused by not enough points on the path."
|
||||
|
||||
outfile.write(json.dumps(submission_json, ensure_ascii=False) + ",\n")
|
||||
editidsfile.write(submission.id + '\n')
|
||||
successcount += 1
|
||||
set_flair(submission, "Processed Entry")
|
||||
|
||||
|
|
Loading…
Reference in a new issue