DB
#!/bin/bash
AUTH="admin:pass"
ADDR="127.0.0.1:8000"
mkdir -p /tmp/mon
if [ -z "$1" ] ; then
parse_json() {
python -c 'import sys, json; c = json.load(sys.stdin)["make_stream"]; print("\n".join([i["id"] for i in c if i["enable"]]))'
}
curl -s -X POST -d '{ "cmd": "load" }' http://$AUTH@$ADDR/control/ | parse_json | while read ID ; do
$0 shot $ID &
done
elif [ "$1" = "shot" ] ; then
ID="$2"