From 16b541287583fb3fc99063c95cf457f7143536a9 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 9 Jan 2022 19:50:31 -0700 Subject: [PATCH] Probably working now --- scripts/dvd.video.read.sh | 1 - scripts/encoder.sh | 10 ++++++---- scripts/reader.sh | 6 ++++-- scripts/status.json.sh | 2 +- scripts/video.encode.sh | 15 +++++++-------- www/index.html | 20 ++++++-------------- www/sucker.mjs | 18 ++++++++---------- 7 files changed, 32 insertions(+), 40 deletions(-) diff --git a/scripts/dvd.video.read.sh b/scripts/dvd.video.read.sh index f11138f..05b986e 100755 --- a/scripts/dvd.video.read.sh +++ b/scripts/dvd.video.read.sh @@ -35,6 +35,5 @@ dvdbackup -p -F -n DVD \ ' \ | while read val; do setenv complete "$val" - echo "Complete: $val" done diff --git a/scripts/encoder.sh b/scripts/encoder.sh index 10b0222..6c35503 100755 --- a/scripts/encoder.sh +++ b/scripts/encoder.sh @@ -5,27 +5,29 @@ run_in () { ( cd $1; shift + setenv status "encoding" "$@" ) } while sleep 2; do + echo "idle" > $OUTDIR/status.encoder for mtype in audio video; do ls $mtype | while read d; do encode=/scripts/$mtype.encode.sh workdir=$mtype/$d - [ -f $workdir/read.finished ] || continue + status=$(cd $workdir && getenv status) + [ "$status" = "read finished" ] || continue - echo "$workdir" > $OUTDIR/$mtype.status - setenv status "encoding" + echo "encoding" > $OUTDIR/status.encoder if ! run_in $workdir $encode; then log "$encode failed" + (cd $workdir && setenv status "encode failed") else rm -rf $workdir fi done done - echo "idle" > $OUTDIR/$mtype.status done # vi: ts=2 sw=2 et ai diff --git a/scripts/reader.sh b/scripts/reader.sh index 72c88b6..18f11bc 100755 --- a/scripts/reader.sh +++ b/scripts/reader.sh @@ -12,10 +12,12 @@ with_time_dir () { setenv time "$now" setenv mtype "$mtype" setenv directory "$dir" + setenv status "reading" - echo "$mtype" > $OUTDIR/reader.status + echo "$mtype" > $OUTDIR/status.reader if ! "$@"; then log "$1 failed" + setenv status "read failed" else log "$1 succeeded" setenv status "read finished" @@ -24,6 +26,7 @@ with_time_dir () { } while sleep 2; do + echo "idle" > $OUTDIR/status.reader case $(setcd -i) in *"Disc found in drive: audio"*) log "Found audio disc" @@ -36,7 +39,6 @@ while sleep 2; do *) ;; esac - echo "idle" > $OUTDIR/reader.status done # vi: sw=2 ts=2 et ai diff --git a/scripts/status.json.sh b/scripts/status.json.sh index c34ff13..4448971 100755 --- a/scripts/status.json.sh +++ b/scripts/status.json.sh @@ -21,7 +21,7 @@ cat </dev/null \ +| sed 's/^[A-Za-z]*: //' \ +| sed '/^[A-Z]/ d' \ +| jq --unbuffered '(.Working.Progress // 0) * 100' \ +| while read pct; do + setenv complete "$pct" done mv "${title}.mkv" "$OUTDIR" diff --git a/www/index.html b/www/index.html index 1074198..a9a5bef 100644 --- a/www/index.html +++ b/www/index.html @@ -17,18 +17,9 @@
Status
-
-

Reader

-

- unknown - -

-
- -
-

Encoder

-
-
+ + +
@@ -50,9 +41,10 @@
-