Files
dickshow-index/run_all.py
T

51 lines
1.5 KiB
Python

"""One-command pipeline: feed -> download -> transcribe -> index.
python run_all.py # everything not yet done
python run_all.py --ep 361 # just one episode end-to-end (good first run)
python run_all.py --minutes 5 --ep 520 # 5-minute smoke test
"""
import argparse
import subprocess
import sys
def run(cmd: list[str]) -> int:
print(f"\n=== {' '.join(cmd)} ===\n", flush=True)
return subprocess.call([sys.executable] + cmd)
def main() -> None:
ap = argparse.ArgumentParser()
ap.add_argument("--ep", type=int, nargs="*", default=None)
ap.add_argument("--minutes", type=float, default=None)
ap.add_argument("--skip-download", action="store_true")
ap.add_argument("--skip-transcribe", action="store_true")
ap.add_argument("--force", action="store_true")
args = ap.parse_args()
rc = run(["feed.py"])
if rc:
return rc
if not args.skip_download:
cmd = ["download.py"] + ([str(e) for e in args.ep] if args.ep else [])
if run(cmd):
print("download step reported failures; continuing", file=sys.stderr)
if not args.skip_transcribe:
cmd = ["transcribe.py"]
if args.ep:
cmd += [str(e) for e in args.ep]
if args.minutes:
cmd += ["--minutes", str(args.minutes)]
if args.force:
cmd += ["--force"]
if run(cmd):
return 1
return run(["index.py"])
if __name__ == "__main__":
sys.exit(main())