Prompt48 commited on
Commit
a2a2dbd
·
verified ·
1 Parent(s): db7f71a

Upload edit\progress_watch.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. edit//progress_watch.py +46 -0
edit//progress_watch.py ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Watch the active HyperFrames render and write live % to RENDER_PROGRESS.txt."""
2
+ import glob, os, time
3
+ from datetime import datetime
4
+
5
+ PROJ = r"D:\PromptEngineer48\In-Progress\P11-Editor"
6
+ RENDERS = os.path.join(PROJ, "edit", "hf", "renders")
7
+ FINAL = os.path.join(RENDERS, "full_v2.mp4")
8
+ OUT = os.path.join(PROJ, "RENDER_PROGRESS.txt")
9
+ TOTAL = 11725 # 390.83s * 30fps
10
+
11
+ def count(d):
12
+ return sum(len(files) for _, _, files in os.walk(d)) if os.path.isdir(d) else 0
13
+
14
+ def newest_work():
15
+ ws = sorted(glob.glob(os.path.join(RENDERS, "work-*")), key=os.path.getmtime)
16
+ return ws[-1] if ws else None
17
+
18
+ def bar(pct):
19
+ n = int(pct / 4)
20
+ return "[" + "#" * n + "." * (25 - n) + "]"
21
+
22
+ start = time.time()
23
+ while True:
24
+ now = datetime.now().strftime("%H:%M:%S")
25
+ if os.path.exists(FINAL) and os.path.getsize(FINAL) > 1_000_000:
26
+ with open(OUT, "w") as f:
27
+ f.write(f"RENDER COMPLETE 100% {bar(100)}\n"
28
+ f"file: {FINAL}\nfinished: {now}\n")
29
+ break
30
+ work = newest_work()
31
+ if not work:
32
+ msg = f"starting up (compiling / fetching fonts)... {now}"
33
+ pct = 0
34
+ else:
35
+ wsum = count(os.path.join(work, "capture-attempt-0", "worker-0")) + \
36
+ count(os.path.join(work, "capture-attempt-0", "worker-1"))
37
+ cap = count(os.path.join(work, "captured-frames"))
38
+ frames = max(wsum, cap)
39
+ pct = min(frames / TOTAL * 100, 99.0)
40
+ phase = "encoding + assembling video..." if frames >= TOTAL - 30 else "capturing frames"
41
+ msg = f"{phase} ({frames}/{TOTAL} frames)"
42
+ with open(OUT, "w") as f:
43
+ f.write(f"LM Studio video — full draft render\n"
44
+ f"{bar(pct)} {pct:5.1f}%\n"
45
+ f"{msg}\nupdated: {now} elapsed: {int(time.time()-start)}s\n")
46
+ time.sleep(6)