1
0
mirror of synced 2024-11-24 05:30:11 +01:00

WIP: balloon find/replace

This commit is contained in:
Viv 2024-10-26 10:36:05 -04:00
parent 34428bbbe7
commit 0590f52a76
2 changed files with 29 additions and 4 deletions

View File

@ -234,12 +234,16 @@ def parse_tja_course_data(data: List[str]) -> Dict[str, List[TJAMeasure]]:
parsed_branches[current_branch][idx_m].notes += note_data[:-1]
parsed_branches[current_branch].append(TJAMeasure())
# Repeat steps for other branches if we only have info for a single branch
# (Note: We replace balloons with drumrolls to avoid reading from BALLOON:
# field extra times)
if add_dummy_notes_to_other_branches:
other_branches = list(set(BRANCH_NAMES) - set([current_branch]))
for branch_name in other_branches:
check_branch_length(parsed_branches, branch_name,
expected_len=idx_m+1)
dummy_data = note_data[:-1]
dummy_data = dummy_data.replace('7', '5') # Balloon -> Drumroll
dummy_data = dummy_data.replace('9', '5') # Kusudama -> Drumroll
parsed_branches[branch_name][idx_m].notes += dummy_data
parsed_branches[branch_name].append(TJAMeasure())
idx_m += 1
@ -247,10 +251,14 @@ def parse_tja_course_data(data: List[str]) -> Dict[str, List[TJAMeasure]]:
else:
parsed_branches[current_branch][idx_m].notes += note_data
# Repeat steps for other branches if we only have info for a single branch
# (Note: We replace balloons with drumrolls to avoid reading from BALLOON:
# field extra times)
if add_dummy_notes_to_other_branches:
other_branches = list(set(BRANCH_NAMES) - set([current_branch]))
for branch_name in other_branches:
dummy_data = note_data
dummy_data = dummy_data.replace('7', '5') # Balloon -> Drumroll
dummy_data = dummy_data.replace('9', '5') # Kusudama -> Drumroll
parsed_branches[branch_name][idx_m].notes += dummy_data
# 2. Parse measure commands that produce an "event"

View File

@ -149,6 +149,15 @@ def test_converted_tja_vs_cached_fumen(id_song, tmp_path, entry_point):
for i_note in range(max([co_branch.length, ca_branch.length])):
co_note = co_branch.notes[i_note]
ca_note = ca_branch.notes[i_note]
# Check for "balloon deduplication" workaround.
# This is a hack I specifically added to account
# for songs where a balloon note occurs on the
# normal branch and gets copied to other branches.
# See PR #80 for more information.
if (ca_note.note_type in ['Balloon', 'Kusudama']
and co_note.note_type == 'Drumroll'):
pass
else:
check(co_note, ca_note, 'note_type', i_measure,
i_branch, i_note, func=normalize_type)
check(co_note, ca_note, 'pos', i_measure,
@ -167,6 +176,14 @@ def test_converted_tja_vs_cached_fumen(id_song, tmp_path, entry_point):
except AssertionError:
pass
if ca_note.note_type in ["Balloon", "Kusudama"]:
# Check for "balloon deduplication" workaround.
# This is a hack I specifically added to account
# for songs where a balloon note occurs on the
# normal branch and gets copied to other branches.
# See PR #80 for more information.
if co_note.note_type == 'Drumroll':
pass
else:
check(co_note, ca_note, 'hits', i_measure,
i_branch, i_note)
else: