Compare commits

..

No commits in common. "e9d1e7ffa2d6a3464421fe5d2b4f49011fc98923" and "8c220eb491811d514f1ab9401a00f21713c88787" have entirely different histories.

7 changed files with 18 additions and 47 deletions

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "voicemeeter-api" name = "voicemeeter-api"
version = "2.4.7" version = "2.4.5"
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"
@ -33,10 +33,7 @@ levels = "scripts:ex_levels"
midi = "scripts:ex_midi" midi = "scripts:ex_midi"
obs = "scripts:ex_obs" obs = "scripts:ex_obs"
observer = "scripts:ex_observer" observer = "scripts:ex_observer"
basic = "scripts:test_basic" test = "scripts:test"
banana = "scripts:test_banana"
potato = "scripts:test_potato"
all = "scripts:test_all"
[tool.tox] [tool.tox]
legacy_tox_ini = """ legacy_tox_ini = """

View File

@ -1,4 +1,3 @@
import os
import subprocess import subprocess
import sys import sys
from pathlib import Path from pathlib import Path
@ -39,21 +38,5 @@ def ex_observer():
subprocess.run([sys.executable, str(scriptpath)]) subprocess.run([sys.executable, str(scriptpath)])
def test_basic(): def test():
os.environ["KIND"] = "basic"
subprocess.run(["tox"]) subprocess.run(["tox"])
def test_banana():
os.environ["KIND"] = "banana"
subprocess.run(["tox"])
def test_potato():
os.environ["KIND"] = "potato"
subprocess.run(["tox"])
def test_all():
steps = [test_basic, test_banana, test_potato]
[step() for step in steps]

View File

@ -1,4 +1,3 @@
import os
import random import random
import sys import sys
from dataclasses import dataclass from dataclasses import dataclass
@ -31,10 +30,8 @@ class Data:
return (2 * self.phys_in) + (8 * self.virt_in) return (2 * self.phys_in) + (8 * self.virt_in)
# get KIND_ID from env var, otherwise set to random # let's keep things random
KIND_ID = os.environ.get( KIND_ID = random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
"KIND", random.choice(tuple(kind_id.name.lower() for kind_id in KindId))
)
vm = voicemeeterlib.api(KIND_ID) vm = voicemeeterlib.api(KIND_ID)
kind = kindmap(KIND_ID) kind = kindmap(KIND_ID)

View File

@ -25,11 +25,7 @@ Function Get-TimeStamp {
if ($MyInvocation.InvocationName -ne ".") { if ($MyInvocation.InvocationName -ne ".") {
Invoke-Expression ".\.venv\Scripts\Activate.ps1" Invoke-Expression ".\.venv\Scripts\Activate.ps1"
@("potato") | ForEach-Object { RunTests
$env:KIND = $_
RunTests
}
Invoke-Expression "deactivate" Invoke-Expression "deactivate"
} }

View File

@ -43,5 +43,5 @@ class TestErrors:
"unknown-0": {"state": True}, "unknown-0": {"state": True},
"vban-out-1": {"name": "streamname"}, "vban-out-1": {"name": "streamname"},
} }
with pytest.raises(ValueError, match="invalid config key 'unknown-0'"): with pytest.raises(ValueError, match="invalid config key 'unknown'"):
vm.apply(CONFIG) vm.apply(CONFIG)

View File

@ -300,19 +300,17 @@ class Remote(CBindings):
""" """
def target(key): def target(key):
match key.split("-"): kls, m2, *rem = key.split("-")
case ["strip" | "bus" | "button" as kls, index] if index.isnumeric(): match kls:
case "strip" | "bus" | "button":
index = m2
target = getattr(self, kls) target = getattr(self, kls)
case [ case "vban":
"vban", dir = f"{m2.rstrip('stream')}stream"
"in" | "instream" | "out" | "outstream" as direction, index = rem[0]
index, target = getattr(self.vban, dir)
] if index.isnumeric():
target = getattr(
self.vban, f"{direction.removesuffix('stream')}stream"
)
case _: case _:
ERR_MSG = f"invalid config key '{key}'" ERR_MSG = f"invalid config key '{kls}'"
self.logger.error(ERR_MSG) self.logger.error(ERR_MSG)
raise ValueError(ERR_MSG) raise ValueError(ERR_MSG)
return target[int(index)] return target[int(index)]

View File

@ -172,8 +172,8 @@ class VbanMidiOutstream(VbanOutstream):
def _make_stream_pair(remote, kind): def _make_stream_pair(remote, kind):
num_instream, num_outstream, num_midi, num_text = kind.vban num_instream, num_outstream, num_midi, num_text = kind.vban
def _make_cls(i, direction): def _make_cls(i, dir):
match direction: match dir:
case "in": case "in":
if i < num_instream: if i < num_instream:
return VbanAudioInstream(remote, i) return VbanAudioInstream(remote, i)