add a ratelimit decorator to {VbanCmd}.sendtext()

ip kwarg renamed to host.
This commit is contained in:
2026-03-02 23:20:45 +00:00
parent cf66ae252c
commit 86d0aa91c3
4 changed files with 42 additions and 29 deletions

View File

@@ -84,18 +84,20 @@ class FactoryBase(VbanCmd):
def __init__(self, kind_id: str, **kwargs):
defaultkwargs = {
'ip': 'localhost',
'host': 'localhost',
'port': 6980,
'streamname': 'Command1',
'bps': 256000,
'channel': 0,
'ratelimit': 0.01,
'timeout': 5,
'script_ratelimit': 0.05, # 20 commands per second, to avoid overloading Voicemeeter
'timeout': 5, # timeout on socket operations, in seconds
'disable_rt_listeners': False,
'sync': False,
'pdirty': False,
'ldirty': False,
}
if 'ip' in kwargs:
defaultkwargs['host'] = kwargs.pop('ip') # for backwards compatibility
if 'subs' in kwargs:
defaultkwargs |= kwargs.pop('subs') # for backwards compatibility
kwargs = defaultkwargs | kwargs