Commit Graph

20 Commits

Author SHA1 Message Date
bastimeyer 45e515eb5a session/plugin: fix DeprecationWarning stacklevel 2023-03-24 09:41:23 -07:00
bastimeyer 151a8d7dbc options: add some MutableMapping methods 2023-02-17 09:54:35 -08:00
bastimeyer 57fa6f80e8 chore: add "COM" rules to ruff config 2023-02-09 10:26:50 -08:00
bastimeyer 0589750c8f options: deprecate global plugin arguments
- 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
2023-02-03 10:21:31 -08:00
bastimeyer 41c6fa197e options: add support for mapped getters+setters 2023-01-07 18:04:38 -08:00
bastimeyer 355179cecc options: refactor key normalization
- Store key names with dashes instead of underscore characters.
  This makes it consistent with the default Streamlink session options.
- Add typing information
2023-01-07 18:04:38 -08:00
bastimeyer 3151175bcd plugins.twitch: better access token error handling
- Refactor `TwitchAPI` class:
  - Set `CLIENT_ID` as a class attribute (for test references)
  - Allow `call()` to pass custom headers (currently unused)
  - Remove unneeded `json.dumps()`
- Handle `PlaybackAccessToken` error response and log error messages
- Add `Options.clear()` for resetting plugin options state after tests
- Add access token API tests
2022-12-04 10:56:22 +01:00
bastimeyer d1028366ee chore: dicts
- collection-builtin-to-comprehension
- dict-comprehension
- merge-dict-assign
- simplify-dictionary-update
- identity-comprehension
2022-09-02 20:23:20 -07:00
bastimeyer 5a540001fc docs: add plugin{matcher,argument} docstrings
- Add docstrings for the `pluginmatcher` and `pluginargument` decorators
- Update typing information of `Plugin.arguments` and add docstring
- Update docstrings of `Argument` and `Arguments`
- Fix minor issue in `Arguments.requires()`
2022-08-27 11:31:28 +02:00
bastimeyer 70b8ba8c2b plugin: add pluginargument decorator
Use the same signature as the Argument class and initialize the plugin's
`arguments` class attribute if it's `None`.

Defining plugin arguments the old way is still supported and unchanged.
2022-08-18 20:27:30 -07:00
bastimeyer b50b27f859 options: fix typing issues 2022-05-22 19:30:15 +02:00
bastimeyer 6325c74e68 chore: remove unnecessary collection.OrderedDict
- Replace collection.OrderedDict with builtins.dict where possible:
  Python 3.7+ ensures the correct order in builtins.dict objects and is
  no longer an implementation detail of cpython.
- Fix OrderedDict type annotation in streamlink.utils.cache.LRUCache
- Add unit test for streamlink.utils.cache.LRUCache
2022-04-17 11:06:29 -07:00
bastimeyer b72f23fd69 docs: update API page, add type annotations 2022-04-05 19:19:22 +02:00
bastimeyer 2ad48cb0c8 chore: set literals and dict comprehensions 2020-11-27 16:04:45 +01:00
bastimeyer bf5d3efa6c chore: inherit from object implicitly 2020-11-27 16:04:45 +01:00
bastimeyer 9a961f6ddc plugin: implement global plugin arguments
- 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
2020-11-14 08:54:28 +01:00
beardypig 9d63e64bbc API for plugins to request input from the user (#1827)
* 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
2018-06-21 16:15:21 -07:00
beardypig d7a27b31b0 Plugin Arguments API (#1638)
* 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
2018-05-25 14:25:15 -07:00
stepshal 922e169207 Add blank line after class or function definition (#408) 2017-01-12 14:54:55 +00:00
Charlie Drage a6ceedc4e7 Rename instances of "livestreamer" to "streamlink"
Renames all instances of "livestreamer" to "streamlink".
2016-09-19 15:46:06 -04:00