Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a crate that generates replay files for the simulator by pulling data from livetiming.formula1.com/static. Some things to note about the implementation:
inquireto get user input since I don't think there would be a good way to get the info needed from the user through command line arguments, and although there are some things I don't like aboutinquire, overall I think it works well.reqwest's JSON implementation because F1 "illegally" adds a byte order mark at the start of the responses, so that had to be handled separately. This is also why those functions use a custom error enum.get_meetingsreturns a JSON error, the user is told that no races are available for that year. This is because for some reason, when a year with no data (or any invalid path) is requested, it returns an XML response saying "Access Denied" rather than the logical response of something in JSON. So, I interpret a JSON parse error as a year with no races available.generate_raw_replayandgenerate_replayare separated into two different functions to allow for different replay file formats in the future (since the current one isn't very good). I intend to make an improved format after I make some more improvements to the simulator, like play/pause and skipping around.reqwest::blocking, which is synchronous, for two reasons.saverandsimulatorare, but I also think it should get built into other crates. I'm planning to add it to the simulator, and I also think I could get added to something like the api, like in Feature: archive #163.Let me know if you have any questions or suggestions.