so I changed the plugin name to
soop
๐
I was wondering if there's any way to alias the plugin name so that users don't find it inconvenient when they have to change
--afreeca-usernameto--soop-username?
Plugin arguments currently don't support aliases (similar to the argparse module). This requires adding duplicates and suppressing them, so they're not listed in the docs, man page and help output. Their values then need to be set in place of the regular arguments if they are missing.
However, the values of suppressed arguments currently get discarded/ignored when set, because there wasn't a use-case for this yet. I've just changed this behavior in #6249 which I just opened. You'll have to rebase your PR onto the new HEAD of master once #6249 got merged in order to test this.
Another limitation of suppressed plugin arguments is that any argument requirements will be ignored, so if only --afreeca-username is set, it won't ask for a value of --afreeca-password/--soop-password.
Here's a diff that would add support for the old arguments:
diff --git a/src/streamlink/plugins/soop.py b/src/streamlink/plugins/soop.py index d41eb7e9..073a2d23 100644 --- a/src/streamlink/plugins/soop.py +++ b/src/streamlink/plugins/soop.py @@ -8,6 +8,7 @@ $metadata author $metadata title """ +import argparse import logging import re @@ -60,7 +61,37 @@ class SoopHLSStream(HLSStream): metavar="STREAM_PASSWORD", help="The password for the stream.", ) +@pluginargument( + "afreeca-username", + argument_name="afreeca-username", + sensitive=True, + help=argparse.SUPPRESS, +) +@pluginargument( + "afreeca-password", + argument_name="afreeca-password", + sensitive=True, + help=argparse.SUPPRESS, +) +@pluginargument( + "afreeca-purge-credentials", + argument_name="afreeca-purge-credentials", + action="store_true", + help=argparse.SUPPRESS, +) +@pluginargument( + "afreeca-stream-password", + argument_name="afreeca-stream-password", + help=argparse.SUPPRESS, +) class Soop(Plugin): + _OPTIONS_DEPRECATED = { + "afreeca-username": "username", + "afreeca-password": "password", + "afreeca-purge-credentials": "purge-credentials", + "afreeca-stream-password": "stream-password", + } + _re_bno = re.compile(r"window\.nBroadNo\s*=\s*(?P<bno>\d+);") CHANNEL_API_URL = "https://live.sooplive.co.kr/afreeca/player_live_api.php" @@ -99,6 +130,11 @@ class Soop(Plugin): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) + + for opt_deprecated, opt_name in self._OPTIONS_DEPRECATED.items(): + if (opt_value := self.options.get(opt_deprecated)) and not self.options.get(opt_name): + self.options.set(opt_name, opt_value) + self._authed = ( self.session.http.cookies.get("PdboxBbs") and self.session.http.cookies.get("PdboxSaveTicket")
I'll have a look at adding plugin argument aliases in the future, so plugins don't have to deal with this nonsense.