- Raise `StreamlinkDeprecationWarning` when `is_global=True`
- Remove all global plugin arguments and replace them with simple
option lookups on the Streamlink session instance
- Remove global argument detection in custom Sphinx plugins extension
- Remove supported plugins list from custom Sphinx argparse extension
and remove respective setup from `setup_plugin_args` in the CLI module
- Add deprecation note to the docs
- Update tests
- Check whether builtin plugins define global plugin arguments
- Capture deprecation warnings
This changes the way how the Streamlink session and other objects like
the plugin cache and logger are stored on each plugin.
Previously, those objects were set as class attributes on every `Plugin`
class via `Plugin.bind()` when loading plugins via the session's
`load_plugins()` method that gets called on initialization.
This meant that whenever a new Streamlink session was initialized,
references to it (including a dict of every loaded plugin) were set
on each `Plugin` class as a class attribute, and Python's garbage
collector could not get rid of this memory when deleting the session
instance that was created last.
Removing `Plugin.bind()`, passing the session via the `Plugin.__init__`
constructor, and setting the cache, logger, etc. on `Plugin` instances
instead (only one gets initialized by `streamlink_cli`), removes those
static references that prevent the garbage collector to work.
Since the plugin "module" name now doesn't get set via `Plugin.bind()`
anymore, it derives its name via `self.__class__.__module__` on its own,
which means a change of the return type of `Streamlink.resolve_url()`
is necessary in order to pass the plugin name to `streamlink_cli`,
so that it can load config files and initialize plugin arguments, etc.
Breaking changes:
- Remove `Plugin.bind()`
- Pass the `session` instance via the Plugin constructor and set the
`module`, `cache` and `logger` on the plugin instance instead.
Derive `module` from the actual module name.
- Change the return type of `Session.resolve_url()` and include the
resolved plugin name in the returned tuple
Other changes:
- Remove `pluginclass.bind()` call from `Session.load_plugins()` and
use the loader's module name directly on the `Session.plugins` dict
- Remove initialization check from `Plugin` cookie methods
- Update streamlink_cli.main module according to breaking changes
- Update tests respectively
- Add explicit plugin initialization test
- Update tests with plugin constructors and custom plugin names
- Move testplugin override module, so that it shares the same module
name as the main testplugin module. Rel `Session.load_plugins()`
- Refactor most session tests and replace unneeded `resolve_url()`
wrappers in favor of calling `session.streams()`
- Use a custom mapping of parent->child argument group relations
instead of calling `group.add_argument_group()` for creating
a tree structure of argument groups (deprecated in Python 3.11)
- Override `parser.add_argument_group()` and add the `parent` keyword
for being able to have nested argument group defintions
- Update custom `--help` format output
- Update the argparser Sphinx extension
- Fix tests
This adds a second layer of plugin argument groups, so that the docs can
show menu items for each plugin which makes finding them is easier.
- make the doc's argparse extension read argparse groups recursively
- override argparse.ArgumentParser.format_help and show nested groups
- fix/update tests
- Add `is_global` parameter to `streamlink.options.Argument`
Global plugin arguments reference Streamlink's global arguments by
name and cannot receive any other parameters, like `required`, etc.
- In `streamlink_cli.main.setup_plugin_args`, find the global argument
references of each plugin, set the available default values and add
the plugin to the argument's `plugins` list, which will be read by
the docs generator
- In `streamlink_cli.main.setup_plugin_options`, set the provided
global argument values on the plugin's `options` dictionary
- Refactor docs/ext_argparse
- Don't override argparse.ArgumentParser when importing the parser
- Add list of supported plugins to the parameter description if the
`plugins` list is set on the argparse action object
- Add/improve/fix tests
* tests: logger tests
* test: file stream
* test: missing sessions tests
* test: missing util tests
* tests: call can_handle_url for each plugin to ensure it won't error
* tests: speed up by 2 seconds, mocking sleep
* test for streamname lookups
* refactor test structure
* tests: rebase plugins tests
* tests: no need for Python 3.6 support
* tests: remove 2.6 from the travis build
* tests: rebase on master
* tests: rename plugin.api tests
* tests: add mock http resource
* move new plugin tests
* rebase master
* tests: coverage for ConsoleOutput
* API for plugins to request input from the user
* console: handle lack of TTY for user input
* New fatal plugin error, for unrecoverable errors
* tests: remove deprecated calls
* plugins: PluginArguments API
Allow plugins to specify arguments within the Plugin class.
This makes it easier to add and test plugin specific arguments, as well
as enabling sideloaded plugins to support command line arguments.
* update docs build to work with the new plugin arguments
* fix argument name override for funimation and ustream
* add some more tests for options/arguments
* rebase with abweb plugin
* switch to RuntimeException for py2 compat
* fix bug where required arguments were not prompted
* bug fixes for option names in plugins, should match existing names
* restore "normal" exception messages
* missed a RecursionError -> RuntimeError
* updated the api slightly with better (I think) argument name
added some docs for the Argument and Arguments classes
* options/args: normalise option names to replace - with _, and ensure the defaults are set
* normalise the plugin module name, replacing _ with -
* style issues pointed out by @back-to
* plugin.btsports: update to use PluginArguments
* plugins.bbciplayer: add hd argument
* plugins.twitch: move --twitch-oauth-authenticate back to argparser
Moved the option back to argparser as it's a special case.
* test: fixed typo
* Remove extraneous whitespace.
* Fix non-membership check.
* Add absent indentation for hanging indentation.
* Align closing bracket to match visual indentation.
* Indent to distinguish line from next logical line.
* Fix over-idented lines for visual indentation.
* Fix under-idented lines for visual indentation.
* Fix bare except:
* Remove missing whitespace.
* Fix missing whitespace around arithmetic operator.
* Fix missing whitespace around operator.
* Fix over-indented hanging indentation.
* Remove whitespace around parameter '=' sign.
* Align closing bracket to match opening bracket.
* Fix spacing after comment hash for inline comments.
* Replace tabs with spaces.
* Fix over-indented hanging indentation.
* Fix comparison with boolean.
* Remove extraneous escape of newline.
* Align closing bracket to match opening bracket.
* Make identation multiple of four.
* Fix extraneous whitespace around keywords.
* Put colon-separated compound statement on separate lines.
* Put semicolon-separated compound statement on separate lines.
* Fix extraneous whitespace around keywords.
* Add missing 2 blank lines.
* Remove extra blank lines.
* Put imports on separate lines.
* Fix do not assign a lambda expression check.
* Add missing blank line.