Project

General

Profile

Download (1.35 KB) Statistics
| Branch: | Tag: | Revision:
#!/bin/bash
BOLD='\033[1m'
ENDC='\033[0m'
BOLD_RED='\033[1;31m'

ADDRESS="brutus"
PORT="8081"

# Make sure curl ad jq are installed
command -v curl >/dev/null 2>&1 || { echo >&2 "Please install curl to use this script. Aborting."; exit 1; }
command -v jq >/dev/null 2>&1 || { echo >&2 "Please install jq to use this script. Aborting."; exit 1; }

DATA=`curl -s -X GET http://$ADDRESS:$PORT/queue`

STATUS=`echo $DATA | jq .queue[0].status`
STATUS="${STATUS%\"}" # This magic removes surrounding quotes
STATUS="${STATUS#\"}"

INPUT=`echo $DATA | jq .queue[0].path`
INPUT="${INPUT%\"}"
INPUT="${INPUT#\"}"

OUTPUT=`echo $DATA | jq .queue[0].output_file`
OUTPUT="${OUTPUT%\"}"
OUTPUT="${OUTPUT#\"}"

TIME_ADDED=`echo $DATA | jq .queue[0].time_added`
TIME_ADDED="${TIME_ADDED%\"}"
TIME_ADDED="${TIME_ADDED#\"}"

ENCODE_STARTED=`echo $DATA | jq .queue[0].encode_started`
ENCODE_STARTED="${ENCODE_STARTED%\"}"
ENCODE_STARTED="${ENCODE_STARTED#\"}"

printf "\n"
if [[ "$STATUS" = "null" ]]; then
printf "${BOLD_RED}NO ENCODE IN PROGRESS${ENDC}\n"
else
# NOTE: printf complained about the contents of the strings for some reason
echo -e "${BOLD}Status:${ENDC} ${STATUS}"
echo -e "${BOLD}Input:${ENDC} $INPUT"
echo -e "${BOLD}Output:${ENDC} $OUTPUT"
echo -e "${BOLD}Added:${ENDC} $TIME_ADDED"
echo -e "${BOLD}Started:${ENDC} $ENCODE_STARTED"
fi
printf "\n"
(4-4/4)