Skip to content

cli: deprecate old config files and plugin dirs #3784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

bastimeyer
Copy link
Member

Deprecated config file paths

  • Windows
    • %APPDATA%\streamlink\streamlinkrc
  • macOS
    • ${XDG_CONFIG_HOME:-${HOME}/.config}/streamlink/config
    • ${HOME}/.streamlinkrc
  • Linux/BSD
    • ${HOME}/.streamlinkrc

Deprecated plugin directories

  • macOS
    • ${XDG_CONFIG_HOME:-${HOME}/.config}/streamlink/plugins
  • Linux/BSD
    • ${XDG_CONFIG_HOME:-${HOME}/.config}/streamlink/plugins

Updated primary config file paths

  • Windows
    %APPDATA%\streamlink\config
  • macOS
    ${HOME}/Library/Application Support/streamlink/config
  • Linux/BSD
    ${XDG_CONFIG_HOME:-${HOME}/.config}/streamlink/config (no changes)

Updated primary plugin directories

  • Windows
    %APPDATA%\streamlink\plugins (no changes)
  • macOS
    ${HOME}/Library/Application Support/streamlink/plugins
  • Linux/BSD
    ${XDG_DATA_HOME:-${HOME}/.local/share}/streamlink/plugins

- wrap deprecated config and plugin paths in `DeprecatedPath`,
  subclassed from pathlib.Path
- log info messages when loading deprecated configs or plugins
- return success from `Streamlink.load_plugins(path)` to be able to
  log plugin loading messages in the main cli module
@bastimeyer bastimeyer added the CLI label Jun 6, 2021
Comment on lines +667 to +679
if streamlink and args.url:
# Only load first available plugin config
with ignored(NoPluginError):
plugin = streamlink.resolve_url(args.url)
for config_file in CONFIG_FILES:
config_file = config_file.with_name(f"{config_file.name}.{plugin.module}")
if not config_file.is_file():
continue
if type(config_file) is DeprecatedPath:
log.info(f"Loaded plugin config from deprecated path, see CLI docs for how to migrate: {config_file}")
config_files.append(config_file)
break

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a small change in logic here. Previously it was trying to load multiple plugin specific config files, eg. ~/.config/streamlink/config.twitch and ~/.streamlinkrc.twitch, but since only the first non-plugin-specific default config file gets loaded (see above), plugin configs should have the same logic.

I'm also not sure if we should disable plugin config loading when --config is set or if we should add something like --no-plugin-config for disabling loading plugin configs.

- Don't log when loading a config from a deprecated path when using the
  `--config` argument
- Only load the first existing plugin-specific config file
- Keep config file loading order
- Add tests for setup_config_args
@bastimeyer bastimeyer force-pushed the cli/deprecate-old-config-file-and-plugin-dir-paths branch from ecf58ed to f2c4081 Compare June 7, 2021 12:03
@back-to back-to merged commit 6cdc3eb into streamlink:master Jun 9, 2021
@bastimeyer bastimeyer deleted the cli/deprecate-old-config-file-and-plugin-dir-paths branch June 9, 2021 16:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants