File size: 1,807 Bytes
a2a2dbd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
"""Watch the active HyperFrames render and write live % to RENDER_PROGRESS.txt."""
import glob, os, time
from datetime import datetime

PROJ = r"D:\PromptEngineer48\In-Progress\P11-Editor"
RENDERS = os.path.join(PROJ, "edit", "hf", "renders")
FINAL = os.path.join(RENDERS, "full_v2.mp4")
OUT = os.path.join(PROJ, "RENDER_PROGRESS.txt")
TOTAL = 11725  # 390.83s * 30fps

def count(d):
    return sum(len(files) for _, _, files in os.walk(d)) if os.path.isdir(d) else 0

def newest_work():
    ws = sorted(glob.glob(os.path.join(RENDERS, "work-*")), key=os.path.getmtime)
    return ws[-1] if ws else None

def bar(pct):
    n = int(pct / 4)
    return "[" + "#" * n + "." * (25 - n) + "]"

start = time.time()
while True:
    now = datetime.now().strftime("%H:%M:%S")
    if os.path.exists(FINAL) and os.path.getsize(FINAL) > 1_000_000:
        with open(OUT, "w") as f:
            f.write(f"RENDER COMPLETE  100%  {bar(100)}\n"
                    f"file: {FINAL}\nfinished: {now}\n")
        break
    work = newest_work()
    if not work:
        msg = f"starting up (compiling / fetching fonts)...  {now}"
        pct = 0
    else:
        wsum = count(os.path.join(work, "capture-attempt-0", "worker-0")) + \
               count(os.path.join(work, "capture-attempt-0", "worker-1"))
        cap = count(os.path.join(work, "captured-frames"))
        frames = max(wsum, cap)
        pct = min(frames / TOTAL * 100, 99.0)
        phase = "encoding + assembling video..." if frames >= TOTAL - 30 else "capturing frames"
        msg = f"{phase}  ({frames}/{TOTAL} frames)"
    with open(OUT, "w") as f:
        f.write(f"LM Studio video — full draft render\n"
                f"{bar(pct)}  {pct:5.1f}%\n"
                f"{msg}\nupdated: {now}   elapsed: {int(time.time()-start)}s\n")
    time.sleep(6)