forked from apoc/chaospott_mumble
add script for bigbluebutton
This commit is contained in:
parent
105a4b6b39
commit
5a4c37a624
40
chaospott_bbb.sh
Normal file
40
chaospott_bbb.sh
Normal file
@ -0,0 +1,40 @@
|
||||
#!/bin/bash
|
||||
# SETUP: apt-get install libxml2-utils wget
|
||||
# cronjob:
|
||||
# */1 * * * * status=`/path/to/chaospott_bbb.sh` && [ "$status" ] && echo $status > /path/to/htdocs/chaospott_bbb.json
|
||||
#
|
||||
|
||||
ROOM="Chaospott"
|
||||
|
||||
[ -z `which xmllint` ] && exit 1
|
||||
if which wget >/dev/null; then
|
||||
CLIENT="wget -q -O -";
|
||||
elif which curl >/dev/null; then
|
||||
CLIENT="curl -s";
|
||||
else
|
||||
exit 1;
|
||||
fi
|
||||
|
||||
APICallName="getMeetings"
|
||||
APIQueryString=""
|
||||
|
||||
X=$( bbb-conf --secret | fgrep URL: )
|
||||
APIEndPoint=${X##* }
|
||||
Y=$( bbb-conf --secret | fgrep Secret: )
|
||||
Secret=${Y##* }
|
||||
S=$APICallName$APIQueryString$Secret
|
||||
Checksum=$( echo -n $S | sha1sum | cut -f 1 -d ' ' )
|
||||
if [[ "$APIQueryString" == "" ]]
|
||||
then
|
||||
URL="${APIEndPoint}api/$APICallName?checksum=$Checksum"
|
||||
else
|
||||
URL="${APIEndPoint}api/$APICallName?$APIQueryString&checksum=$Checksum"
|
||||
fi
|
||||
RESPONSE=`$CLIENT "$URL"`
|
||||
active=`echo $RESPONSE | xmllint --xpath "string(//meeting[meetingName='$ROOM'])" -`
|
||||
[ -z "$active" ] && active="false" || active="true"
|
||||
participantcount=`echo $RESPONSE | xmllint --xpath "string(//meeting[meetingName='$ROOM']/participantCount)" -`
|
||||
[ -z "$participantcount" ] && participantcount=0
|
||||
starttime=`echo $RESPONSE | xmllint --xpath "string(//meeting[meetingName='$ROOM']/startTime)" -`
|
||||
[ -z "$starttime" ] && starttime=0
|
||||
echo "{\"active\": $active, \"participantCount\": $participantcount, \"startTime\": $starttime}"
|
Loading…
Reference in New Issue
Block a user