Skip to content

utils.args: update num() argparse utility function #5239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2023

Conversation

bastimeyer
Copy link
Member

  • Replace min and max with ge, gt, le and lt
  • Update and fix params/values of numeric CLI argparser arguments
  • Rewrite num() tests

This rewrite is required for being able to add numeric CLI args which allow a min value of 0. This is currently not possible, as num() is checking for value >= min. Min values of int args were set to -1 because of this, but this doesn't work for float args (there currently are none of that kind, but I'm intending to add one).

  • --player-external-http-port had an incorrect min value, as the default is set to 0
  • --stream-segment-threads is now properly clamped between 1 and 10
  • all int args have their min value set via ge instead of gt

@bastimeyer bastimeyer added the CLI label Mar 11, 2023
@bastimeyer bastimeyer marked this pull request as draft March 11, 2023 21:54
@bastimeyer bastimeyer force-pushed the utils/args/update-num branch from 1ea095b to 1651a69 Compare March 11, 2023 23:19
@bastimeyer bastimeyer marked this pull request as ready for review March 11, 2023 23:19
- Replace `min` and `max` with `ge`, `gt`, `le` and `lt`
- Update and fix params/values of numeric CLI argparser arguments
- Rewrite `num()` tests
@bastimeyer bastimeyer force-pushed the utils/args/update-num branch from 1651a69 to 501ac2b Compare March 11, 2023 23:57
@bastimeyer bastimeyer merged commit 33d9790 into streamlink:master Mar 12, 2023
@bastimeyer bastimeyer deleted the utils/args/update-num branch March 12, 2023 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant