hohav / py-slippi

Python library for parsing SSBM replay files
MIT License
56 stars 25 forks source link

Add support for severed files #39

Closed Grantismo closed 8 hours ago

Grantismo commented 2 years ago

Real world slp files may be severed (if someone yanks a usb stick mid game). We can still parse much of these files even if they don't have metadata. This PR adds support for parsing such files by halting the parse process in the event of parse errors, rather than throwing an exception.

Clients relying on the parse throwing an Exception to validate slp files would instead verify that the game members are populated.

I've included two types of severed test cases from real data. Those where the metadata portion of the slp file is missing and one where the frame data itself is malformed (but the start data is present).

This will also only work for seekable streams.

hohav commented 2 years ago

Sorry for the delay in reviewing. I appreciate the work, but I'm still not convinced py-slippi needs this. Event-based parsing can already handle these, and how often are you getting truncated replays that you still want to work with anyway?