Bug: Entering empty lines when prompted for lyrics results in a crash.
When you write lyrics and at least one of them has no characters in it, the groups list in write::group_by_font is empty and no check is done on its length.
Here is the trace:
Traceback (most recent call last):
File "/home/mosturia/.cache/pypoetry/virtualenvs/beatprints-Mf8WdXFs-py3.13/bin/beatprints", line 6, in <module>
sys.exit(main())
~~~~^^
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/cli/prompt.py", line 269, in main
create_poster()
~~~~~~~~~~~~~^^
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/cli/prompt.py", line 257, in create_poster
ps.track(track, lyrics, accent, theme, code_type, image)
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/BeatPrints/poster.py", line
149, in track
write.text(
~~~~~~~~~~^
draw,
^^^^^
...<5 lines>...
anchor="lt",
^^^^^^^^^^^^
)
^
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/BeatPrints/write.py", line 247, in text
render_singleline(
~~~~~~~~~~~~~~~~~^
draw, (x, y + y_offset), line, color, fonts, size, anchor, align
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/BeatPrints/write.py", line 157, in render_singleline
formatted_text = group_by_font(text, fonts)
File "/home/mosturia/Documents/Repositories/BeatPrintsYTMusic/BeatPrints/write.py", line 122, in group_by_font
merged = [groups[0]]
~~~~~~^^^
IndexError: list index out of range
When does this problem occurs? For which track specifically?
When does this problem occurs? For which track specifically?
It happens for any track that doesn't get detected by lrclib. One example could be "Switch Force Ballad" by Mazedude. Since the lyrics are not detected, in the prompt that asks to paste the lyrics, you can put empty lines, which will cause this crash when drawing the lyrics on the poster.
Perfect! I'll get this added now. The development of the project will kick off after June 10th. This will include other bugs, which will be fixed as well.