Add --playback-speed CLI flag for controlling replay speed#266
Open
sh4wnbk wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new CLI flag to control the initial replay speed when launching the viewer, addressing the inability to set playback speed from the command line.
Changes:
- Added
--playback-speedparsing inmain.py - Set default playback speed to
1.0when the flag is omitted
Comment on lines
+138
to
+142
| if "--playback-speed" in sys.argv: | ||
| speed_index = sys.argv.index("--playback-speed") + 1 | ||
| playback_speed = float(sys.argv[speed_index]) | ||
| else: | ||
| playback_speed = 1 | ||
| playback_speed = 1.0 # Default playback speed |
There was a problem hiding this comment.
--playback-speed parsing can crash with IndexError (flag provided without a value) or ValueError (non-numeric value). Consider validating speed_index < len(sys.argv) and wrapping float(...) in try/except to print a helpful message and exit (or fall back to the default). Also consider keeping the default type consistent by using 1.0 throughout (the main() default is currently an int).
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.
Summary
Adds a
--playback-speedCLI flag so users can set the initial replay speed from the command line.Closes #36
Problem
playback_speedwas hardcoded to1inmain.pywith no way to control it via CLI. Users could only change playback speed interactively after the replay launched.Changes
--playback-speedargument parsing inmain.py, consistent with the existing--yearand--roundpatterns1.0if the flag is not providedUsage