Added format/scale_back back to merge_out

This commit is contained in:
AnonymousRandomPerson 2023-06-21 00:08:55 -05:00
parent 5992be6391
commit 84f3823e8b
3 changed files with 48 additions and 46 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ temp.*
temp-read-ids.txt
allCharacters.txt
combined.js
data/patches
# Excluded files
*.DS_Store

View File

@ -1,9 +1,8 @@
import json
import os
from aformatter import format_all_entries, per_line_entries
import scale_back
import traceback
import scale_back
from scale_back import ScaleConfig
out_ids = []
@ -19,17 +18,6 @@ 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_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_data)
# scale_back.swap_source_dest('165', '166', os.path.join(base_image_path, '164_159.png'))
# 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_data)
last_id = 0
for i, entry in enumerate(atlas_data):
@ -43,6 +31,9 @@ if not os.path.exists(patches_dir):
print("Patches folder not found. Exiting.")
exit()
base_image_path = os.path.join('..', 'web', '_img', 'canvas', 'place30')
ScaleConfig.image1 = os.path.join(base_image_path, '159.png')
for filename in os.listdir(patches_dir):
f = os.path.join(patches_dir, filename)
@ -53,44 +44,54 @@ for filename in os.listdir(patches_dir):
try:
with open(f, 'r', encoding='utf-8') as entry_file:
entry = json.loads(entry_file.read())
entries = json.loads(entry_file.read())
if not isinstance(entries, list):
entries = [entries]
if '_reddit_id' in entry:
reddit_id = entry['_reddit_id']
if reddit_id in out_ids:
print(f"{filename}: Submission from {entry['id']} has been included! This will be ignored from the merge.")
continue
out_ids.append(reddit_id)
del entry['_reddit_id']
format_all_entries(entries)
# This wouldn't work if it is an edit.
# If needed, we can add a type to the patch to be more foolproof.
# if entry['id'] in out_ids:
# print(f"{filename}: Submission from {entry['id']} has been included! This will be ignored from the merge.")
# continue
scale_back.swap_source_dest('164', '165', os.path.join(base_image_path, '163_159.png'))
scale_back.scale_back_entries(entries)
scale_back.swap_source_dest('165', '166', os.path.join(base_image_path, '164_159.png'))
scale_back.scale_back_entries(entries)
scale_back.swap_source_dest('166', '167', os.path.join(base_image_path, '165_159.png'))
scale_back.scale_back_entries(entries)
for entry in entries:
if '_reddit_id' in entry:
reddit_id = entry['_reddit_id']
if reddit_id in out_ids:
print(f"{filename}: Submission from {entry['id']} has been included! This will be ignored from the merge.")
continue
out_ids.append(reddit_id)
del entry['_reddit_id']
if '_author' in entry:
author = entry['_author']
if author not in authors:
authors.append(author)
del entry['_author']
# This wouldn't work if it is an edit.
# If needed, we can add a type to the patch to be more foolproof.
# if entry['id'] in out_ids:
# print(f"{filename}: Submission from {entry['id']} has been included! This will be ignored from the merge.")
# continue
if entry['id'] is int and entry['id'] < 1:
last_id += 1
print(f"{filename}: Entry is new, assigned ID {last_id}")
entry['id'] = str(last_id)
elif entry['id'] not in out_ids:
out_ids.append(entry['id'])
if '_author' in entry:
author = entry['_author']
if author not in authors:
authors.append(author)
del entry['_author']
if entry['id'] in atlas_ids:
index = atlas_ids[entry['id']]
print(f"{filename}: Edited {atlas_data[index]['id']}.")
atlas_data[index] = entry
else:
print(f"{filename}: Added {entry['id']}.")
atlas_data.append(entry)
if entry['id'] is int and entry['id'] < 1:
last_id += 1
print(f"{filename}: Entry is new, assigned ID {last_id}")
entry['id'] = str(last_id)
elif entry['id'] not in out_ids:
out_ids.append(entry['id'])
os.remove(f)
if entry['id'] in atlas_ids:
index = atlas_ids[entry['id']]
print(f"{filename}: Edited {atlas_data[index]['id']}.")
atlas_data[index] = entry
else:
print(f"{filename}: Added {entry['id']}.")
atlas_data.append(entry)
except:
print(f"{filename}: Something went wrong; patch couldn't be implemented. Skipping.")

View File

