py-slippi
py-slippi copied to clipboard
Handle in-progress replay length correctly
Fixes #26 by preventing a negative length from being passed to _parse_events
A separate question is to decide what it means if the user passes skip_frames = True
for in-progress replays. Some finished replays can have the raw length equal to 0 too. I think it makes sense to handle these cases gracefully and skip over frame events one-by-one.
In-game streaming was something that I helped implement in the past, funny how these things tend to pop back up.
I have a file that you'll want to test against that runs into a EOF error when parsing, as it's missing its metadata originally which differs from yours and any others I've tested. I wrote a simple Python script that finds the metadata string inside the slippi binary data.
ZIP file containing console replay that'll fail on EOF with your implementation. console_bad.zip
Next time I have free time I'll poke around the driving while loop. If anything, I don't see why the Game class couldn't just be released half-baked and allow the user to discern the Game class if that makes any sense.
Cheers, Abszol