From 104e657a346133c5910610310f8fff03a194aae2 Mon Sep 17 00:00:00 2001 From: Cainan Date: Thu, 27 Jun 2024 12:50:20 +0100 Subject: [PATCH] Add -ura switch for songs which have ura charts --- TaikoWiiUSongTextureTool/generate.py | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/TaikoWiiUSongTextureTool/generate.py b/TaikoWiiUSongTextureTool/generate.py index c4bccf1..0cb9099 100644 --- a/TaikoWiiUSongTextureTool/generate.py +++ b/TaikoWiiUSongTextureTool/generate.py @@ -113,7 +113,7 @@ def generate_image(draw, text, font, rotated_font, size, position, alignment, st else: draw.text(text_position, text, font=font, fill=fill, stroke_width=stroke_width, stroke_fill=stroke_fill) -def create_images(data, id, genreNo, font_path, rotated_font_path): +def create_images(data, id, genreNo, font_path, rotated_font_path, append_ura=False): font_size_extra_large = 46.06875 font_size_large = 40.60875 font_size_medium = 27.3 @@ -154,6 +154,10 @@ def create_images(data, id, genreNo, font_path, rotated_font_path): japanese_text = convert_full_width(japanese_text) japanese_sub_text = convert_full_width(japanese_sub_text) if japanese_sub_text else '' + # Append "─" character if -ura argument is provided + if append_ura: + japanese_text += "─" + # Check if texts were found if not japanese_text: print(f"Error: No Japanese text found for song_{id}") @@ -313,19 +317,24 @@ def create_images(data, id, genreNo, font_path, rotated_font_path): if __name__ == "__main__": - if len(sys.argv) != 3: - print("Usage: generate.py ") + if len(sys.argv) < 3 or len(sys.argv) > 4: + print("Usage: generate.py [-ura]") sys.exit(1) id = sys.argv[1] try: genreNo = int(sys.argv[2]) - if (genreNo < 0 or genreNo >= 8): + if genreNo < 0 or genreNo >= 8: raise ValueError except ValueError: print("Error: genreNo must be an integer between 0 and 7") sys.exit(1) + if len(sys.argv) == 4 and sys.argv[3] == "-ura": + append_ura = True + else: + append_ura = False + wordlist_path = 'resources/wordlist.json' font_path = 'resources/DFPKanTeiRyu-XB.ttf' rotated_font_path = 'resources/KozGoPr6NRegular.otf' @@ -345,4 +354,4 @@ if __name__ == "__main__": with open(wordlist_path, 'r', encoding='utf-8') as f: data = json.load(f) - create_images(data, id, genreNo, font_path, rotated_font_path) + create_images(data, id, genreNo, font_path, rotated_font_path, append_ura) \ No newline at end of file