1
0
mirror of synced 2024-12-04 19:17:55 +01:00

README + formatting

This commit is contained in:
Stepland 2020-07-18 19:41:00 +02:00
parent 96521a8011
commit 8e47e2d8e1
5 changed files with 26 additions and 16 deletions

View File

@ -14,5 +14,6 @@ jubeatools can handle conversions in the following way :
### Jubeat Analyser
| | input | output |
|----------------------|:-----:|:------:|
| #memo1 | ✔️ | ✔️ |
| #memo | ✔️ | ✔️ |
| mono-column (1列形式) | ✔️ | ✔️ |

View File

@ -253,8 +253,7 @@ class MemoParser(JubeatAnalyserParser):
)
if arrow_to_note_candidates:
solution = pick_correct_long_note_candidates(
arrow_to_note_candidates,
frame.position_part,
arrow_to_note_candidates, frame.position_part,
)
for arrow_pos, note_pos in solution.items():
should_skip.add(arrow_pos)
@ -262,7 +261,9 @@ class MemoParser(JubeatAnalyserParser):
symbol = frame.position_part[note_pos.y][note_pos.x]
symbol_time = currently_defined_symbols[symbol]
note_time = decimal_to_beats(section_starting_beat + symbol_time)
unfinished_longs[note_pos] = UnfinishedLongNote(time=note_time, position=note_pos, tail_tip=arrow_pos)
unfinished_longs[note_pos] = UnfinishedLongNote(
time=note_time, position=note_pos, tail_tip=arrow_pos
)
# 3/3 : find regular notes
for y, x in product(range(4), range(4)):

View File

@ -14,7 +14,6 @@ from path import Path
from sortedcontainers import SortedKeyList
from jubeatools import __version__
from jubeatools.utils import lcm
from jubeatools.formats.filetypes import ChartFile, JubeatFile
from jubeatools.song import (
BeatsTime,
@ -26,6 +25,7 @@ from jubeatools.song import (
TapNote,
Timing,
)
from jubeatools.utils import lcm
from ..command import dump_command
from ..dump_tools import (
@ -49,6 +49,7 @@ AnyNote = Union[TapNote, LongNote, LongNoteEnd]
EMPTY_BEAT_SYMBOL = "" # U+0FF0D : FULLWIDTH HYPHEN-MINUS
EMPTY_POSITION_SYMBOL = "" # U+025A1 : WHITE SQUARE
@dataclass
class Frame:
positions: Dict[NotePosition, str] = field(default_factory=dict)
@ -101,7 +102,7 @@ class Memo1DumpedSection(JubeatAnalyserDumpedSection):
time_in_section = note.time - self.current_beat
bar_index = int(time_in_section)
notes_by_bar[bar_index].append(note)
# Pre-render timing bars
bars: Dict[int, List[str]] = defaultdict(dict)
chosen_symbols: Dict[BeatsTime, str] = {}
@ -115,7 +116,9 @@ class Memo1DumpedSection(JubeatAnalyserDumpedSection):
for note in notes:
time_in_section = note.time - self.current_beat
time_in_bar = time_in_section % Fraction(1)
time_index = time_in_bar.numerator * (bar_length / time_in_bar.denominator)
time_index = time_in_bar.numerator * (
bar_length / time_in_bar.denominator
)
if time_index not in bar_dict:
symbol = next(symbols_iterator)
chosen_symbols[time_in_section] = symbol
@ -123,7 +126,6 @@ class Memo1DumpedSection(JubeatAnalyserDumpedSection):
bar = [bar_dict.get(i, EMPTY_BEAT_SYMBOL) for i in range(bar_length)]
bars[bar_index] = bar
# Create frame by bar
frames_by_bar: Dict[int, List[Frame]] = defaultdict(list)
for bar_index in range(ceil(self.length)):

View File

@ -84,7 +84,7 @@ class Memo1Parser(JubeatAnalyserParser):
def do_memo1(self):
...
do_boogie = do_memo2 = do_memo
def do_bpp(self, value):
@ -179,7 +179,9 @@ class Memo1Parser(JubeatAnalyserParser):
def _iter_frames(
self,
) -> Iterator[Tuple[Mapping[str, BeatsTime], Memo1Frame, Decimal, Memo1LoadedSection]]:
) -> Iterator[
Tuple[Mapping[str, BeatsTime], Memo1Frame, Decimal, Memo1LoadedSection]
]:
"""iterate over tuples of
currently_defined_symbols, frame, section_starting_beat, section"""
local_symbols: Dict[str, Decimal] = {}
@ -190,7 +192,9 @@ class Memo1Parser(JubeatAnalyserParser):
if frame.timing_part:
frame_starting_beat = sum(f.duration for f in section.frames[:i])
local_symbols = {
symbol: BeatsTime(symbol_index, len(bar)) + bar_index + decimal_to_beats(frame_starting_beat)
symbol: BeatsTime(symbol_index, len(bar))
+ bar_index
+ decimal_to_beats(frame_starting_beat)
for bar_index, bar in enumerate(frame.timing_part)
for symbol_index, symbol in enumerate(bar)
if symbol not in EMPTY_BEAT_SYMBOLS
@ -243,8 +247,7 @@ class Memo1Parser(JubeatAnalyserParser):
)
if arrow_to_note_candidates:
solution = pick_correct_long_note_candidates(
arrow_to_note_candidates,
frame.position_part,
arrow_to_note_candidates, frame.position_part,
)
for arrow_pos, note_pos in solution.items():
should_skip.add(arrow_pos)
@ -252,7 +255,9 @@ class Memo1Parser(JubeatAnalyserParser):
symbol = frame.position_part[note_pos.y][note_pos.x]
symbol_time = currently_defined_symbols[symbol]
note_time = decimal_to_beats(section_starting_beat) + symbol_time
unfinished_longs[note_pos] = UnfinishedLongNote(time=note_time, position=note_pos, tail_tip=arrow_pos)
unfinished_longs[note_pos] = UnfinishedLongNote(
time=note_time, position=note_pos, tail_tip=arrow_pos
)
# 3/3 : find regular notes
for y, x in product(range(4), range(4)):

View File

@ -234,8 +234,7 @@ class MonoColumnParser(JubeatAnalyserParser):
)
if arrow_to_note_candidates:
solution = pick_correct_long_note_candidates(
arrow_to_note_candidates,
bloc,
arrow_to_note_candidates, bloc,
)
for arrow_pos, note_pos in solution.items():
should_skip.add(arrow_pos)
@ -243,7 +242,9 @@ class MonoColumnParser(JubeatAnalyserParser):
symbol = bloc[note_pos.y][note_pos.x]
symbol_time = section.symbols[symbol]
note_time = decimal_to_beats(section_starting_beat + symbol_time)
unfinished_longs[note_pos] = UnfinishedLongNote(time=note_time, position=note_pos, tail_tip=arrow_pos)
unfinished_longs[note_pos] = UnfinishedLongNote(
time=note_time, position=note_pos, tail_tip=arrow_pos
)
# 3/3 : find regular notes
for y, x in product(range(4), range(4)):