media-sucker/scripts/status.json.sh

28 lines
564 B
Bash
Raw Normal View History

2022-01-06 17:33:25 -07:00
#! /bin/sh
2022-01-09 16:26:12 -07:00
. $(dirname $0)/common.sh
queue () {
ls audio/*/env.json video/*/env.json 2>/dev/null \
| while read envjson
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": {
"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 16:26:12 -07:00
"encoder": $(cat status.encoder | jq -nR '[inputs][0]'),
2022-01-06 17:33:25 -07:00
}
}
EOD