mirror of
https://github.com/cainan-c/TaikoPythonTools.git
synced 2024-11-23 22:51:02 +01:00
Add -ura switch for songs which have ura charts
This commit is contained in:
parent
dbee0bc540
commit
104e657a34
@ -113,7 +113,7 @@ def generate_image(draw, text, font, rotated_font, size, position, alignment, st
|
|||||||
else:
|
else:
|
||||||
draw.text(text_position, text, font=font, fill=fill, stroke_width=stroke_width, stroke_fill=stroke_fill)
|
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_extra_large = 46.06875
|
||||||
font_size_large = 40.60875
|
font_size_large = 40.60875
|
||||||
font_size_medium = 27.3
|
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_text = convert_full_width(japanese_text)
|
||||||
japanese_sub_text = convert_full_width(japanese_sub_text) if japanese_sub_text else ''
|
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
|
# Check if texts were found
|
||||||
if not japanese_text:
|
if not japanese_text:
|
||||||
print(f"Error: No Japanese text found for song_{id}")
|
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 __name__ == "__main__":
|
||||||
if len(sys.argv) != 3:
|
if len(sys.argv) < 3 or len(sys.argv) > 4:
|
||||||
print("Usage: generate.py <id> <genreNo>")
|
print("Usage: generate.py <id> <genreNo> [-ura]")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
id = sys.argv[1]
|
id = sys.argv[1]
|
||||||
try:
|
try:
|
||||||
genreNo = int(sys.argv[2])
|
genreNo = int(sys.argv[2])
|
||||||
if (genreNo < 0 or genreNo >= 8):
|
if genreNo < 0 or genreNo >= 8:
|
||||||
raise ValueError
|
raise ValueError
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Error: genreNo must be an integer between 0 and 7")
|
print("Error: genreNo must be an integer between 0 and 7")
|
||||||
sys.exit(1)
|
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'
|
wordlist_path = 'resources/wordlist.json'
|
||||||
font_path = 'resources/DFPKanTeiRyu-XB.ttf'
|
font_path = 'resources/DFPKanTeiRyu-XB.ttf'
|
||||||
rotated_font_path = 'resources/KozGoPr6NRegular.otf'
|
rotated_font_path = 'resources/KozGoPr6NRegular.otf'
|
||||||
@ -345,4 +354,4 @@ if __name__ == "__main__":
|
|||||||
with open(wordlist_path, 'r', encoding='utf-8') as f:
|
with open(wordlist_path, 'r', encoding='utf-8') as f:
|
||||||
data = json.load(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)
|
Loading…
Reference in New Issue
Block a user