commit e12820538a937404c0a6f902d5ba44194c03c03c
Author: David Sorber <david.sorber@gmail.com>
Date:   Sun Feb 24 10:30:42 2019 -0500

    Adding new files that I forgot to add before.

diff --git a/software/hbkcd/hbkcd/utils.py b/software/hbkcd/hbkcd/utils.py
new file mode 100644
index 0000000..7232b49
--- /dev/null
+++ b/software/hbkcd/hbkcd/utils.py
@@ -0,0 +1,27 @@
+
+def pp_filesize(file_size):
+    """ Pretty print file size using base 2 units and including a label.
+    """
+    
+    if file_size >= 2**40:
+        # TB
+        scaled = file_size / (2**40 * 1.0)
+        unit = 'TB'
+    elif file_size >= 2**30:
+        # GB
+        scaled = file_size / (2**30 * 1.0)
+        unit = 'GB'
+    elif file_size >= 2**20:
+        # MB
+        scaled = file_size / (2**20 * 1.0)
+        unit = 'MB'
+    elif file_size >= 2**10:
+        # KB
+        scaled = file_size / (2**10 * 1.0)
+        unit = 'KB'
+    else:
+        # Bytes
+        scaled = file_size
+        unit = 'b'
+        
+    return '{:.2f} {:s}'.format(scaled, unit)
diff --git a/software/hbkcd/scripts/hbkcd_status.sh b/software/hbkcd/scripts/hbkcd_status.sh
new file mode 100755
index 0000000..fc3d3cb
--- /dev/null
+++ b/software/hbkcd/scripts/hbkcd_status.sh
@@ -0,0 +1,46 @@
+#!/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"
