From 6ad26a1b270fdfb8dbff0ac503d485bcfc50a30c Mon Sep 17 00:00:00 2001 From: Hans5958 Date: Thu, 15 Jun 2023 22:49:42 +0700 Subject: [PATCH] Implement per-entry patches 3 --- tools/create_patch.py | 13 +++++++------ tools/merge_out.py | 8 ++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/tools/create_patch.py b/tools/create_patch.py index 8639c076..9e283ef3 100644 --- a/tools/create_patch.py +++ b/tools/create_patch.py @@ -9,7 +9,7 @@ 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 @@ 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 @@ 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.") \ No newline at end of file +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.") \ No newline at end of file diff --git a/tools/merge_out.py b/tools/merge_out.py index a4bd1b36..bbe8b914 100644 --- a/tools/merge_out.py +++ b/tools/merge_out.py @@ -18,16 +18,16 @@ 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