Repository navigation
Expand file tree
/
Copy pathstudio.py
More file actions
472 lines (460 loc) · 28 KB
/
Copy pathstudio.py
File metadata and controls
472 lines (460 loc) · 28 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
#!/usr/bin/env python3
"""Social Motion Studio: local jobs, skill routing, assembly and evidence checks."""
import argparse
import json
import shlex
import subprocess
import sys
from datetime import date, datetime, timezone
from pathlib import Path
if hasattr(sys.stdout, "reconfigure"):
sys.stdout.reconfigure(encoding="utf-8")
sys.stderr.reconfigure(encoding="utf-8")
sys.path.insert(0, str(Path(__file__).resolve().parent / "scripts"))
import studio_core as core
from assembly import assemble
from edit_bridge import OPS as EDIT_OPS, edit as run_edit
import backgrounds_catalog
import bg_video
import motion_catalog
import shotcraft_pack
import motion_directions
import motion_lint
import sfx_catalog
import style_atlas
import unslop_story
import environment
import creative_skills
import kinetic_adapter
import walk_talk
import director_suite
import editor_workspace
import prompt_bank
import film_commands
import film_plan
import film_variants
import shotcraft_compose
def emit(value):
print(json.dumps(value, ensure_ascii=False, indent=2))
def job_path(value):
root = (core.ROOT / "output/jobs").resolve()
candidate = Path(value)
path = candidate.resolve() if candidate.is_absolute() else (core.ROOT / value).resolve()
if not path.is_relative_to(root) or not (path / "job.json").is_file():
raise ValueError("Wskaż istniejącą produkcję wewnątrz output/jobs/")
return path
def doctor():
report = environment.inspect()
core.write(core.ROOT / "output/system/doctor.json", report)
return report
def main():
parser = argparse.ArgumentParser(description=__doc__)
sub = parser.add_subparsers(dest="command", required=True)
film_commands.add_parsers(sub)
p = sub.add_parser("prompts", help="30 offline HyperFrames implementation recipes")
p.add_argument("action", choices=("list", "find", "show"))
p.add_argument("query", nargs="?", default="")
p.add_argument("--category", choices=("3d", "paper", "data", "ui-type"))
p = sub.add_parser("editor", help="Media inventory, visual choices, preferences, edit plan, review and export QA")
p.add_argument("action", choices=("inventory", "directions", "preferences", "plan", "review", "feedback-import", "qa"))
p.add_argument("job")
p.add_argument("--source", help="Job-relative JSON update/import")
p.add_argument("--render", help="Job-relative rendered video")
p.add_argument("--previous", help="Job-relative previous version for comparison")
p = sub.add_parser("walk-talk", help="Prepare and compose vertical presenter reels; no paid generation")
ws = p.add_subparsers(dest="walk_talk_action", required=True)
wp = ws.add_parser("prepare", help="Create editable script/timing/shot/sound planning files")
wp.add_argument("job")
wp.add_argument("--mode", choices=walk_talk.MODES, default="footage")
wp = ws.add_parser("compose", help="Compose registered base footage, optional alpha foreground and timed text")
wp.add_argument("job")
p = sub.add_parser("director", help="Beat sheets, upstream handoffs, narration cues and point-to-edit feedback")
p.add_argument("action", choices=("plan", "qa", "handoff", "captions", "feedback", "feedback-list"))
p.add_argument("job")
p.add_argument("--profile", choices=director_suite.PROFILES, default="launch")
p.add_argument("--alignment", help="Job-relative existing alignment JSON for captions")
p.add_argument("--at", type=float, help="Feedback time in seconds")
p.add_argument("--x", type=float, help="Feedback horizontal location normalized to 0..1")
p.add_argument("--y", type=float, help="Feedback vertical location normalized to 0..1")
p.add_argument("--comment", help="Point-specific change request")
p.add_argument("--overwrite", action="store_true", help="Explicitly replace generated files")
p = sub.add_parser("demo", help="Create the bundled synthetic HyperFrames launch film")
p.add_argument("--format", choices=core.FORMATS, default="16:9")
p.add_argument("--render", action="store_true")
p = sub.add_parser("render-html", help="Lint and render a job's source/index.html with pinned HyperFrames")
p.add_argument("job")
p.add_argument("--name", default="hyperframes")
p.add_argument("--quality", choices=("draft", "standard", "high"), default="standard")
p = sub.add_parser("render-hype", help="Renderuj jawny projekt .hype przez zainstalowany Hypermotion")
p.add_argument("job")
p.add_argument("--scene", default="source/index.hype")
p.add_argument("--name", default="hypermotion")
p = sub.add_parser("render-kinetic", help="Render the selected Kinetic Film composition, verify motion and record provenance")
p.add_argument("job")
p.add_argument("--name", default="kinetic")
p.add_argument("--res", choices=kinetic_adapter.SIZES, default="1080")
p.add_argument("--samples", type=int, choices=(2, 4, 8), default=4)
p.add_argument("--audio", help="Premixed score asset ID registered with asset-add")
p = sub.add_parser("kinetic", help="Prepare the pinned optional Kinetic Film engine and local compositions")
ks = p.add_subparsers(dest="kinetic_action", required=True)
kp = ks.add_parser("setup", help="Verify and cache an explicitly supplied official engine package")
kp.add_argument("--source", type=Path, required=True)
ks.add_parser("doctor", help="Offline optional-engine readiness; no provider or browser-export claim")
kp = ks.add_parser("prepare", help="Create an editable composition without overwriting source")
kp.add_argument("job")
kp.add_argument("--example", choices=("starter", "social-motion-agent"), default="starter")
kp = ks.add_parser("demo", help="Reproduce the owner's kinetic-launch demo without paid generation")
kp.add_argument("--render", action="store_true")
kp.add_argument("--res", choices=kinetic_adapter.SIZES, default="720")
kp.add_argument("--samples", type=int, choices=(2, 4, 8), default=2)
sub.add_parser("map", help="Krótka mapa dostępnych ścieżek")
sub.add_parser("doctor", help="Sprawdź lokalne narzędzia i ścieżki, bez sekretów i sieci")
p = sub.add_parser("setup", help="Sprawdź środowisko i zainstaluj przypięte zależności lokalnie")
p.add_argument("--with-library", action="store_true", help="Pobierz także pełną bibliotekę przypiętych źródeł i sprawdź jej integralność")
p = sub.add_parser("skills", help="Dobierz i przygotuj przypięte skille do filmu, strony lub animacji UI")
p.add_argument("action", choices=("plan", "setup", "check"))
p.add_argument("--mode", choices=creative_skills.MODES, required=True)
p = sub.add_parser("route", help="Pokaż wybrane skille i oczekiwane wyniki")
p.add_argument("kind", choices=core.routes())
p = sub.add_parser("find", help="Szukaj w katalogu bez czytania wszystkich SKILL.md")
p.add_argument("query")
p.add_argument("--limit", type=int, default=12)
p.add_argument("--source")
p = sub.add_parser("shotcraft", help="ShotCraft: gallery, curated shot recipes and frame-accurate storyboards")
p.add_argument("action", choices=("list", "show", "plan", "validate", "compose"))
p.add_argument("--job", help="Target job for an editable composition")
p.add_argument("--spec", help="Job-relative JSON with words or registered image IDs")
p.add_argument("--overwrite", action="store_true")
p.add_argument("query", nargs="?", default="", help="Shot ID for show or sequence ID for plan")
p.add_argument("--duration", type=float, default=15, help="Storyboard length in seconds (5-120)")
p.add_argument("--fps", type=int, default=30, help="24, 25, 30, 50 or 60")
p.add_argument("--brand", default="", help="Brand name; never inferred")
p.add_argument("--cta", default="", help="User-approved CTA")
p = sub.add_parser("motion", help="Katalog 637 efektów ruchu: find, show, recipe; presets; lint HTML (film, nie slajdy)")
p.add_argument("action", choices=("find", "show", "recipe", "presets", "lint"))
p.add_argument("query", nargs="?", default="", help="find: fraza; show: slug efektu; recipe: slug receptury; lint: plik HTML")
p.add_argument("--purpose")
p.add_argument("--medium")
p.add_argument("--family")
p.add_argument("--level")
p.add_argument("--rendered", action="store_true", help="tylko efekty z gotowym klipem i szablonem HTML")
p.add_argument("--limit", type=int, default=12)
p = sub.add_parser("directions", help="Menu kierunków motion: 10 stylów, 19 konceptów openerów, 6 explainerów, tło, przejścia; brief i porównanie odcisków")
p.add_argument("action", choices=("list", "show", "brief", "compare", "session"))
p.add_argument("query", nargs="*", help="list: menu; show: slug lub numer konceptu; compare: dwa odciski struktury")
p.add_argument("--for", dest="subject", default="", help="brief: produkt, odbiorca, nastrój")
p.add_argument("--kind", choices=("opener", "explainer"), default="opener")
p.add_argument("--mode", choices=("footage", "product", "explainer"), default="footage", help="session: rodzaj pracy montażowej")
p.add_argument("--previous", help="brief: odcisk poprzedniego filmu do porównania")
p = sub.add_parser("styles", help="Atlas 14 stylów (12 Opus + 2 explainery): list, recipe, find, show")
p.add_argument("action", choices=("list", "recipe", "find", "show"))
p.add_argument("query", nargs="?", default="", help="recipe: slug stylu; find: fraza; show: ID promptu")
p.add_argument("--style", help="Filtruj po slugu z atlasu, np. isometric-line-art lub flat-vector")
p.add_argument("--category", help="Filtruj po kategorii z awesome-opus5-5-videos")
p.add_argument("--tech", help="Filtruj po technologii: canvas-2d, html-css, svg, three-js, webgl-shader")
p.add_argument("--remake", action="store_true", help="Pokaż szkielet <inputs>/<direction>/<structure>/<build>/<gotchas> dla podagenta")
p.add_argument("--limit", type=int, default=12)
p = sub.add_parser("unslop-story", help="Wygeneruj deterministyczną 4-etapową scenę Before->After Redline Story (window.seek(t))")
p.add_argument("output", type=Path, help="Ścieżka wyjściowa pliku HTML wewnątrz repozytorium")
p.add_argument("--title", default="UI Transformation Story", help="Tytuł sceny")
p.add_argument("--ramp", choices=unslop_story.RAMPS, default="graphite", help="Rampa neutralna z tokenów")
p.add_argument("--duration", type=float, default=12.0, help="Czas trwania sceny w sekundach")
p = sub.add_parser("sfx", help="Biblioteka SOUND EFFECTS: find, check, build (efekty nigdy powyżej 0.5 głośności)")
p.add_argument("action", choices=("find", "check", "build"))
p.add_argument("query", nargs="?", default="")
p.add_argument("--category")
p.add_argument("--max-duration", type=float)
p.add_argument("--limit", type=int, default=15)
p = sub.add_parser("background", help="Tło z obrazu jako klip wideo (najazd, dryf albo statyczne)")
p.add_argument("image", type=Path)
p.add_argument("output", type=Path)
p.add_argument("--duration", type=float, required=True)
p.add_argument("--format", choices=core.FORMATS, default="9:16")
p.add_argument("--motion", choices=("push", "drift", "none"), default="push")
p.add_argument("--amount", type=float, default=0.12)
p = sub.add_parser("polish", help="Kontrola dopracowania ramki HTML: pomiary tekstu, bezpieczne pole, bramki UX")
p.add_argument("html", type=Path)
p.add_argument("--format", choices=core.FORMATS, default="16:9")
p.add_argument("--seek", type=float, help="sekunda sceny; domyślnie koniec animacji")
p.add_argument("--shot", type=Path, help="zapisz zrzut PNG")
p.add_argument("--no-upstream", action="store_true")
p = sub.add_parser("new", help="Załóż produkcję; nie uruchamia usług ani generacji")
p.add_argument("title")
p.add_argument("--kind", choices=core.routes())
p.add_argument("--brief", help="Film brief for route selection; defaults to title")
p.add_argument("--profile", default="local", help="Local viewer or series whose feedback guides this job")
p.add_argument("--format", choices=core.FORMATS)
p.add_argument("--duration", type=float)
p.add_argument("--language", default="pl")
for name in ("resume", "pack"):
p = sub.add_parser(name)
p.add_argument("job")
p = sub.add_parser("check", help="Sprawdź dowody wymagane dla etapu")
p.add_argument("job")
p.add_argument("--stage", choices=core.STAGES, required=True)
p = sub.add_parser("asset-add", help="Skopiuj asset i zapisz pochodzenie")
p.add_argument("job")
p.add_argument("--file", type=Path, required=True)
for option in ("source", "rights", "purpose"):
p.add_argument("--" + option, required=True)
p.add_argument("--provider")
p.add_argument("--endpoint")
p.add_argument("--request-id")
p.add_argument("--prompt-file", type=Path)
p = sub.add_parser("render-assembly", help="Zmontuj timeline przez lokalny FFmpeg")
p.add_argument("job")
p = sub.add_parser("edit", help="Edytuj zarejestrowany asset: efekty (fx) lub vstudio; sam robi probe i sheet")
p.add_argument("job")
p.add_argument("op", choices=EDIT_OPS)
p.add_argument("--asset", action="append", required=True, help="ID z asset-add; concat przyjmuje kilka")
p.add_argument("--name", required=True, help="Nowa nazwa renderu (bez rozszerzenia)")
p.add_argument("--spec", help="fx: JSON z efektami względem katalogu produkcji, np. source/effects.json")
p.add_argument("--effect", action="append", default=[], help="fx: np. punch_in:start=1,end=2.2,zoom=1.3")
p.add_argument("--vstudio-args", default="", help="Dodatkowe argumenty vstudio edit, np. \"--start 1.5 --end 9\"")
for name in ("probe", "sheet"):
p = sub.add_parser(name)
p.add_argument("job")
p.add_argument("--render", required=True, help="Ścieżka względem katalogu produkcji")
args = parser.parse_args()
try:
if args.command in ("plan", "selects", "variants"):
return film_commands.run(args, job_path, emit)
if args.command == "prompts":
emit(prompt_bank.query(args.action, args.query, args.category))
elif args.command == "editor":
folder = job_path(args.job)
action = args.action
if action in ("inventory", "directions"):
result = getattr(editor_workspace, action)(folder)
elif action in ("preferences", "plan"):
result = getattr(editor_workspace, action)(folder, args.source)
elif action == "feedback-import":
if not args.source:
raise ValueError("Provide --source")
result = editor_workspace.import_feedback(folder, args.source)
else:
if not args.render:
raise ValueError("Provide --render")
result = (editor_workspace.review(folder, args.render, args.previous) if action == "review"
else editor_workspace.quality(folder, args.render))
emit(result)
return int(action == "qa" and not result["technical_passed"])
elif args.command == "walk-talk":
folder = job_path(args.job)
emit(walk_talk.prepare(folder, args.mode) if args.walk_talk_action == "prepare" else walk_talk.compose(folder))
elif args.command == "director":
folder = job_path(args.job)
if args.action == "plan":
emit(director_suite.plan(folder, args.profile, overwrite=args.overwrite))
elif args.action == "qa":
emit(director_suite.analyze(folder, args.profile))
elif args.action == "handoff":
emit(director_suite.handoff(folder, args.profile, overwrite=args.overwrite))
elif args.action == "captions":
if not args.alignment:
raise ValueError("Provide --alignment source/alignment.json (measured word times)")
emit(director_suite.captions(folder, args.alignment, overwrite=args.overwrite))
elif args.action == "feedback":
if any(value is None for value in (args.at, args.x, args.y, args.comment)):
raise ValueError("Provide --at SECONDS --x 0..1 --y 0..1 --comment TEXT")
emit(director_suite.point_feedback(folder, args.at, args.x, args.y, args.comment))
else:
emit(director_suite.list_feedback(folder))
elif args.command == "demo":
from demo import create_demo
folder = create_demo(args.format)
result = {"job": str(folder), "synthetic_demo": True, "reviewed": False}
if args.render:
from hyperframes_adapter import render
result.update(film_variants.after_render(folder, render(folder, "demo", "draft")))
emit(result)
return int(args.render and not result["probe_passed"])
elif args.command == "kinetic":
if args.kinetic_action == "setup":
emit(kinetic_adapter.setup(args.source))
elif args.kinetic_action == "doctor":
report = kinetic_adapter.doctor()
emit(report)
return int(not report["ready"])
elif args.kinetic_action == "prepare":
emit(kinetic_adapter.prepare(job_path(args.job), args.example))
else:
folder = kinetic_adapter.demo()
result = {"job": str(folder), "reviewed": False, "paid_generation": False}
if args.render:
result.update(film_variants.after_render(folder, kinetic_adapter.render(folder, "kinetic-demo", args.res, args.samples)))
emit(result)
return int(args.render and not result["probe_passed"])
elif args.command == "map":
emit({key: value["purpose"] for key, value in core.routes().items()})
elif args.command == "doctor":
report = doctor()
emit(report)
return int(not report["ready"])
elif args.command == "setup":
report = environment.setup(with_library=args.with_library)
emit(report)
return int(not report["setup"]["passed"])
elif args.command == "route":
route = dict(core.routes()[args.kind])
route["read_first"] = core.read(core.ROOT / "config/routes.json")["always_read"]
route["resolved_skills"] = [{"path": str(core.resolve_ref(p)), "exists": core.resolve_ref(p).is_file()} for p in route["skills"]]
route["resolved_optional_skills"] = [{"path": str(core.resolve_ref(p)), "exists": core.resolve_ref(p).is_file()}
for p in route.get("optional_skills", [])]
emit(route)
elif args.command == "skills":
if args.action == "plan":
emit(creative_skills.plan(args.mode))
else:
report = creative_skills.prepare(args.mode, check=args.action == "check")
emit(report)
return int(not report["passed"])
elif args.command == "find":
tokens = args.query.casefold().split()
entries = core.read(core.ROOT / "skills/catalog.json")["entries"]
entries = [*entries, kinetic_adapter.catalog_entry(), walk_talk.catalog_entry()]
found = [item for item in entries if item["kind"] != "fixture" and (not args.source or item["source"] == args.source) and
all(token in " ".join(str(item.get(key, "")) for key in ("name", "description", "source", "path")).casefold() for token in tokens)]
emit({"total_matches": len(found), "entries": found[:max(1, min(args.limit, 100))]})
elif args.command == "shotcraft":
if args.action == "list":
emit(shotcraft_pack.list_shots())
elif args.action == "show":
emit(shotcraft_pack.show(args.query))
elif args.action == "validate":
emit(shotcraft_pack.validate())
elif args.action == "compose":
if not args.job or not args.spec:
raise ValueError("Provide --job and --spec")
emit(shotcraft_compose.compose(job_path(args.job), args.query, args.spec, args.overwrite))
else:
emit(shotcraft_pack.plan(args.query, args.duration, args.fps, args.brand, args.cta))
elif args.command == "motion":
if args.action == "find":
emit(motion_catalog.find(args.query, args.purpose, args.medium, args.family, args.level, args.rendered, args.limit))
elif args.action == "show":
emit(motion_catalog.show(args.query))
elif args.action == "presets":
emit(motion_catalog.presets(args.query or None))
elif args.action == "lint":
if not args.query:
raise ValueError("Podaj plik HTML: studio.py motion lint scena.html")
report = motion_lint.lint(Path(args.query))
emit(report)
return int(not report["passed"])
else:
emit(motion_catalog.recipe(args.query or None))
elif args.command == "directions":
if args.action == "list":
emit(motion_directions.list_menus(args.query[0] if args.query else None))
elif args.action == "show":
if len(args.query) != 1:
raise ValueError("Podaj jeden slug, np. studio.py directions show grainy-gradient")
emit(motion_directions.show(args.query[0]))
elif args.action == "session":
emit(motion_directions.session(args.subject or " ".join(args.query), args.mode))
elif args.action == "brief":
emit(motion_directions.brief(args.subject or " ".join(args.query), args.kind, args.previous))
else:
if len(args.query) != 2:
raise ValueError("Podaj dwa odciski w cudzysłowie: 'koncept · sceny · obiekty · otwarcie · zakończenie'")
emit(motion_directions.compare(*args.query))
elif args.command == "styles":
if args.action == "list":
emit(style_atlas.list_styles())
elif args.action == "recipe":
emit(style_atlas.recipe(args.query or args.style or None))
elif args.action == "find":
emit(style_atlas.find(args.query, style=args.style, category=args.category, tech=args.tech, remake_only=args.remake, limit=args.limit))
else:
emit(style_atlas.show(args.query, remake=args.remake))
elif args.command == "unslop-story":
emit(unslop_story.write_story(args.output, title=args.title, ramp=args.ramp, duration=args.duration))
elif args.command == "sfx":
if args.action == "find":
emit(sfx_catalog.find(args.query, args.category, args.max_duration, args.limit))
elif args.action == "build":
data = sfx_catalog.build()
emit({"indexed": data["count"], "index": str(sfx_catalog.INDEX)})
else:
problems = sfx_catalog.check()
emit({"passed": not problems, "problems": problems})
return int(bool(problems))
elif args.command == "background":
emit(bg_video.render(args.image, args.output, args.duration, args.format, args.motion, args.amount))
elif args.command == "polish":
command = [sys.executable, "-I", str(core.ROOT / "scripts/polish_check.py"), str(args.html), "--format", args.format]
command += ["--seek", str(args.seek)] if args.seek is not None else []
command += ["--shot", str(args.shot)] if args.shot else []
command += ["--no-upstream"] if args.no_upstream else []
result = subprocess.run(command, capture_output=True, text=True, encoding="utf-8", errors="replace", timeout=600)
print(result.stdout, end="")
if result.returncode and result.stderr:
print(result.stderr[-1500:], file=sys.stderr)
return result.returncode
elif args.command == "new":
brief = args.brief or args.title
plan = film_plan.plan(brief, kind=args.kind, profile=args.profile)
duration = args.duration if args.duration is not None else plan["duration_sec"]
folder = core.create_job(args.title, plan["route"], args.format or plan["format"], duration,
args.language, style_profile=args.profile)
emit({"job": str(folder), "plan": film_plan.plan(brief, folder),
"next": "Uzupełnij znane decyzje, zarejestruj materiały i przygotuj trzy wersje."})
else:
folder = job_path(args.job)
if args.command == "check":
errors = core.check_job(folder, args.stage)
emit({"stage": args.stage, "passed": not errors, "errors": errors})
return int(bool(errors))
if args.command == "resume":
job = core.read(folder / "job.json")
for stage in core.STAGES:
errors = core.check_job(folder, stage)
if errors:
emit({"job": job, "next_stage": stage, "missing": errors, "route": core.routes()[job["kind"]], "handoff": str(folder / "HANDOFF.md")})
break
else:
emit({"job": job, "next": "Gotowe do pack; publikacja wymaga zgody"})
elif args.command == "asset-add":
metadata = {key: value for key, value in {"provider": args.provider, "endpoint": args.endpoint,
"request_id": args.request_id,
"prompt": args.prompt_file.read_text(encoding="utf-8-sig") if args.prompt_file else None}.items() if value}
emit(core.register_asset(folder, args.file, args.source, args.rights, args.purpose, **metadata))
elif args.command == "render-html":
from hyperframes_adapter import render
result = render(folder, args.name, args.quality)
emit(film_variants.after_render(folder, result))
return int(not result["probe_passed"])
elif args.command == "render-kinetic":
result = kinetic_adapter.render(folder, args.name, args.res, args.samples, args.audio)
emit(film_variants.after_render(folder, result))
return int(not result["probe_passed"])
elif args.command == "render-assembly":
errors = core.check_job(folder, "assets")
if errors:
raise ValueError("\n".join(errors))
emit(film_variants.after_render(folder, {"render": str(assemble(folder)), "reviewed": False}))
elif args.command == "render-hype":
from hypermotion_adapter import render
result = render(folder, args.name, args.scene)
emit(film_variants.after_render(folder, result))
return int(not result["probe_passed"])
elif args.command == "edit":
result = run_edit(folder, args.op, args.asset, args.name, args.spec, args.effect,
shlex.split(args.vstudio_args))
emit(film_variants.after_render(folder, result))
return int(not result["probe_passed"])
elif args.command == "probe":
result = core.probe_job(folder, args.render)
emit({key: value for key, value in result.items() if key != "ffprobe"})
return int(not result["passed"])
elif args.command == "sheet":
emit({"contact_sheet": str(core.contact_sheet(folder, args.render))})
elif args.command == "pack":
emit({"package": str(core.package_job(folder)), "published": False})
return 0
except (OSError, ValueError, KeyError, TypeError, subprocess.SubprocessError) as exc:
print(str(exc), file=sys.stderr)
return 1
if __name__ == "__main__":
raise SystemExit(main())