This is a quick (and rather dirty!) hack inspired by a post on the QLab Facebook Group, I wouldn't recommend using it in a production environment but in this case it was to enable the original poster to trigger halloween effects based on a doorbell at home (which is where everyone is just now, at the time of writing, the entertainment industry in the UK has basically been outlawed due to COVID-19)
The simple problem to solve is how to trigger QLab from a device that can send HTTP, but not OSC, messages and ideall without any external dependencies or additional software.
So, without further ado;
while :; do nc -l 80 -w0 && echo "/cue/1/go" |
nc -w1 -u localhost 53535; sleep 3; done;
Run this little one-liner in a Terminal window on your mac and any HTTP request to your mac's IP address will run cue 1.
As I said, quick and dirty, it doesn't care about the content of your HTTP request or what made it, any request at all (e.g. http://localhost/ in your web browser) will trigger the cue stack.
To stop it, close the window, or hold CTRL-C
So how does that jumble of characters work?
Ok, so this uses a simple tool, nc
, that is installed on all macs by default and some basic 'shell scripting'
Firstly, while :; do
will ensure that the next command sequence (terminated by done;
runs indefinitely.
Then we have three distinct commands; two using nc
and a sleep
command that work together to form a very primative "if-this-then-that" type of action.
nc -l 80 -w0
runs the worlds most primitive 'web server', it listens on port 80 (standard web port) for any messages at all. It doesn't provide any response, so it's a simple 'fire and forget' arrangement. The addition of -w0
ensures that the process will end (this is important) when it receives a message
&&
ensures the next command runs when the first one exits clearly so since we included -w0
above the first command will exit when it receives any message at all.
echo "/cue/1/go" | -w1 -u localhost 53535
sends the text /cue/1/go
to QLab (listening on UDP port 53535) which will trigger Cue 1 in your current Workspace.
sleep 3
ensures that it waits at least 3 seconds before accepting the next request this prevents any automated retries restarting the cue stack. If you're triggering a long sequence of cues, set this to the length of time that sequence takes to run.
That's it, run this command then hit http://localhost/ on your mac and watch the cue run.
Hopefully someone finds this, or the explanation, useful.
How would you do this in production?
Not like this! You need a simple HTTP daemon that sends a QLab OSC message when it receives a valid request and sends an HTTP/1.1 200 OK response to the requestor; this is the sort of thing that I might throw together at some point.