Implement per-entry patches 3

This commit is contained in:
Hans5958 2023-06-15 22:49:42 +07:00
parent 1c1662a837
commit 6ad26a1b27
2 changed files with 11 additions and 10 deletions

View File

@ -9,7 +9,7 @@ Path(patches_dir).mkdir(parents=True, exist_ok=True)
entry = None
entry_input = ""
print("Write your submission entry here.")
print("Write/paste your JSON-formatted submission data here.")
while entry is None:
entry_input += input("> ")
@ -18,10 +18,10 @@ while entry is None:
except:
pass
print()
print("Entry received!")
print("Submission is valid!")
print()
print("Enter your username as the attribution to be shown on the about page.")
print("Leave it empty if you don't want to.")
print("Enter your username as the attribution to be shown on the About page.")
print("Leave it empty if you don't want to be attributed.")
print("You can use your Reddit username. Do not include the \"u/\" part.")
print("You can also your GitHub username, but add \"gh:\" before your username (e.g. \"gh:octocat\")")
author = input("Author: ")
@ -29,8 +29,9 @@ author = input("Author: ")
if author:
entry['_author'] = author
filename = f'gh-{secrets.token_hex(2)}-{"-".join(entry["name"].split()).lower()}.json'
with open(f'{patches_dir}gh-{secrets.token_hex(2)}-{"-".join(entry["name"].split()).lower()}.json', 'w', encoding='utf-8') as out_file:
out_file.write(json.dumps(entry, ensure_ascii=False))
print("Patch created!")
print("You can commit this file directory, after that you can push and create a pull request.")
print("Patch created as " + filename + "!")
print("You can commit the created file directly, to which you can push and create a pull request after that.")

View File

@ -18,16 +18,16 @@ with open('../data/read-ids.txt', 'r', encoding='utf-8') as ids_file:
with open('../web/atlas.json', 'r', encoding='utf-8') as atlas_file:
atlas_data = json.loads(atlas_file.read())
# format_all_entries(atlas_file)
# format_all_entries(atlas_data)
# base_image_path = os.path.join('..', 'web', '_img', 'canvas', 'place30')
# ScaleConfig.image1 = os.path.join(base_image_path, '159.png')
# scale_back.swap_source_dest('164', '165', os.path.join(base_image_path, '163_159.png'))
# scale_back.scale_back_entries(atlas_file)
# scale_back.scale_back_entries(atlas_data)
# scale_back.swap_source_dest('165', '166', os.path.join(base_image_path, '164_159.png'))
# scale_back.scale_back_entries(atlas_file)
# scale_back.scale_back_entries(atlas_data)
# scale_back.swap_source_dest('166', '167', os.path.join(base_image_path, '165_159.png'))
# scale_back.scale_back_entries(atlas_file)
# scale_back.scale_back_entries(atlas_data)
last_id = 0