Compare commits

..

No commits in common. "79260a0e475c50a248c754d5e82d3110d753a5eb" and "763e44df120a493ea08f5d720fc0ddc776de287e" have entirely different histories.

9 changed files with 20 additions and 52 deletions

View File

@ -94,7 +94,6 @@ def main():
{ {
"strip-2": {"A1": True, "B1": True, "gain": -6.0}, "strip-2": {"A1": True, "B1": True, "gain": -6.0},
"bus-2": {"mute": True, "eq": {"on": True}}, "bus-2": {"mute": True, "eq": {"on": True}},
"vban-in-0": {"on": True},
} }
) )
@ -356,7 +355,6 @@ vban.apply(
"strip-0": {"A1": True, "B1": True, "gain": -6.0}, "strip-0": {"A1": True, "B1": True, "gain": -6.0},
"bus-1": {"mute": True, "mode": "composite"}, "bus-1": {"mute": True, "mode": "composite"},
"bus-2": {"eq": {"on": True}}, "bus-2": {"eq": {"on": True}},
"vban-in-0": {"on": True},
} }
) )
``` ```

View File

@ -37,7 +37,6 @@ def main():
{ {
"strip-2": {"A1": True, "B1": True, "gain": -6.0}, "strip-2": {"A1": True, "B1": True, "gain": -6.0},
"bus-2": {"mute": True}, "bus-2": {"mute": True},
"vban-in-0": {"on": True},
} }
) )

View File

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "vban-cmd" name = "vban-cmd"
version = "2.4.8" version = "2.4.6"
description = "Python interface for the VBAN RT Packet Service (Sendtext)" description = "Python interface for the VBAN RT Packet Service (Sendtext)"
authors = ["onyx-and-iris <code@onyxandiris.online>"] authors = ["onyx-and-iris <code@onyxandiris.online>"]
license = "MIT" license = "MIT"
@ -28,10 +28,7 @@ build-backend = "poetry.core.masonry.api"
gui = "scripts:ex_gui" gui = "scripts:ex_gui"
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
@ -19,21 +18,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
@ -7,10 +6,8 @@ import vban_cmd
from vban_cmd.kinds import KindId from vban_cmd.kinds import KindId
from vban_cmd.kinds import request_kind_map as kindmap from vban_cmd.kinds import request_kind_map as kindmap
# 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))
)
opts = { opts = {
"ip": "testing.local", "ip": "testing.local",

View File

@ -11,7 +11,7 @@ Function RunTests {
$line | Tee-Object -FilePath $coverage -Append $line | Tee-Object -FilePath $coverage -Append
} }
} }
Write-Output "$(Get-TimeStamp)" | Out-File $coverage -Append Write-Output "$(Get-TimeStamp)" | Out-file $coverage -Append
Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg" Invoke-Expression "genbadge tests -t 90 -i ./tests/.coverage.xml -o ./tests/$kind.svg"
} }
@ -25,10 +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

@ -32,5 +32,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'"):
vban.apply(CONFIG) vban.apply(CONFIG)

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)

View File

@ -183,19 +183,17 @@ class VbanCmd(metaclass=ABCMeta):
""" """
def target(key): def target(key):
match key.split("-"): kls, m2, *rem = key.split("-")
case ["strip" | "bus" 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)]
@ -231,8 +229,7 @@ class VbanCmd(metaclass=ABCMeta):
if not self.stopped(): if not self.stopped():
self.logger.debug("events thread shutdown started") self.logger.debug("events thread shutdown started")
self.stop_event.set() self.stop_event.set()
for t in (self.producer, self.subscriber): self.subscriber.join() # wait for subscriber thread to complete cycle
t.join()
[sock.close() for sock in self.socks] [sock.close() for sock in self.socks]
self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}") self.logger.info(f"{type(self).__name__}: Successfully logged out of {self}")