bastimeyer · GitHub

@bastimeyer

Plugin options are currently shared between all plugin instances via the
`Plugin.options` class attribute, unless it gets overridden by
Streamlink's CLI via `setup_plugin_args()` after reading the plugin
arguments, updating the argument parser and reading the default values.
This allows for accidental pollution of the plugin options when not
overriding the `options` class attribute with a new `Options` instance.
Since this is only done by `streamlink_cli`, this is an issue in tests
and third party python projects using the Streamlink API.
- Remove `Plugin.options` class attribute and store an `Options`
  instance on the `Plugin` instance instead, and allow passing an
  already initialized options instance to the `Plugin` constructor
- Turn `Plugin.{g,s}et_option()` from class methods to regular methods
- Update CLI and initialize the resolved plugin with an options instance
  that gets built by `setup_plugin_options()`, with default values read
  from the CLI arguments
- Remove `Streamlink.{g,s}et_plugin_option()` and fix usages:
  - Session and Options tests
  - Twitch plugin, TwitchAPI, TwitchHLSStream, and their tests
- Add `keywords` mapping to `HLSStream.parse_variant_playlist`,
  to be able to pass custom keywords to the `{,Muxed}HLSStream`
- Move and rewrite CLI plugin args+options integration tests

Read the original on github.com ↗