cli.output: path-only --player argument#5310
Merged
bastimeyer merged 6 commits intoJul 2, 2023
Merged
Conversation
adc3afa to
aa7d6cc
Compare
Member
Author
|
Small refactor, added/improved some test cases and added |
e534593 to
1b7d6e1
Compare
- Rewrite in preparation for the following --player CLI argument changes - Resolve player paths via `shutil.which()` - Use `pathlib.Path` (change return type from `str` to `Path` later) - Add tests
- Remove support for custom player arguments from `--player` - Set the `--player` argument's `type` to `pathlib.Path` - Set return type of `find_default_player()` to `pathlib.Path` - Update `--player` and `--player-args` help texts accordingly - Update `PlayerOutput`: - Update constructor signature and add typing information - Rename `cmd` to `path` and remove support for player arguments - Always build list of arguments and remove Windows-specific logic - Properly tokenize player input value in `--player-args` - Log player argv instead of the player command-line string - Fix now unneeded passthrough URL quotation in `streamlink_cli.main` - Update docs and fix argparse docs extension - Update tests and remove Windows-specific player argument tests
- Create dedicated `PlayerArgs` classes for player-specific arguments - Create subclasses with support for VLC, MPV and PotPlayer - Move player detection logic to `playerargsfactory()` classmethod - Fix player executable detection by using regexes with optional file extensions only on Windows - Remove `SUPPORTED_PLAYERS` from `streamlink_cli.constants` and fix references in `streamlink_cli.argparser` - Rewrite and update tests, rename test modules and remove outdated ones
- Resolve player executable before launching it, update argv and raise a `FileNotFoundError` on error - Raise a descriptive `StreamlinkWarning` if the player path starts with a quotation mark - Add and fix tests
1b7d6e1 to
0ce82bc
Compare
Member
Author
|
Rebased to master (#5317) and updated tests |
8 tasks
Member
Author
|
I will add more documentation to the deprecations page once this got merged, among all the other breaking changes. Not sure yet about the Windows installer and its config file. I'll have to figure this out later. A bit sad that nobody bothered to give this branch a try and give feedback. Will merge now anyway... |
This was referenced Jul 2, 2023
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.
Resolves #5305
Breaking change... Opening this as a draft for now, since I'm aiming for the next major version release when py37 support gets dropped in two months.
Please read #5305 for the full details about the motivation of these changes.
Changes
find_default_player()--playerinto a path-only argument and remove support for specifying a whole player command-line with additional arguments. Player arguments now must be set via the--player-argsargument.As a result,
subprocess.Popen()andsubprocess.call()now receive an argv with a properly defined and safe player path with additional player arguments. The player detection also doesn't rely on a weird path basename workaround anymore.--player-args{filename}fallback variable. Only{playerinput}is now supported.PlayerOutput's player detection and the player arguments builder for better code quality and easier extensibility.shutil.which(), so a better error can be raised when the path is incorrect, or when the player path is not executable, or when the single executable name can't be resolved from the system'sPATHenv var. Additionally raise a warning with more info when the player path begins with a single or double quotation mark, as this is now unsupported. Detecting player args in the--playervalue is not possible, so a warning can't be raised for those cases.{playertitleargs}to--player-args, so the order of automatically generated player titles can be customized. By default, player title args come in front of the player args set by the user, so user data can override (if the player supports overriding previous args).More details in the commit message bodies...
Notes
Since custom player arguments now can only be set via--player-args, this makes the addition of player title arguments more strict. Previously it was possible to set arguments in front of the automated player title arguments, but this is not possible anymore because the order is always path -> title-args -> custom-args, where custom-args has support for the{playerinput}variable, so the input argument can be set freely here. I was thinking about adding another variable ({playertitle}) that replaces the title-args segment and that automatically gets added to the--player-argsif it's missing, similar to{playerinput}. Then the player title args can also be set freely, like the player input arg. Thoughts?The updated default player lookup doesn't have tests. I've tested it manually though...PlayerOutputimplementation itself (which I'm still unhappy about)Please give this branch a thorough test. It would be pretty annoying if something was missed in these changes.