2022-01-06 17:33:25 -07:00
|
|
|
#! /bin/sh
|
|
|
|
|
2022-01-17 20:55:16 -07:00
|
|
|
set -x # Why the heck is this eating 100% CPU in an unkillable state?
|
|
|
|
|
2022-01-09 16:26:12 -07:00
|
|
|
. $(dirname $0)/common.sh
|
|
|
|
|
|
|
|
queue () {
|
2022-01-17 20:55:16 -07:00
|
|
|
find audio video -name env.json \
|
|
|
|
| while read envjson # This is the line that's dying at 100% CPU
|
2022-01-09 16:26:12 -07:00
|
|
|
do
|
|
|
|
dir=${envjson%/env.json}
|
|
|
|
cat $envjson \
|
|
|
|
| jq --arg dir "$dir" '.directory = $dir'
|
|
|
|
done
|
|
|
|
}
|
2022-01-06 17:33:25 -07:00
|
|
|
|
|
|
|
cat <<EOD
|
|
|
|
{
|
|
|
|
"finished": {
|
2022-01-08 20:42:24 -07:00
|
|
|
"video": $(ls *.mkv 2>/dev/null | jq -nR '[inputs]'),
|
|
|
|
"audio": $(ls */*/.mp3 2>/dev/null | jq -nR '[inputs]')
|
2022-01-06 17:33:25 -07:00
|
|
|
},
|
2022-01-09 16:26:12 -07:00
|
|
|
"queue": $(queue | jq --slurp),
|
2022-01-06 17:33:25 -07:00
|
|
|
"status": {
|
|
|
|
"reader": $(cat status.reader | jq -nR '[inputs][0]'),
|
2022-01-09 19:50:31 -07:00
|
|
|
"encoder": $(cat status.encoder | jq -nR '[inputs][0]')
|
2022-01-06 17:33:25 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
EOD
|