1 Commits

Author SHA1 Message Date
6b79c091e8 should the loader attempt to load an invalid toml config
log as error but allow the loader to continue

patch bump
2023-08-01 18:18:02 +01:00
6 changed files with 13 additions and 22 deletions

View File

@@ -380,13 +380,12 @@ The following properties are available.
- `state`: boolean
- `stateonly`: boolean
- `trigger`: boolean
- `color`: int, from 0 to 8
example:
```python
vm.button[37].state = True
vm.button[4].color = 1
vm.button[55].trigger = False
```
### Recorder

View File

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

View File

@@ -147,8 +147,13 @@ class Loader(metaclass=SingletonType):
self.logger.info(
f"config file with name {identifier} already in memory, skipping.."
)
return False
self.parser = dataextraction_factory(data)
return
try:
self.parser = dataextraction_factory(data)
except tomllib.TOMLDecodeError as e:
ERR_MSG = (str(e), f"When attempting to load {identifier}.toml")
self.logger.error(f"{type(e).__name__}: {' '.join(ERR_MSG)}")
return
return True
def register(self, identifier, data=None):

View File

@@ -23,7 +23,6 @@ class Adapter(IRemote):
def output(self):
pass
@property
def identifier(self):
pass

View File

@@ -33,7 +33,6 @@ class IRemote(metaclass=ABCMeta):
cmd += (f".{param}",)
return "".join(cmd)
@property
@abstractmethod
def identifier(self):
pass

View File

@@ -12,6 +12,9 @@ ButtonModes = IntEnum(
class Adapter(IRemote):
"""Adapter to the common interface."""
def identifier(self):
pass
def getter(self, mode):
self.logger.debug(f"getter: button[{self.index}].{ButtonModes(mode).name}")
return self._remote.get_buttonstatus(self.index, mode)
@@ -23,21 +26,7 @@ class Adapter(IRemote):
self._remote.set_buttonstatus(self.index, val, mode)
class MacroButtonColorMixin(IRemote):
@property
def identifier(self):
return f"command.button[{self.index}]"
@property
def color(self) -> int:
return int(IRemote.getter(self, "color"))
@color.setter
def color(self, val: int):
IRemote.setter(self, "color", val)
class MacroButton(Adapter, MacroButtonColorMixin):
class MacroButton(Adapter):
"""Defines concrete implementation for macrobutton"""
def __str__(self):