It works for my very specific needs so I’m not sure how useful it will be to other people but the code is on GitHub if anyone is into that kind of thing.