PROP OUT looks in this weekend's Location Assets folder, read on NA Ingest
- prop_bundle_folder takes {date} (the plan's weekend, as the tracks folders): any bundle there counts
- readiness scripts for this Mac run here (NA ProP's Google Drive showed 261025 empty)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+23
-7
@@ -137,9 +137,11 @@ def ssh_argv(cfg, host):
|
||||
|
||||
|
||||
def run_remote(cfg, host, script, timeout=60):
|
||||
"""Run a Python script on another Mac (on stdin, at low priority); its last line is JSON."""
|
||||
r = subprocess.run(ssh_argv(cfg, host) + ["nice -n 19 /usr/bin/python3 -"], input=script,
|
||||
capture_output=True, text=True, timeout=timeout)
|
||||
"""Run a Python script on another Mac (on stdin, at low priority), or here when `host` is this Mac
|
||||
(NA Ingest's Google Drive is current; NA ProP's lagged a day behind, 2026-10-21); its last line is JSON."""
|
||||
here = ((cfg.get("hosts") or {}).get(host) or {}).get("self")
|
||||
argv = ["/usr/bin/nice", "-n", "19", "/usr/bin/python3", "-"] if here else ssh_argv(cfg, host) + ["nice -n 19 /usr/bin/python3 -"]
|
||||
r = subprocess.run(argv, input=script, capture_output=True, text=True, timeout=timeout)
|
||||
if r.returncode == 255:
|
||||
raise ReadyError("%s UNREACHABLE" % host.upper())
|
||||
lines = [ln for ln in r.stdout.strip().splitlines() if ln.strip()]
|
||||
@@ -971,8 +973,21 @@ print(json.dumps(sorted([[os.path.basename(f), os.path.getmtime(f)] for f in fil
|
||||
'''
|
||||
|
||||
|
||||
def eval_prop_bundle(rc, files, since):
|
||||
def prop_bundle_folder(rc, plan):
|
||||
"""Where this weekend's bundle goes: "{date}" is the weekend's folder (Location Assets/261025, the
|
||||
user 2026-10-21: "it should be looking at the latest weekends folder in location assets")."""
|
||||
return str(rc.get("prop_bundle_folder", "")).replace("{date}", datetime.fromtimestamp(plan["time"]).strftime("%y%m%d"))
|
||||
|
||||
|
||||
def eval_prop_bundle(rc, files, since, folder=None):
|
||||
line = Line()
|
||||
if "{date}" in str(rc.get("prop_bundle_folder", "")):
|
||||
# This weekend's own folder: any bundle in it is this weekend's.
|
||||
if not files:
|
||||
line.fault(ERR, "NOT IN " + os.path.basename(str(folder or "").rstrip("/")), "no %s in %s" % (rc.get("prop_bundle_pattern"), folder))
|
||||
else:
|
||||
line.info = "SENT " + datetime.fromtimestamp(files[0][1]).strftime("%a %H:%M").upper()
|
||||
return line
|
||||
fresh = [f for f in files if f[1] >= since]
|
||||
if not fresh:
|
||||
last = datetime.fromtimestamp(files[0][1]).strftime("%-m/%-d") if files else "NEVER"
|
||||
@@ -1021,8 +1036,8 @@ def look(cfg, now=None, data_dir=None, sources=None):
|
||||
resolume=lambda: http_json(rc.get("resolume_url", "").rstrip("/") + "/api/v1/composition", timeout=6),
|
||||
macros=lambda paths: run_remote(cfg, rc["prop_host"], MACRO_SCRIPT % json.dumps({"paths": paths}), timeout=60),
|
||||
companion=lambda n: companion_page(cfg, n),
|
||||
prop_bundle=lambda: run_remote(cfg, rc["prop_bundle_host"], BUNDLE_SCRIPT % json.dumps(
|
||||
{"folder": rc.get("prop_bundle_folder", ""), "pattern": rc.get("prop_bundle_pattern", "*.probundle")}), timeout=30))
|
||||
prop_bundle=lambda plan: run_remote(cfg, rc["prop_bundle_host"], BUNDLE_SCRIPT % json.dumps(
|
||||
{"folder": prop_bundle_folder(rc, plan), "pattern": rc.get("prop_bundle_pattern", "*.probundle")}), timeout=30))
|
||||
src.update(sources or {})
|
||||
lines = {}
|
||||
|
||||
@@ -1103,7 +1118,8 @@ def look(cfg, now=None, data_dir=None, sources=None):
|
||||
lines["mics"] = mics
|
||||
if rc.get("prop_bundle_host"):
|
||||
try:
|
||||
lines["prop_bundle"] = eval_prop_bundle(rc, src["prop_bundle"](), week_start(now, rc.get("reset_day", "mon")))
|
||||
lines["prop_bundle"] = eval_prop_bundle(rc, src["prop_bundle"](plan), week_start(now, rc.get("reset_day", "mon")),
|
||||
prop_bundle_folder(rc, plan))
|
||||
except Exception as e: # noqa: BLE001
|
||||
failed(["prop_bundle"], e)
|
||||
out = {"time": now, "items": {k: v.as_dict() for k, v in lines.items()}}
|
||||
|
||||
Reference in New Issue
Block a user