@ -2341,7 +2341,7 @@
{"id": "twxs8u", "name": "Asacoco", "description": "Asacoco is a fictional drug created by Kiryu Coco administered through a tail-like device. Kiryu Coco was a former virtual YouTuber and part of Hololive Productions. During her time with the company, she topped the charts as the all-time most super-chatted YouTuber, and she is widely regarded to have transformed the VTuber industry. During her final stream on July 1, 2021, she had nearly half a million live viewers.", "links": {"website": ["https://www.youtube.com/channel/UCS9uQI-jC3DE0L4IpXyvr6w", "https://holocure.fandom.com/wiki/Plug_Type_Asacoco"], "subreddit": ["Hololive"], "discord": ["holofans"]}, "path": {"2-166, T:0-1": [[257, 754], [257, 755], [258, 755], [259, 756], [260, 756], [260, 757], [261, 757], [261, 758], [262, 758], [262, 759], [263, 759], [263, 760], [269, 760], [269, 761], [272, 761], [272, 762], [273, 762], [273, 764], [274, 764], [274, 765], [273, 765], [273, 767], [272, 768], [270, 768], [270, 769], [269, 769], [269, 772], [270, 772], [270, 773], [271, 773], [272, 773], [272, 771], [273, 771], [273, 770], [274, 770], [274, 769], [275, 769], [276, 769], [276, 768], [277, 768], [277, 766], [278, 766], [278, 759], [277, 759], [277, 757], [276, 757], [276, 756], [275, 756], [275, 755], [272, 755], [272, 754], [269, 754], [269, 753], [257, 753]]}, "center": {"2-166, T:0-1": [266, 756]}},
{"id": "twxs49", "name": "Ralsei", "description": "One of the main characters in Deltarune, an indie game created by Toby Fox. He is a fluffy goat prince with magical abilities, and serves as the party healer and resident expert and prince of the Dark World. He can also can lull enemies to sleep by singing lullabies. Everyone likes Ralsei. This art depicts his appearance after taking off his hat at the end of Chapter 1.\n\nSpecial thank you to r/Deltarune for helping us a ton. The in-game sprite is very troublesome because of the weird shading, so that caused a lot of misunderstanding and griefing. Please don't add red eyes to him.", "links": {"website": ["https://deltarune.fandom.com/wiki/Ralsei"], "subreddit": ["ralsei", "Deltarune"]}, "path": {"2-3": [[643, 779], [641, 781], [641, 784], [642, 785], [642, 793], [644, 796], [642, 796], [639, 799], [639, 800], [642, 803], [646, 803], [646, 809], [649, 809], [650, 810], [655, 810], [656, 809], [659, 809], [661, 807], [661, 792], [664, 790], [664, 785], [666, 783], [666, 781], [664, 779], [658, 779], [658, 778], [655, 775], [654, 775], [652, 777], [652, 778], [650, 778], [646, 782], [645, 782], [645, 781]], "4-165, T:0-1": [[677, 780], [677, 784], [679, 786], [679, 787], [678, 788], [678, 793], [679, 794], [679, 795], [680, 796], [680, 797], [677, 797], [675, 799], [675, 800], [677, 802], [683, 802], [683, 806], [682, 807], [683, 808], [684, 808], [685, 809], [688, 809], [688, 811], [687, 811], [685, 813], [685, 814], [687, 816], [691, 816], [694, 813], [694, 808], [695, 807], [699, 807], [700, 808], [702, 808], [707, 803], [707, 801], [705, 799], [703, 799], [700, 802], [699, 801], [699, 800], [696, 797], [696, 796], [697, 795], [700, 795], [701, 794], [705, 791], [705, 785], [701, 785], [701, 787], [697, 790], [695, 790], [695, 786], [700, 783], [700, 780], [696, 780], [696, 781], [693, 781], [693, 780], [691, 777], [690, 776], [689, 777], [689, 779], [685, 779], [681, 783], [680, 783], [678, 780]]}, "center": {"2-3": [651, 790], "4-165, T:0-1": [687, 791]}},
{"id": "twxs1g", "name": "Welsh sheep", "description": "Trail of Welsh sheep featuring flags such as Eqypt (an r/place neighbour and ally) and Ukraine, as well as LGBT pride sheep such as a rainbow sheep.", "links": {"website": ["https://en.wikipedia.org/wiki/Welsh_Mountain_sheep"], "subreddit": ["Wales"]}, "path": {"142-165, T:0-1": [[5, 136], [0, 136], [0, 93], [43, 94], [44, 130], [51, 130], [53, 133], [57, 134], [57, 136], [40, 137], [39, 98], [5, 98], [5, 132], [39, 132], [39, 137], [0, 136], [1, 136], [0, 136]]}, "center": {"142-165, T:0-1": [44, 133]}},
{"id": "twxrl1", "name": "Clustertruck Speedrunning", "description": "A truck from the game Clustertruck by Landfall Games. It was made in collaboration with the TeosGame community to represent the speedrunning community of Clustertruck.", "links": {"website": ["https://www.speedrun.com/Clustertruck"]}, "path": {"109-165, T:0-1": [[1100, 1033], [1100, 1030], [1101, 1030], [1101, 1026], [1108, 1019], [1115, 1019], [1115, 1027], [1114, 1027], [1114, 1030], [1112, 1030], [1112, 1032], [1108, 1032], [1108, 1034], [1100, 1034]]}, "center": {"109-165, T:0-1": [1108, 1027]}},
{"id": "twxrl1", "name": "Clustertruck", "description": "Clustertruck is a game made by Landfall Games.\n\nThis art was made in collaboration with the TeosGame community to represent the speedrunning community of Clustertruck.", "links": {"website": ["https://www.speedrun.com/Clustertruck", "https://www.clustertruck.com/", "https://en.wikipedia.org/wiki/Clustertruck"]}, "path": {"113-165, T:0-1": [[1100, 1033], [1100, 1030], [1101, 1030], [1101, 1026], [1108, 1019], [1115, 1019], [1115, 1027], [1114, 1027], [1114, 1030], [1112, 1030], [1112, 1032], [1108, 1032], [1108, 1034], [1100, 1034]]}, "center": {"113-165, T:0-1": [1108, 1027]}},
{"id": "twxreq", "name": "Factorio Locomotive", "description": "A blue-dyed locomotive from the videogame Factorio. This project on r/place was meant to incorperate several communities in cargo wagons but was limited due to space. The front of the locomotive is also cropped because a streamer expanded Mexico.", "links": {"website": ["https://www.factorio.com/"], "subreddit": ["factorio"], "discord": ["factorio"]}, "path": {"109-166, T:0-1": [[554, 1187], [522, 1187], [522, 1186], [510, 1186], [510, 1187], [504, 1187], [504, 1203], [509, 1203], [509, 1209], [554, 1209]]}, "center": {"109-166, T:0-1": [529, 1198]}},
{"id": "twxrdg", "name": "Gail Phoenotopia", "description": "The protagonist of the game Phoenotopia: Awakening.", "links": {"website": ["https://phoenotopia.com"], "subreddit": ["phoenotopia"]}, "path": {"116-117": [[1228, 1266], [1230, 1268], [1236, 1268], [1238, 1266], [1238, 1263], [1233, 1258], [1230, 1258], [1230, 1261], [1228, 1263]], "121-164, T:0-1": [[1874, 1235], [1875, 1235], [1876, 1236], [1879, 1239], [1879, 1242], [1878, 1243], [1880, 1246], [1878, 1246], [1878, 1247], [1876, 1249], [1875, 1248], [1874, 1249], [1873, 1248], [1872, 1247], [1870, 1246], [1872, 1244], [1872, 1242], [1871, 1242], [1871, 1240], [1871, 1239], [1873, 1237], [1876, 1237], [1874, 1237], [1875, 1237], [1874, 1237], [1875, 1237]]}, "center": {"116-117": [1233, 1264], "121-164, T:0-1": [1875, 1241]}},
{"id": "twxrbk", "name": "Squirtle Squad", "description": "A sprite of the Pokémon Squirtle from Pokémon Mystery Dungeon: Red/Blue Rescue Team, placed by a private friend group who uses it as a Discord server icon.", "links": {"website": ["https://bulbapedia.bulbagarden.net/wiki/Squirtle_(Pok%C3%A9mon)"]}, "path": {"109-166, T:0-1": [[1714, 1439], [1705, 1439], [1704, 1447], [1703, 1447], [1703, 1449], [1705, 1450], [1717, 1450], [1716, 1449], [1715, 1448], [1716, 1447], [1716, 1443], [1715, 1442], [1714, 1440]]}, "center": {"109-166, T:0-1": [1710, 1445]}},