bigbluebutton-Github/bbb-recording-imex/get-recordings.sh

55 lines
1.2 KiB
Bash
Raw Normal View History

2022-04-09 02:46:54 +08:00
#!/bin/bash
while getopts i:r:s:m:o:l: flag
2022-04-09 02:46:54 +08:00
do
case "${flag}" in
i) MEETING_ID=${OPTARG};;
r) RECORD_ID=${OPTARG};;
s) STATE=${OPTARG};;
m) META=${OPTARG};;
o) OFFSET=${OPTARG};;
l) LIMIT=${OPTARG};;
2022-04-09 02:46:54 +08:00
esac
done
2022-04-09 03:48:39 +08:00
BASE_URL=""
2022-04-09 02:46:54 +08:00
SUBDIRECTORY="bigbluebutton/api/"
ENDPOINT="getRecordings"
QUERY=""
if ! [[ -z ${MEETING_ID+x} ]]; then QUERY+="meetingID=$MEETING_ID&"; fi
if ! [[ -z ${RECORD_ID+x} ]]; then QUERY+="recordID=$RECORD_ID&"; fi
if ! [[ -z ${STATE+x} ]]; then QUERY+="state=$STATE&"; fi
if ! [[ -z ${META+x} ]]; then QUERY+="meta=$META&"; fi
if ! [[ -z ${OFFSET+x} ]]; then QUERY+="offset=$OFFSET&"; fi
if ! [[ -z ${LIMIT+x} ]]; then QUERY+="limit=$LIMIT"; fi
2022-04-09 02:46:54 +08:00
echo "query: $QUERY"
INDEX=${#QUERY}-1
if [ "${QUERY:$INDEX:1}" = "&" ]; then QUERY=${QUERY:0:$INDEX}; fi
echo "query: $QUERY"
SALT=""
2022-04-09 02:46:54 +08:00
DATA="$ENDPOINT$QUERY$SALT"
echo "data: $DATA"
CHECKSUM=$(echo -n $DATA | sha256sum)
CHECKSUM=${CHECKSUM:0:64}
echo "sha256 checksum: $CHECKSUM"
QUERY="?$QUERY"
if ! [[ ${#QUERY} -eq 1 ]]; then QUERY+="&"; fi
QUERY+="checksum=$CHECKSUM"
echo "query: $QUERY"
REQUEST="$BASE_URL$SUBDIRECTORY$ENDPOINT$QUERY"
echo "request: $REQUEST"
curl -s -X GET "$REQUEST"