Probably too project-specific to be of much general use, but it works great and I didn’t want to delete it entirely. So it’s posted here for good measure, hopefully others can cull some some value from it. On to the next..