1
0
mirror of synced 2024-12-18 05:45:51 +01:00

Fix error when metadata fields have numbers in them (e.g. NOTESDESIGNER0) (#61)

Simple fix -- regex for metadata didn't include numbers, but does now.

Fixes #60.
This commit is contained in:
Viv 2023-08-05 11:00:28 -04:00 committed by GitHub
parent b4fb3ba739
commit 018d09d34c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 1 deletions

View File

@ -83,7 +83,7 @@ def split_tja_lines_into_courses(lines: list[str]) -> TJASong:
current_course_basename = '' current_course_basename = ''
for line in lines: for line in lines:
# Only metadata and #START commands are relevant for this function # Only metadata and #START commands are relevant for this function
match_metadata = re.match(r"^([A-Z]+):(.*)", line) match_metadata = re.match(r"^([A-Z0-9]+):(.*)", line)
match_start = re.match(r"^#START(?:\s+(.+))?", line) match_start = re.match(r"^#START(?:\s+(.+))?", line)
# Case 1: Metadata lines # Case 1: Metadata lines

View File

@ -0,0 +1,63 @@
// This song contains all unsupported metadata/commands.
TITLE:Test
TITLEJA:テスト
TITLEEN:Test
SUBTITLE:Test
SUBTITLEJA:テスト
SUBTITLEEN:Test
BPM:120
OFFSET:-1.00
DEMOSTART:1.00
GENRE:J-POP
SCOREMODE:1
WAVE:Test.ogg
MAKER:Test <https://example.com>
LYRICS:Test.vtt
SONGVOL:100
SEVOL:100
SIDE:1
LIFE:0
GAME:Taiko
HEADSCROLL:1
BGIMAGE:Test.png
BGMOVIE:Test.avi
MOVIEOFFSET:1.00
PREIMAGE:Test.png
TAIKOWEBSKIN:dir ../song_skins,name miku,song static,stage none,don fastscroll
COURSE:Oni
LEVEL:10
BALLOON:8,8
SCOREINIT:400
SCOREDIFF:100
BALLOONNOR:8,8
BALLOONEXP:10,10
BALLOONMAS:12,12
EXAM1:g,98,100,m
EXAM2:jp,1000,1150,m
EXAM3:jb,10,5,l
GAUGEINCR:Normal
TOTAL:200
HIDDENBRANCH:1
NOTESDESIGNER4:Test
NOTESDESIGNER3:Test
NOTESDESIGNER2:Test
NOTESDESIGNER1:Test
NOTESDESIGNER0:Test
#BMSCROLL
#HBSCROLL
#START
#SENOTECHANGE 3
1020304,
#LYRIC Test lyric
5000008,
#DIRECTION 2
6000008,
#SUDDEN 2 1
7000008,
#JPOSSCROLL 2 760 1
9000008,
#END
#NEXTSONG GO!GO!明るい社会,うるまでるび,バラエティ,GO!GO!明るい社会.ogg,560,160

View File

@ -9,6 +9,7 @@ from conftest import convert
@pytest.mark.parametrize('id_song,err_msg', [ @pytest.mark.parametrize('id_song,err_msg', [
['basic_song', None], ['basic_song', None],
['basic_song_2P', None], ['basic_song_2P', None],
['unsupported', None],
['notes_double_kusudama', None], ['notes_double_kusudama', None],
['notes_hands', None], ['notes_hands', None],
['notes_sim_only', None], ['notes_sim_only', None],