Refactor validation schemas of plugins where schemas are defined as
class attributes and where no major changes are needed:
- Move validation schemas from class attributes to schema definitions
- Apply minor validation schema adjustments (eg. union_get)
- Use `validate.none_or_all(...)`
- Replace `validate.transform(pattern.search)` with `pattern` and fix
schemas using `validate.regex(pattern)` where a regex has to match
- Move pattern definitions from class attributes to schema definitions
- Fix some patterns in regards to quotation matching
- Fix minor style issues where it makes sense
- use double quotes
- use f-strings
- add trailing commas
- fix indentation
Refactor validation schemas of plugins where schemas are not defined as
class attributes or where no major changes are needed:
- Use `validate.none_or_all(...)`
- Replace `validate.transform(pattern.search)` with `pattern` and fix
schemas using `validate.regex(pattern)` where a regex has to match
- Move pattern definitions from class attributes to schema definitions
- Fix some patterns in regards to quotation matching
- Remove unneeded type validations, like `str` for example
- Remove unneeded `TypeError` exceptions from try-except code blocks
- Fix minor style issues where it makes sense
- use double quotes
- add trailing commas
- fix indentation
This helps avoiding the validation pattern
```py
validate.any(None, validate.all(...))
```
and is useful for `re.Pattern` and `xml_xpath_string` validations,
where the validation result can be `None` and is usually used for
gracefully returning no validation results instead of raising an error.
Use the `search()` method and return `None` or a `re.Match` instance.
This avoids having to explicitly define the validation pattern
```py
validate.transform(re.compile(...).search)
```
In contrast to the `list` instance validation where sequence subsets
get validated, the `ListSchema` validates that the input list has the
same length and that all list items validate successfully according to
the defined schemas.
- Move `is_darwin` from `streamlink_cli.compat` to `streamlink.compat`
- Remove `is_win32` from `streamlink_cli.compat`
- Replace last remaining `unittest.skipIf` test decorators with the
`posix_only`/`windows_only` pytest decorators from the `tests` module
- Remove `is_win32` check when importing from `ctypes` in `named_pipe`
- Remove redundant commands with `.exe` suffixes.
`shutil.which` will pick those up via `PATHEXT` on Windows.
- Move executable lookup to `FFMPEGMuxer.resolve_command`, so its inputs
and return values can be cached using `functools.lru_cache` without
relying on a Streamlink session instance as input
- Keep interface of `FFMPEGMuxer.is_usable` and `FFMPEGMuxer.command`
- Add proper tests
This will make the documentation more clear and informative both on the
rendered webpages and in the manpage as well as the "--help" content.
- On webpages, we will get inline code blocks;
- In the manpage, we will get emphasized words (bold);
- In the help content, we will get words enclosed in single backticks.
This will help us remove reStructuredText markups from the docs.
About "\$A":
"\\$A" has been put into a code block, so the single backslash will be
displayed correctly in the help content. For rendered docs, escaping
backslashes is now no longer required since we did it automatically.
---
A useless non-capturing group has been removed as per the suggestion:
https://github.com/streamlink/streamlink/pull/4659#pullrequestreview-1042428950
Thus,
Co-authored-by: bastimeyer <mail@bastimeyer.de>
There are some lines starting with two or more spaces contain the
options should be links. To achieve it, the following types of lines
should not be processed:
- Starting with two or more spaces followed by a "%(prog)s";
- Starting with two or more spaces followed by a full-length option;
- Starting with an "Example: ".
- Split `streamlink_cli.utils.progress` into `progress` + `terminal`
- `terminal`:
Responsible for calculating character output widths and for writing
data to the output text stream
- `progress`:
Responsible for calculating the download speed and for formatting
the progress output
- Use a separate thread for the progress output, with the output being
written in constant time intervals, independent of the data that gets
fed by the stream iterator of the main thread
- Output format changes:
- Remove "prefix" from output format (full path already gets logged)
- Avoid showing download speeds until a time threshold is reached
- Use binary values for file size and download speed values
- Add leading zeros to time units (only ever grow output text size)
- Don't import from alias module in `streamlink_cli.main`
- Split, move and rewrite tests