diff --git a/scorometer/chroma_case/song_check.py b/scorometer/chroma_case/song_check.py index d533eb2..40d46bb 100644 --- a/scorometer/chroma_case/song_check.py +++ b/scorometer/chroma_case/song_check.py @@ -9,8 +9,12 @@ from mido import MidiFile RATIO = 1.0 -def getPartition(midiFile: str) -> Partition: +def getPartition(midiFile: str, cursors) -> Partition: notes = [] + for cursor in cursors: + for i in cursor["notes"]: + notes += [Key(i["note"], cursor["timestamp"], i["duration"])] + ''' s = 0 notes_on = {} prev_note_on = {} @@ -29,6 +33,7 @@ def getPartition(midiFile: str) -> Partition: note_start = notes_on[d["note"]] notes.append(Key(d["note"], note_start, duration - 10)) notes_on[d["note"]] = s # 500 + ''' return Partition(midiFile, notes) diff --git a/scorometer/main.py b/scorometer/main.py index 0cfcafa..9b89527 100755 --- a/scorometer/main.py +++ b/scorometer/main.py @@ -85,7 +85,9 @@ def send(o): class Scorometer: def __init__(self, mode: int, midiFile: str, song_id: int, user_id: int) -> None: - self.partition: Partition = getPartition(midiFile) + r = requests.get(f"{BACK_URL}/song/{song_id}/assets/cursors", headers=auth_header).json() + cursors = r["cursors"] + self.partition: Partition = getPartition(midiFile, cursors) self.practice_partition: list[list[Key]] = self.getPracticePartition(mode) # the log generated is so long that it's longer than the stderr buffer resulting in a crash # logging.debug({"partition": self.partition.notes})