Number of the HLS/HTTP sessions
curl -s -X POST \
--user 'admin:pass' \
-d '{ "cmd": "sessions" }' \
http://tv.server.ip:port/control/ | grep client_id | wc -l
Switch input
For example , turning off the channel with adult content in the daytime
curl -X POST \
--user 'admin:pass' \
-d '{"cmd":"set-stream-input", "id":"a006", "input":2}' \
http://tv.server.ip:port/control/
"id":"a006"
- stream id"input":2
- input number. The numbering of the inputs begins with one.
Create user
curl -X POST \
--user 'admin:pass' \
-d '{
"cmd": "set-user",
"id": "user-login",
"user": {
"enable": true,
"type": 3,
"password": "user-pass",
"conlimit": 5,
"ip": "172.31.2.6",
"packages": ["ALL"]
}
}' \
http://tv.server.ip:port/control/
"id": "user-login"
- login"enable": true
- is active."type": 3
- type: 1 - administrator, 2 - observer, 3 - user"password": "user-pass"
- password"conlimit": 5
- (optional) limit on simultaneous connections"ip": "172.31.2.6"
- (optional) user ip address"packages": ["ALL"]
- (optional) list of packages available to the user
Get user configuration
curl -X POST \
--user 'admin:pass' \
-d '{"cmd": "get-user", "id": "user-login"}' \
http://tv.server.ip:port/control/
Create/edit stream
curl -X POST \
--user 'admin:pass' \
-d '{
"cmd": "set-stream",
"id": "a005",
"stream": {
"enable": true,
"name": "test",
"id": "a005",
"type": "spts",
"input": ["udp://251.34.21.5:1234"],
"output": ["http://0:555/fox"]
}
}' \
http://tv.server.ip:port/control/
"id": "a01h"
- stream id"name": "test"
- stream name
Set image on the stream card
Create a script:
#!/bin/bash
AUTH="admin:password"
ADDR="127.0.0.1:8000"
if [ -z "$1" ] ; then
curl http://$ADDR/playlist.m3u8 | grep '^http' | sed 's/.*\/play\/\([^\/]*\).*/\1/' | while read ID ; do
$0 shot $ID &
done
elif [ "$1" = "shot" ] ; then
ID="$2"
/usr/bin/ffmpeg \
-i "http://$ADDR/play/$ID" \
-v quiet \
-ss 2 -y -t 1 -vframes 1 -vf scale=160:100 \
-f image2 "/tmp/$ID.png" &
sleep 60s && kill -9 $!
IMG=$(cat /tmp/$ID.png | base64)
echo "{\"cmd\":\"set-stream-image\", \"id\":\"$ID\", \"url\":\"data:image/png;base64,$IMG\"}" | curl -X POST -d "@-" --user "$AUTH" "http://$ADDR/control/"
fi
Edit the lines:
AUTH="admin:pass"
- your login and passwordADDR="127.0.0.1:8000"
- ip and port where Astra is running