Compare commits

..

No commits in common. "b0acde6a5285be4e916fbf7771b87fb995b7b1b3" and "5640f54e657db0ed63019f8a2996499465dd44aa" have entirely different histories.

7 changed files with 10 additions and 79 deletions

View File

@ -11,12 +11,6 @@ Before any major/minor/patch bump all unit tests will be run to verify they pass
- [x] - [x]
## [2.3.0] - 2023-07-11
### Added
- user configs may now extend other user configs. check `config extends` section in README.
## [2.2.0] - 2023-07-10 ## [2.2.0] - 2023-07-10
### Added ### Added

View File

@ -691,8 +691,8 @@ vm.apply(
Or for each class you may do: Or for each class you may do:
```python ```python
vm.strip[0].apply({"mute": True, "gain": 3.2, "A1": True}) vm.strip[0].apply(mute: True, gain: 3.2, A1: True)
vm.vban.outstream[0].apply({"on": True, "name": "streamname", "bit": 24}) vm.vban.outstream[0].apply(on: True, name: 'streamname', bit: 24)
``` ```
## Config Files ## Config Files
@ -701,7 +701,7 @@ vm.vban.outstream[0].apply({"on": True, "name": "streamname", "bit": 24})
You may load config files in TOML format. You may load config files in TOML format.
Three example configs have been included with the package. Remember to save Three example configs have been included with the package. Remember to save
current settings before loading a user config. To load one you may do: current settings before loading a user config. To set one you may do:
```python ```python
import voicemeeterlib import voicemeeterlib
@ -709,26 +709,7 @@ with voicemeeterlib.api('banana') as vm:
vm.apply_config('example') vm.apply_config('example')
``` ```
Your configs may be located in one of the following paths: will load a user config file at configs/banana/example.toml for Voicemeeter Banana.
- \<current working directory\> / "configs" / kind_id
- \<user home directory\> / ".config" / "voicemeeter" / kind_id
- \<user home directory\> / "Documents" / "Voicemeeter" / "configs" / kind_id
If a config with the same name is located in multiple locations, only the first one found is loaded into memory, in the above order.
#### `config extends`
You may also load a config that extends another config with overrides or additional parameters.
You just need to define a key `extends` in the config TOML, that names the config to be extended.
Three example 'extender' configs are included with the repo. You may load them with:
```python
import voicemeeterlib
with voicemeeterlib.api('banana') as vm:
vm.apply_config('extender')
```
## Events ## Events

View File

@ -1,12 +0,0 @@
extends = "example"
[strip-0]
label = "strip0_extended"
A1 = false
gain = 0.0
[bus-0]
label = "bus0_extended"
mute = false
[vban-in-3]
name = "vban_extended"

View File

@ -1,12 +0,0 @@
extends = "example"
[strip-0]
label = "strip0_extended"
A1 = false
gain = 0.0
[bus-0]
label = "bus0_extended"
mute = false
[vban-in-3]
name = "vban_extended"

View File

@ -1,12 +0,0 @@
extends = "example"
[strip-0]
label = "strip0_extended"
A1 = false
gain = 0.0
[bus-0]
label = "bus0_extended"
mute = false
[vban-in-3]
name = "vban_extended"

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "voicemeeter-api" name = "voicemeeter-api"
version = "2.3.0" version = "2.2.1"
description = "A Python wrapper for the Voiceemeter API" description = "A Python wrapper for the Voiceemeter API"
authors = ["onyx-and-iris <code@onyxandiris.online>"] authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT" license = "MIT"

View File

@ -301,24 +301,16 @@ class Remote(CBindings):
def apply_config(self, name): def apply_config(self, name):
"""applies a config from memory""" """applies a config from memory"""
ERR_MSG = ( error_msg = (
f"No config with name '{name}' is loaded into memory", f"No config with name '{name}' is loaded into memory",
f"Known configs: {list(self.configs.keys())}", f"Known configs: {list(self.configs.keys())}",
) )
try: try:
config = self.configs[name].copy() self.apply(self.configs[name])
self.logger.info(f"Profile '{name}' applied!")
except KeyError as e: except KeyError as e:
self.logger.error(("\n").join(ERR_MSG)) self.logger.error(("\n").join(error_msg))
raise VMError(("\n").join(ERR_MSG)) from e raise VMError(("\n").join(error_msg)) from e
if "extends" in config:
extended = config.pop("extends")
config = self.configs[extended] | config
self.logger.debug(
f"profile '{name}' extends '{extended}', profiles merged.."
)
self.apply(config)
self.logger.info(f"Profile '{name}' applied!")
def logout(self) -> NoReturn: def logout(self) -> NoReturn:
"""Wait for dirty parameters to clear, then logout of the API""" """Wait for dirty parameters to clear, then logout of the API"""