mirror of
https://github.com/Yonokid/PyTaiko.git
synced 2026-02-04 11:40:13 +01:00
add basic dan creator
This commit is contained in:
41
dan_creator.py
Normal file
41
dan_creator.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def create_dan(cache_path: Path):
|
||||
dan_data = {}
|
||||
dan_data["title"] = input("Enter the title: ")
|
||||
dan_data["color"] = int(input("Enter the color: "))
|
||||
dan_data["exams"] = []
|
||||
for i in range(3):
|
||||
exam = dict()
|
||||
exam["type"] = input(f"Enter exam type {i+1}: ")
|
||||
exam["red_value"] = int(input(f"Enter exam red value {i+1}: "))
|
||||
exam["gold_value"] = int(input(f"Enter exam gold value {i+1}: "))
|
||||
exam["range"] = input(f"Enter exam range {i+1}: ")
|
||||
exam["value"] = [exam["red_value"], exam["gold_value"]]
|
||||
exam.pop("red_value")
|
||||
exam.pop("gold_value")
|
||||
dan_data["exams"].append(exam)
|
||||
dan_data["charts"] = []
|
||||
for i in range(3):
|
||||
chart = dict()
|
||||
chart_path = input(f"Enter chart path {i+1}: ")
|
||||
with open(f"{cache_path}/path_to_hash.json") as f:
|
||||
hash_directory = json.load(f)
|
||||
chart["hash"] = hash_directory.get(chart_path)
|
||||
with open(f"{cache_path}/song_hashes.json") as f:
|
||||
hash_directory = json.load(f)
|
||||
chart["title"] = hash_directory[chart["hash"]][0]["title"]["en"]
|
||||
chart["subtitle"] = hash_directory[chart["hash"]][0]["subtitle"]["en"]
|
||||
chart["difficulty"] = int(input(f"Enter chart difficulty {i+1}: "))
|
||||
dan_data["charts"].append(chart)
|
||||
with open("dan.json", "w", encoding="utf-8") as f:
|
||||
json.dump(dan_data, f, indent=4, ensure_ascii=False)
|
||||
|
||||
def main():
|
||||
create_dan(Path(sys.argv[1]))
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user