handoff: relaunch the tiers detached, progress numbers, new-episode copy run

The x265/nvenc tiers launched as Hermes background processes were killed
mid-encode at 10:37 when the user's session was closed, so persist_on_release
is not enough here: run/relaunch_tiers.sh starts them orphaned from Hermes
(Start-Process) with a retry loop, which is why they are no longer tracked and
must be stopped by PID only.

STATE.md now carries the progress table (242/589 done, 347 pending: 169 x265 +
174 nvenc + 4 copy), the reason a full `--tier copy` pass must NOT be run (its
only skip test is "already HEVC", which a copy output never satisfies - it
would redo all 193), and the four new weekly episodes handled one file at a
time.
This commit is contained in:
2026-10-08 10:52:05 +08:00
parent 832c76619a
commit 7c278afc51
4 changed files with 133 additions and 10 deletions
+21
View File
@@ -0,0 +1,21 @@
# run/ — the operational launchers for the 樊登读书会 library
These are the **source of truth**; the live copies actually driving the job are in `/d/tmp/xcode/`
(same content). Edit here, then copy out to `/d/tmp/xcode/` and relaunch.
| script | what it does |
|---|---|
| `relaunch_tiers.sh` | Starts the two HEVC tiers (`x265` = CPU/E-cores, `nvenc` = GPU) **detached from Hermes** so ending a session cannot kill them, with up to 8 retries each. Idempotent: converted files are skipped, failed items are retried with the live file untouched. |
| `convert_new4.sh` | The newest weekly episodes that the copy pass never saw (H.264 + **mp3** audio, one actually MPEG-TS). Runs them through the single-file path (`--tier copy --path <file> --keep-source`) because a full `--tier copy` pass would redo all 193 already-converted copy-tier files. |
Why detached: on 2026-10-08 10:37 both tiers — launched as Hermes background processes with
`persist_on_release` — were killed mid-encode when the user's session was closed (no `PASS-DONE`
in either log, `*_out.mp4` and `.err` frozen in the stage dir). `powershell Start-Process` gives the
job an orphaned process tree that Hermes' cleanup cannot reach. Consequence: no exit notifications
(watch the logs) and **stop it by PID only** — `taskkill /IM ffmpeg.exe` would also kill an unrelated
encode.
```bash
bash /d/tmp/xcode/relaunch_tiers.sh # relaunch / resume both tiers
tail -f /d/tmp/xcode/run_x265.log /d/tmp/xcode/run_nvenc.log
```
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# The four newest 樊登读书会 episodes (downloaded after the copy pass finished on 2026-10-07
# 17:47) are classified `copy`: H.264 video (one of them is actually an MPEG-TS named .mp4) with
# **mp3** audio, which no iPad can play. They need video-bit-identical remux + AAC audio.
#
# A full `--tier copy` pass would redo all 193 already-converted copy-tier files (the copy tier's
# only skip test is "already HEVC", which a copy output is not), so these four go through the
# single-file path instead - same tier rule, same gates, same hash-verified install.
#
# Sequential, one lock (run-copy.lock), and they never touch the snapshot originals.
set -u
TOOLS=/c/Users/hoelee/AppData/Local/hermes/tools
PY="$(ls -d $TOOLS/python-*/python.exe 2>/dev/null | head -1)"
LOG=/d/tmp/xcode/run_new4.log
BASE='Z:\Class\樊登读书\樊登读书会(每周更新)\樊登读书2026年(更新中)'
cd /d/dev/universal-video-transcode || exit 1
{
echo "=== new-episode copy pass start $(date '+%F %T') python=$PY"
for r in '1004 反内卷\反内卷.mp4' \
'0912 感官觉醒\感官觉醒.mp4' \
'0905 如何成为情绪稳定的父母\如何成为情绪稳定的父母.mp4' \
'0822 超赞的一代\超赞的一代.mp4'; do
echo "--- $r"
"$PY" -u scripts/library_run.py --tier copy --path "$BASE\\$r" --keep-source
echo " rc=$?"
done
echo "=== new-episode copy pass done $(date '+%F %T')"
} >> "$LOG" 2>&1
+32
View File
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
# Relaunch the two remaining HEVC tiers of the 樊登读书会 conversion, DETACHED from Hermes
# so a session ending cannot kill them: the previous incarnation was killed mid-encode at
# 10:37 on 2026-10-08 when its Hermes session was closed.
#
# Idempotent: files already converted are skipped, a failure leaves the live file untouched and
# the next attempt retries it. One lock per tier (run-<tier>.lock).
set -u
TOOLS=/c/Users/hoelee/AppData/Local/hermes/tools
PY="$(ls -d $TOOLS/python-*/python.exe 2>/dev/null | head -1)"
LIB='Z:\Class\#snapshot\GMT+08-2026.09.25-09.50.20\樊登读书\樊登读书会(每周更新)'
LOG=/d/tmp/xcode
cd /d/dev/universal-video-transcode || exit 1
if [ ! -x "$PY" ]; then echo "FATAL python not found under $TOOLS" >> $LOG/relauncher.out; exit 1; fi
echo "=== relauncher start $(date '+%F %T') python=$PY" >> $LOG/relauncher.out
for t in x265 nvenc; do
(
for i in 1 2 3 4 5 6 7 8; do
echo "=== relaunch attempt $i $(date '+%F %T')" >> "$LOG/run_$t.log"
"$PY" -u scripts/library_run.py --tier "$t" --origin-root "$LIB" --reverse \
>> "$LOG/run_$t.log" 2>&1
rc=$?
echo "$t PASS-DONE rc=$rc attempt=$i $(date '+%F %T')" >> "$LOG/run_$t.log"
[ $rc -eq 0 ] && break
sleep 60
done
) &
sleep 2
done
wait