WIP: balloon find/replace
This commit is contained in:
parent
34428bbbe7
commit
0590f52a76
@ -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"
|
||||
|
@ -149,8 +149,17 @@ 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(co_note, ca_note, 'note_type', i_measure,
|
||||
i_branch, i_note, func=normalize_type)
|
||||
# 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,
|
||||
i_branch, i_note, abv=0.1)
|
||||
# NB: Drumroll duration doesn't always end exactly on a
|
||||
@ -167,8 +176,16 @@ 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(co_note, ca_note, 'hits', i_measure,
|
||||
i_branch, 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 co_note.note_type == 'Drumroll':
|
||||
pass
|
||||
else:
|
||||
check(co_note, ca_note, 'hits', i_measure,
|
||||
i_branch, i_note)
|
||||
else:
|
||||
check(co_note, ca_note, 'score_init', i_measure,
|
||||
i_branch, i_note)
|
||||
|
Loading…
Reference in New Issue
Block a user