поправлены способ передачи таймеров в vMix

This commit is contained in:
2026-08-20 15:33:03 +03:00
parent 8790a1e113
commit cd9476d167
6 changed files with 420 additions and 117 deletions

View File

@@ -688,7 +688,7 @@ def test_runtime_vmix_sequence_preserves_command_order(tmp_path: Path) -> None:
"device_secret": "s" * 40,
"device_name": "Sequence GFX",
"hostname": "SEQUENCE-PC",
"agent_version": "1.4.0",
"agent_version": "1.3.0",
"vmix": {"connected": True, "url": "http://127.0.0.1:8088/api/"},
},
)
@@ -744,6 +744,65 @@ def test_runtime_vmix_sequence_preserves_command_order(tmp_path: Path) -> None:
result = await task
assert result["ok"] is True
assert result["applied"] == 2
assert result["transport"] == "legacy"
assert [item["function"] for item in result["results"]] == ["SetCountdown", "StartCountdown"]
asyncio.run(scenario())
def test_build90_runtime_shortcut_sequence_uses_one_batch_on_modern_agent(tmp_path: Path) -> None:
database = LocalTestDatabase(tmp_path / "agent-runtime-batch.sqlite3")
database.create_all()
hub = VmixAgentHub(database) # type: ignore[arg-type]
ws = FakeWebSocket()
user = HockeyUser(id="92", login="operator92", display_name="operator92")
async def scenario() -> None:
await hub.register(
ws, # type: ignore[arg-type]
{
"device_id": "GFX-PC-RUNTIME-BATCH",
"device_secret": "r" * 40,
"device_name": "Runtime Batch GFX",
"hostname": "RUNTIME-BATCH-PC",
"agent_version": "1.4.0",
"vmix": {"connected": True, "url": "http://127.0.0.1:8088/api/"},
},
)
await hub.pair_device("GFX-PC-RUNTIME-BATCH", user)
assigned = await hub.assign_match(
wfl_user_id=user.id, tournament_external_id="1437", game_external_id="902919",
)
assert assigned is not None
task = asyncio.create_task(hub.run_vmix_sequence_for_user(
user,
[
{"Function": "SetCountdown", "Input": "53", "SelectedName": "Clock.Text", "Value": "00:18:42"},
{"Function": "StartCountdown", "Input": "53", "SelectedName": "Clock.Text"},
{"Function": "OverlayInput2In", "Input": "53"},
],
))
batch = None
for _ in range(50):
await asyncio.sleep(0)
batch = next((item for item in reversed(ws.sent) if item.get("type") == "vmix.batch"), None)
if batch is not None:
break
assert batch is not None
assert [item["Function"] for item in batch["commands"]] == ["SetCountdown", "StartCountdown", "OverlayInput2In"]
assert not [item for item in ws.sent if item.get("type") == "vmix.command"]
await hub.receive_command_ack(
"GFX-PC-RUNTIME-BATCH",
{
"type": "command.batch.ack", "request_id": batch["request_id"], "ok": True,
"results": [{"ok": True}, {"ok": True}, {"ok": True}],
},
)
result = await task
assert result["ok"] is True
assert result["transport"] == "batch"
assert result["applied"] == 3
assert result["overlay_state"]["overlays"]["2"]["input"] == "53"
asyncio.run(scenario())