llllllllll / slider

Utilities for working with osu! files and data
https://llllllllll.github.io/slider/index.html
GNU Lesser General Public License v3.0
39 stars 17 forks source link

aleph naught (aspire map) fails to parse #83

Open tybug opened 3 years ago

tybug commented 3 years ago
from slider import *
library = Library(".")
beatmap = library.lookup_by_id(1680610, download=True)

fails with

Traceback (most recent call last):
  File "/Users/tybug/Desktop/coding/osu/slider/slider/library.py", line 256, in lookup_by_id
    return self._read_beatmap(self, beatmap_id=beatmap_id)
  File "/Users/tybug/Desktop/coding/osu/slider/slider/library.py", line 224, in _raw_read_beatmap
    raise KeyError(key)
KeyError: 1680610

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/tybug/Desktop/coding/sandbox/__circleguard.py", line 11, in <module>
    beatmap = library.lookup_by_id(1680610, download=True)
  File "/Users/tybug/Desktop/coding/osu/slider/slider/library.py", line 260, in lookup_by_id
    return self.download(beatmap_id, save=save)
  File "/Users/tybug/Desktop/coding/osu/slider/slider/library.py", line 408, in download
    beatmap = Beatmap.parse(data.decode('utf-8-sig'))
  File "/Users/tybug/Desktop/coding/osu/slider/slider/beatmap.py", line 2102, in parse
    groups['HitObjects'],
  File "/Users/tybug/Desktop/coding/osu/slider/slider/beatmap.py", line 390, in parse
    return parse(Position(x, y), time, hitsound, rest)
  File "/Users/tybug/Desktop/coding/osu/slider/slider/beatmap.py", line 698, in _parse
    duration = timedelta(milliseconds=int(num_beats * ms_per_beat))
OverflowError: Python int too large to convert to C int

I'm sure this is a case of aspire beatmaps using non-sane values for various things. Not sure what the best way to handle this is, though I think we could cap the duration to MAX_INT for this particular case.

llllllllll commented 3 years ago

Wow, this map is crazy. I don't think we should just truncate, because the map definitely doesn't take forever to run so we shouldn't model it that way. I don't have time to look into the actual error right now, but I would see what actual slider it dies on and try to see what osu! does on this slider. Off the top of my head, I would look to see if any timing points give a negative bpm, our code might not handle this correctly since that doesn't really make sense normally.