@clipen/clipen-cli 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -48
- package/apps/web/dist/assets/{index-D5D2HiB1.js → index-DPHwA954.js} +1 -1
- package/apps/web/dist/index.html +1 -1
- package/bin/clipen.js +1 -1
- package/package.json +7 -6
- package/pyproject.toml +18 -2
- package/requirements/dev.txt +2 -0
- package/src/clipen/__init__.py +1 -1
- package/src/clipen/analysis/__init__.py +7 -7
- package/src/clipen/analysis/artifacts.py +4 -10
- package/src/clipen/analysis/audio.py +10 -8
- package/src/clipen/analysis/evidence_service.py +345 -167
- package/src/clipen/analysis/image_similarity.py +5 -14
- package/src/clipen/analysis/keyframes.py +5 -17
- package/src/clipen/analysis/models.py +5 -7
- package/src/clipen/analysis/qwen_worker.py +19 -54
- package/src/clipen/analysis/resources.py +2 -1
- package/src/clipen/analysis/runtime.py +1 -3
- package/src/clipen/analysis/service.py +16 -48
- package/src/clipen/analysis/setup.py +11 -25
- package/src/clipen/analysis/setup_cli.py +5 -15
- package/src/clipen/analysis/storage.py +96 -278
- package/src/clipen/analysis/transcription.py +40 -82
- package/src/clipen/analysis/visual.py +109 -48
- package/src/clipen/annotations/__init__.py +5 -2
- package/src/clipen/annotations/models.py +1 -1
- package/src/clipen/annotations/storage.py +132 -84
- package/src/clipen/annotations/suggestions.py +3 -8
- package/src/clipen/asr_release.py +4 -11
- package/src/clipen/bootstrap.py +71 -61
- package/src/clipen/{planning/models.py → candidates.py} +29 -47
- package/src/clipen/cli.py +4 -9
- package/src/clipen/controller/app.py +401 -214
- package/src/clipen/controller/server.py +28 -38
- package/src/clipen/domain/__init__.py +1 -1
- package/src/clipen/domain/media_time.py +3 -10
- package/src/clipen/domain/timeline.py +45 -47
- package/src/clipen/domain/validation.py +0 -1
- package/src/clipen/editing/__init__.py +1 -1
- package/src/clipen/editing/agent_models.py +4 -11
- package/src/clipen/editing/agent_repository.py +393 -172
- package/src/clipen/editing/agent_tools.py +180 -99
- package/src/clipen/editing/alignment.py +92 -52
- package/src/clipen/editing/alignment_setup.py +118 -70
- package/src/clipen/editing/alignment_worker.py +11 -9
- package/src/clipen/editing/change_report.py +95 -38
- package/src/clipen/editing/compiler.py +0 -1
- package/src/clipen/editing/component_looks.py +58 -34
- package/src/clipen/editing/component_review.py +34 -38
- package/src/clipen/editing/coordinator.py +213 -92
- package/src/clipen/editing/editorial_review.py +217 -95
- package/src/clipen/editing/evidence_jobs.py +457 -200
- package/src/clipen/editing/history_changes.py +129 -68
- package/src/clipen/editing/music_choices.py +8 -5
- package/src/clipen/editing/production_catalog.py +573 -136
- package/src/clipen/editing/production_limits.py +43 -17
- package/src/clipen/editing/production_media.py +376 -167
- package/src/clipen/editing/production_preview.py +322 -129
- package/src/clipen/editing/production_progress.py +164 -69
- package/src/clipen/editing/production_requirements.py +106 -39
- package/src/clipen/editing/production_tools.py +1064 -462
- package/src/clipen/editing/program_audio.py +211 -81
- package/src/clipen/editing/program_direction.py +59 -25
- package/src/clipen/editing/program_story.py +83 -45
- package/src/clipen/editing/program_subtitles.py +194 -96
- package/src/clipen/editing/programme_review.py +98 -50
- package/src/clipen/editing/prompt_history.py +64 -27
- package/src/clipen/editing/recut.py +65 -25
- package/src/clipen/editing/refinement_references.py +176 -86
- package/src/clipen/editing/resolve_export.py +449 -218
- package/src/clipen/editing/resolve_titles.py +162 -105
- package/src/clipen/editing/skill_tools.py +530 -154
- package/src/clipen/editing/source_dialogue.py +177 -67
- package/src/clipen/editing/speech_coverage.py +42 -22
- package/src/clipen/editing/speech_quality.py +6 -1
- package/src/clipen/editing/tool_receipts.py +78 -32
- package/src/clipen/editing/versions.py +122 -64
- package/src/clipen/editing/visual_preview.py +157 -61
- package/src/clipen/editing/workbench.py +104 -42
- package/src/clipen/finishing/audio.py +69 -30
- package/src/clipen/finishing/catalog.py +176 -93
- package/src/clipen/finishing/models.py +1 -1
- package/src/clipen/finishing/renderer.py +33 -14
- package/src/clipen/mcp_editing/__main__.py +3 -1
- package/src/clipen/mcp_editing/server.py +77 -34
- package/src/clipen/media/__init__.py +3 -3
- package/src/clipen/media/discovery.py +7 -20
- package/src/clipen/media/models.py +7 -18
- package/src/clipen/media/preview.py +14 -24
- package/src/clipen/media/probe.py +16 -44
- package/src/clipen/media/service.py +6 -19
- package/src/clipen/media/storage.py +33 -81
- package/src/clipen/music_vocabulary.py +33 -4
- package/src/clipen/power.py +8 -3
- package/src/clipen/projects/__init__.py +1 -1
- package/src/clipen/projects/deletion.py +19 -32
- package/src/clipen/projects/finishing_schema.py +3 -1
- package/src/clipen/projects/models.py +2 -5
- package/src/clipen/projects/picker.py +13 -37
- package/src/clipen/projects/service.py +8 -24
- package/src/clipen/projects/storage.py +226 -246
- package/src/clipen/provider_registry.py +9 -20
- package/src/clipen/providers/account.py +86 -35
- package/src/clipen/providers/claude.py +59 -25
- package/src/clipen/providers/claude_editing.py +14 -7
- package/src/clipen/providers/codex.py +73 -118
- package/src/clipen/providers/codex_editing.py +2 -2
- package/src/clipen/providers/editing_agent.py +19 -17
- package/src/clipen/providers/recovery.py +7 -8
- package/src/clipen/rendering/cover.py +18 -5
- package/src/clipen/rendering/custom_components.py +167 -79
- package/src/clipen/rendering/custom_render.py +62 -41
- package/src/clipen/rendering/production_effects.py +77 -45
- package/src/clipen/rendering/program_components.py +134 -73
- package/src/clipen/rendering/program_creator.py +432 -277
- package/src/clipen/rendering/program_identities.py +277 -182
- package/src/clipen/rendering/program_motion.py +140 -95
- package/src/clipen/rendering/program_studio.py +175 -116
- package/src/clipen/rendering/program_styles.py +231 -145
- package/src/clipen/rendering/program_subtitles.py +71 -34
- package/src/clipen/rendering/renderer.py +150 -121
- package/src/clipen/rendering/storage.py +9 -22
- package/src/clipen/rendering/titles.py +193 -86
- package/src/clipen/skills/__init__.py +1 -0
- package/src/clipen/skills/catalog.py +151 -55
- package/src/clipen/skills/library.py +13 -7
- package/src/clipen/skills/package.py +46 -23
- package/src/clipen/skills/visual_styles.py +29 -18
- package/src/clipen/workspace.py +15 -44
- package/install +0 -25
- package/src/clipen/planning/__init__.py +0 -9
- package/uninstall +0 -25
|
@@ -4,72 +4,102 @@ Compares stored timeline payloads, so it works for every version ever saved,
|
|
|
4
4
|
whoever made the change.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
+
|
|
7
8
|
def _components(payload):
|
|
8
|
-
return {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
return {
|
|
10
|
+
item["item_id"]: item
|
|
11
|
+
for track in payload["tracks"]
|
|
12
|
+
if track["track_id"] == "program-components" or track["track_id"].startswith("program-components-")
|
|
13
|
+
for item in track["items"]
|
|
14
|
+
}
|
|
11
15
|
|
|
12
16
|
|
|
13
17
|
def _lanes(payload):
|
|
14
18
|
"""Which component lane each graphic is on; a higher lane is drawn on top."""
|
|
15
|
-
tracks = [
|
|
16
|
-
|
|
19
|
+
tracks = [
|
|
20
|
+
t
|
|
21
|
+
for t in payload["tracks"]
|
|
22
|
+
if t["track_id"] == "program-components" or t["track_id"].startswith("program-components-")
|
|
23
|
+
]
|
|
24
|
+
return {item["item_id"]: n for n, track in enumerate(tracks) for item in track["items"]}
|
|
17
25
|
|
|
18
26
|
|
|
19
27
|
def _subtitles(payload):
|
|
20
|
-
return {
|
|
28
|
+
return {
|
|
29
|
+
item["item_id"]: item
|
|
30
|
+
for track in payload["tracks"]
|
|
31
|
+
if track["track_id"] == "agent-subtitles"
|
|
32
|
+
for item in track["items"]
|
|
33
|
+
}
|
|
21
34
|
|
|
22
35
|
|
|
23
36
|
def _media(payload, kind):
|
|
24
|
-
return [
|
|
37
|
+
return [
|
|
38
|
+
item
|
|
39
|
+
for track in payload["tracks"]
|
|
40
|
+
if track["kind"] == kind
|
|
41
|
+
for item in track["items"]
|
|
42
|
+
if item.get("kind") == "media"
|
|
43
|
+
]
|
|
25
44
|
|
|
26
45
|
|
|
27
46
|
def _name(item):
|
|
28
|
-
first = (item.get(
|
|
29
|
-
return f
|
|
47
|
+
first = (item.get("text") or "").split("\n", 1)[0].strip()
|
|
48
|
+
return f"「{first[:18]}{'…' if len(first) > 18 else ''}」" if first else "一個元件"
|
|
30
49
|
|
|
31
50
|
|
|
32
51
|
def _clock(frames, payload):
|
|
33
|
-
rate = payload[
|
|
34
|
-
seconds = round(frames * rate[
|
|
35
|
-
return f
|
|
52
|
+
rate = payload["frame_rate"]
|
|
53
|
+
seconds = round(frames * rate["den"] / rate["num"])
|
|
54
|
+
return f"{seconds // 60}:{seconds % 60:02d}"
|
|
36
55
|
|
|
37
56
|
|
|
38
57
|
def _graphic_change(before, after, styles, recut=False):
|
|
39
58
|
"""One sentence for one graphic that is in both versions, or None when it did not change."""
|
|
40
|
-
if before.get(
|
|
41
|
-
old, new = (item.get(
|
|
42
|
-
return f
|
|
43
|
-
if before.get(
|
|
44
|
-
old, new = styles.get(before.get(
|
|
45
|
-
old_look, new_look = old.get(
|
|
46
|
-
if new_look and old_look.get(
|
|
47
|
-
return f
|
|
48
|
-
if new_look and old_look != new_look and old.get(
|
|
59
|
+
if before.get("text") != after.get("text"):
|
|
60
|
+
old, new = (item.get("text", "").split("\n", 1)[0] for item in (before, after))
|
|
61
|
+
return f"把「{old}」改成「{new}」" if old != new else f"改了{_name(after)}的補充文字"
|
|
62
|
+
if before.get("style_id") != after.get("style_id"):
|
|
63
|
+
old, new = styles.get(before.get("style_id"), {}), styles.get(after.get("style_id"), {})
|
|
64
|
+
old_look, new_look = old.get("look") or {}, new.get("look") or {}
|
|
65
|
+
if new_look and old_look.get("look_id") != new_look.get("look_id") and old.get("html") == new.get("html"):
|
|
66
|
+
return f"把{_name(after)}換成「{new_look['name']}」外觀"
|
|
67
|
+
if new_look and old_look != new_look and old.get("html") == new.get("html"):
|
|
49
68
|
# Said once per look, not once per graphic that follows it.
|
|
50
|
-
return (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
return f
|
|
58
|
-
if
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
69
|
+
return (
|
|
70
|
+
"look",
|
|
71
|
+
new_look["name"],
|
|
72
|
+
old_look.get("fonts") != new_look.get("fonts"),
|
|
73
|
+
old_look.get("colors") != new_look.get("colors"),
|
|
74
|
+
)
|
|
75
|
+
if old.get("html") != new.get("html") and new.get("html"):
|
|
76
|
+
return f"重新設計{_name(after)}"
|
|
77
|
+
if old.get("edits") != new.get("edits") and new.get("html"):
|
|
78
|
+
before_edits, after_edits = old.get("edits") or {}, new.get("edits") or {}
|
|
79
|
+
words = (before_edits.get("texts") or {}) != (after_edits.get("texts") or {})
|
|
80
|
+
colours = (before_edits.get("colors") or {}) != (after_edits.get("colors") or {})
|
|
81
|
+
return f"改了{_name(after)}的" + ("文字和顏色" if words and colours else "文字" if words else "顏色")
|
|
82
|
+
if (old.get("x"), old.get("y")) != (new.get("x"), new.get("y")) and old and new:
|
|
83
|
+
return f"移動{_name(after)}"
|
|
84
|
+
if old.get("scale", 1) != new.get("scale", 1):
|
|
85
|
+
return f"{'放大' if new.get('scale', 1) > old.get('scale', 1) else '縮小'}{_name(after)}"
|
|
86
|
+
if old.get("colors") != new.get("colors"):
|
|
87
|
+
return f"換了{_name(after)}的顏色"
|
|
88
|
+
if old.get("visual_style_id") != new.get("visual_style_id"):
|
|
89
|
+
return f"{_name(after)}換了樣式"
|
|
90
|
+
if old.get("font_style_id") != new.get("font_style_id"):
|
|
91
|
+
return f"{_name(after)}換了字體"
|
|
92
|
+
if (old.get("start_offset_frames"), old.get("anchor_item_id")) == (
|
|
93
|
+
new.get("start_offset_frames"),
|
|
94
|
+
new.get("anchor_item_id"),
|
|
95
|
+
) and not recut:
|
|
96
|
+
return f"調整{_name(after)}"
|
|
70
97
|
# After a new cut every graphic shifts with its shot; that is part of the cut, not news of its own.
|
|
71
|
-
if not recut and (before[
|
|
72
|
-
|
|
98
|
+
if not recut and (before["start_frame"], before["duration_frames"]) != (
|
|
99
|
+
after["start_frame"],
|
|
100
|
+
after["duration_frames"],
|
|
101
|
+
):
|
|
102
|
+
return f"調整{_name(after)}出現的時間"
|
|
73
103
|
return None
|
|
74
104
|
|
|
75
105
|
|
|
@@ -77,55 +107,86 @@ def describe(before, after, styles=None):
|
|
|
77
107
|
"""Short sentences, most noticeable first. Empty when the pictures are the same."""
|
|
78
108
|
styles = styles or {}
|
|
79
109
|
changes = []
|
|
80
|
-
old_cut, new_cut = _media(before,
|
|
81
|
-
recut = [(i[
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
110
|
+
old_cut, new_cut = _media(before, "video"), _media(after, "video")
|
|
111
|
+
recut = [(i["start_frame"], i["duration_frames"], i.get("source")) for i in old_cut] != [
|
|
112
|
+
(i["start_frame"], i["duration_frames"], i.get("source")) for i in new_cut
|
|
113
|
+
]
|
|
114
|
+
if [(i["start_frame"], i["duration_frames"], i.get("source")) for i in old_cut] != [
|
|
115
|
+
(i["start_frame"], i["duration_frames"], i.get("source")) for i in new_cut
|
|
116
|
+
]:
|
|
117
|
+
if before["duration_frames"] != after["duration_frames"]:
|
|
118
|
+
changes.append(
|
|
119
|
+
f"重新剪輯,片長 {_clock(before['duration_frames'], before)} → {_clock(after['duration_frames'], after)}"
|
|
120
|
+
)
|
|
85
121
|
else:
|
|
86
|
-
changes.append(
|
|
87
|
-
elif [[e for e in i.get(
|
|
88
|
-
|
|
89
|
-
|
|
122
|
+
changes.append("調整剪輯")
|
|
123
|
+
elif [[e for e in i.get("effects", []) if not e.get("effect_id", "").startswith("audio.")] for i in old_cut] != [
|
|
124
|
+
[e for e in i.get("effects", []) if not e.get("effect_id", "").startswith("audio.")] for i in new_cut
|
|
125
|
+
]:
|
|
126
|
+
changes.append("調整畫面效果或轉場")
|
|
127
|
+
|
|
90
128
|
def music(cut):
|
|
91
|
-
return sorted(
|
|
92
|
-
|
|
129
|
+
return sorted(
|
|
130
|
+
{
|
|
131
|
+
layer.get("asset_id")
|
|
132
|
+
for i in cut
|
|
133
|
+
for e in i.get("effects", [])
|
|
134
|
+
if e.get("effect_id") == "audio.layers"
|
|
135
|
+
for layer in e.get("parameters", {}).get("layers", [])
|
|
136
|
+
}
|
|
137
|
+
- {None}
|
|
138
|
+
)
|
|
139
|
+
|
|
93
140
|
def sound(cut):
|
|
94
|
-
return [
|
|
141
|
+
return [
|
|
142
|
+
[
|
|
143
|
+
e
|
|
144
|
+
for e in i.get("effects", [])
|
|
145
|
+
if e.get("effect_id", "").startswith("audio.") and e.get("effect_id") != "audio.layers"
|
|
146
|
+
]
|
|
147
|
+
for i in cut
|
|
148
|
+
]
|
|
149
|
+
|
|
95
150
|
# A new cut moves the music with it; only a different song, or new levels on the same cut, is news.
|
|
96
151
|
if music(old_cut) != music(new_cut):
|
|
97
|
-
changes.append(
|
|
98
|
-
elif not changes and (
|
|
99
|
-
|
|
100
|
-
|
|
152
|
+
changes.append("換了配樂")
|
|
153
|
+
elif not changes and (
|
|
154
|
+
sound(old_cut) != sound(new_cut)
|
|
155
|
+
or [e for i in old_cut for e in i.get("effects", []) if e.get("effect_id") == "audio.layers"]
|
|
156
|
+
!= [e for i in new_cut for e in i.get("effects", []) if e.get("effect_id") == "audio.layers"]
|
|
157
|
+
):
|
|
158
|
+
changes.append("調整配樂或聲音")
|
|
101
159
|
old, new = _components(before), _components(after)
|
|
102
160
|
for key in new.keys() - old.keys():
|
|
103
|
-
changes.append(f
|
|
161
|
+
changes.append(f"新增{_name(new[key])}")
|
|
104
162
|
for key in old.keys() - new.keys():
|
|
105
|
-
changes.append(f
|
|
163
|
+
changes.append(f"刪除{_name(old[key])}")
|
|
106
164
|
looks = {}
|
|
107
|
-
for key in sorted(old.keys() & new.keys(), key=lambda k: new[k][
|
|
165
|
+
for key in sorted(old.keys() & new.keys(), key=lambda k: new[k]["start_frame"]):
|
|
108
166
|
sentence = _graphic_change(old[key], new[key], styles, recut)
|
|
109
167
|
if isinstance(sentence, tuple):
|
|
110
168
|
_, name, fonts, colours = sentence
|
|
111
169
|
if name not in looks:
|
|
112
170
|
looks[name] = True
|
|
113
|
-
changes.append(
|
|
171
|
+
changes.append(
|
|
172
|
+
f"換了「{name}」外觀的" + ("字型和配色" if fonts and colours else "字型" if fonts else "配色")
|
|
173
|
+
)
|
|
114
174
|
continue
|
|
115
175
|
if sentence is None and not recut and _lanes(before)[key] != _lanes(after)[key]:
|
|
116
|
-
sentence = f
|
|
176
|
+
sentence = f"把{_name(new[key])}移到另一軌"
|
|
117
177
|
if sentence:
|
|
118
178
|
changes.append(sentence)
|
|
119
179
|
old_subtitles, new_subtitles = _subtitles(before), _subtitles(after)
|
|
120
180
|
if old_subtitles != new_subtitles:
|
|
121
181
|
changed = len(old_subtitles.keys() ^ new_subtitles.keys()) + sum(
|
|
122
|
-
old_subtitles[k] != new_subtitles[k] for k in old_subtitles.keys() & new_subtitles.keys()
|
|
123
|
-
|
|
182
|
+
old_subtitles[k] != new_subtitles[k] for k in old_subtitles.keys() & new_subtitles.keys()
|
|
183
|
+
)
|
|
184
|
+
changes.append(f"修改 {changed} 句字幕" if changed else "調整字幕")
|
|
124
185
|
return changes
|
|
125
186
|
|
|
126
187
|
|
|
127
188
|
def summary(changes, limit=2):
|
|
128
189
|
if not changes:
|
|
129
190
|
return None
|
|
130
|
-
shown =
|
|
131
|
-
return shown + (f
|
|
191
|
+
shown = "、".join(changes[:limit])
|
|
192
|
+
return shown + (f",還有 {len(changes) - limit} 處" if len(changes) > limit else "")
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"""Display-only grouping of imported music; rendering and asset IDs stay intact."""
|
|
2
|
+
|
|
2
3
|
from clipen.finishing.models import digest
|
|
3
4
|
|
|
4
5
|
|
|
5
6
|
def music_choices(store):
|
|
6
7
|
result = []
|
|
7
8
|
for record in store.records():
|
|
8
|
-
asset = record[
|
|
9
|
-
if asset[
|
|
9
|
+
asset = record["asset"]
|
|
10
|
+
if asset["role"] != "music":
|
|
10
11
|
continue
|
|
11
|
-
public = {k: v for k, v in asset.items() if k not in {
|
|
12
|
-
rights = {k: v for k, v in asset.get(
|
|
13
|
-
public[
|
|
12
|
+
public = {k: v for k, v in asset.items() if k not in {"relative_path", "fingerprint", "mtime_ns", "size_bytes"}}
|
|
13
|
+
rights = {k: v for k, v in asset.get("provenance", {}).items() if k not in {"retrieved_at", "changes"}}
|
|
14
|
+
public["duplicate_group"] = digest(
|
|
15
|
+
[asset.get("fingerprint") or asset["asset_id"], asset["duration_seconds"], rights]
|
|
16
|
+
)
|
|
14
17
|
result.append(public)
|
|
15
18
|
return result
|