#!/usr/bin/env python3 """Take the sound-reactive cans out of shows/test.qxw. Removes the Sound and Threshold audio triggers, the Sound submaster beside the cans' Front and Back sliders (CC 100), and the Sound peak frame with its Peak submaster and Hit button, with the Cans hit scene and chaser that only Hit ran. The Pump and Threshold buttons on pads 1 and 2 (notes 36 and 37) were empty; they go back to plain spare buttons like the rest of that row. The pads frame's own Peak (CC 35) stays: it is the chases' peak. padcontroller/layer.py drops its side of it in the same change: the two pads' modes, the CC 100 resets and the pad lamps that showed which was on. python3 scripts/shows/drop_sound.py Run it once; it stops if the audio triggers are already gone. QLC+ has to reopen the show to see it. """ from __future__ import annotations import re from mover_bank import ROOT SHOW = ROOT / "shows" / "test.qxw" SOUND_SLIDER_W = 55 # the Sound slider and the gap before it in the Cans frame def cut(xml: str, pattern: str, what: str) -> str: xml, n = re.subn(pattern, "", xml, count=1, flags=re.S) if n != 1: raise SystemExit(f"Couldn't find {what}") return xml def main() -> None: xml = SHOW.read_text() if "\n.*? \n', f"the {caption} audio trigger") xml = cut(xml, r' \n', "the Sound submaster") xml = cut(xml, r' \n.*? \n', "the Sound peak frame") for fid, name in ((55, "Cans hit"), (56, "Cans hit 100 ms")): xml = cut(xml, rf' \n.*? \n', name) # The Dimmers frame and its Cans frame lose the Sound slider's width. for caption, wid, x, y, w, h in (("Dimmers", 68, 880, 15, 264, 250), ("Cans", 73, 70, 40, 165, 205)): old = f'' frame = re.search(rf'\n(?:.*\n){{0,8}}?\s*{re.escape(old)}', xml) if frame is None: raise SystemExit(f"Couldn't find the {caption} frame at {w} wide") xml = xml.replace(frame.group(0), frame.group(0).replace(f'Width="{w}"', f'Width="{w - SOUND_SLIDER_W}"'), 1) for caption, wid in (("Pump", 57), ("Threshold", 58)): old = f'