@clipen/clipen-cli 1.0.0 → 1.0.1

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.
Files changed (127) hide show
  1. package/README.md +60 -50
  2. package/package.json +7 -4
  3. package/pyproject.toml +18 -2
  4. package/requirements/dev.txt +2 -0
  5. package/src/clipen/__init__.py +1 -1
  6. package/src/clipen/analysis/__init__.py +7 -7
  7. package/src/clipen/analysis/artifacts.py +4 -10
  8. package/src/clipen/analysis/audio.py +10 -8
  9. package/src/clipen/analysis/evidence_service.py +345 -167
  10. package/src/clipen/analysis/image_similarity.py +5 -14
  11. package/src/clipen/analysis/keyframes.py +5 -17
  12. package/src/clipen/analysis/models.py +5 -7
  13. package/src/clipen/analysis/qwen_worker.py +19 -54
  14. package/src/clipen/analysis/resources.py +2 -1
  15. package/src/clipen/analysis/runtime.py +1 -3
  16. package/src/clipen/analysis/service.py +16 -48
  17. package/src/clipen/analysis/setup.py +11 -25
  18. package/src/clipen/analysis/setup_cli.py +5 -15
  19. package/src/clipen/analysis/storage.py +96 -278
  20. package/src/clipen/analysis/transcription.py +40 -82
  21. package/src/clipen/analysis/visual.py +109 -48
  22. package/src/clipen/annotations/__init__.py +5 -2
  23. package/src/clipen/annotations/models.py +1 -1
  24. package/src/clipen/annotations/storage.py +132 -84
  25. package/src/clipen/annotations/suggestions.py +3 -8
  26. package/src/clipen/asr_release.py +4 -11
  27. package/src/clipen/bootstrap.py +65 -54
  28. package/src/clipen/{planning/models.py → candidates.py} +29 -47
  29. package/src/clipen/cli.py +2 -2
  30. package/src/clipen/controller/app.py +401 -214
  31. package/src/clipen/controller/server.py +28 -38
  32. package/src/clipen/domain/__init__.py +1 -1
  33. package/src/clipen/domain/media_time.py +3 -10
  34. package/src/clipen/domain/timeline.py +45 -47
  35. package/src/clipen/domain/validation.py +0 -1
  36. package/src/clipen/editing/__init__.py +1 -1
  37. package/src/clipen/editing/agent_models.py +4 -11
  38. package/src/clipen/editing/agent_repository.py +391 -170
  39. package/src/clipen/editing/agent_tools.py +180 -99
  40. package/src/clipen/editing/alignment.py +92 -52
  41. package/src/clipen/editing/alignment_setup.py +118 -70
  42. package/src/clipen/editing/alignment_worker.py +11 -9
  43. package/src/clipen/editing/change_report.py +95 -38
  44. package/src/clipen/editing/compiler.py +0 -1
  45. package/src/clipen/editing/component_looks.py +58 -34
  46. package/src/clipen/editing/component_review.py +34 -38
  47. package/src/clipen/editing/coordinator.py +213 -90
  48. package/src/clipen/editing/editorial_review.py +217 -95
  49. package/src/clipen/editing/evidence_jobs.py +457 -200
  50. package/src/clipen/editing/history_changes.py +129 -68
  51. package/src/clipen/editing/music_choices.py +8 -5
  52. package/src/clipen/editing/production_catalog.py +573 -136
  53. package/src/clipen/editing/production_limits.py +43 -17
  54. package/src/clipen/editing/production_media.py +376 -167
  55. package/src/clipen/editing/production_preview.py +322 -129
  56. package/src/clipen/editing/production_progress.py +164 -69
  57. package/src/clipen/editing/production_requirements.py +106 -39
  58. package/src/clipen/editing/production_tools.py +1064 -462
  59. package/src/clipen/editing/program_audio.py +211 -81
  60. package/src/clipen/editing/program_direction.py +59 -25
  61. package/src/clipen/editing/program_story.py +83 -45
  62. package/src/clipen/editing/program_subtitles.py +194 -96
  63. package/src/clipen/editing/programme_review.py +98 -50
  64. package/src/clipen/editing/prompt_history.py +64 -27
  65. package/src/clipen/editing/recut.py +65 -25
  66. package/src/clipen/editing/refinement_references.py +176 -86
  67. package/src/clipen/editing/resolve_export.py +449 -218
  68. package/src/clipen/editing/resolve_titles.py +162 -105
  69. package/src/clipen/editing/skill_tools.py +530 -154
  70. package/src/clipen/editing/source_dialogue.py +177 -67
  71. package/src/clipen/editing/speech_coverage.py +42 -22
  72. package/src/clipen/editing/speech_quality.py +6 -1
  73. package/src/clipen/editing/tool_receipts.py +78 -32
  74. package/src/clipen/editing/versions.py +122 -64
  75. package/src/clipen/editing/visual_preview.py +157 -61
  76. package/src/clipen/editing/workbench.py +104 -42
  77. package/src/clipen/finishing/audio.py +69 -30
  78. package/src/clipen/finishing/catalog.py +176 -93
  79. package/src/clipen/finishing/models.py +1 -1
  80. package/src/clipen/finishing/renderer.py +33 -14
  81. package/src/clipen/mcp_editing/__main__.py +3 -1
  82. package/src/clipen/mcp_editing/server.py +77 -34
  83. package/src/clipen/media/__init__.py +3 -3
  84. package/src/clipen/media/discovery.py +7 -20
  85. package/src/clipen/media/models.py +7 -18
  86. package/src/clipen/media/preview.py +14 -24
  87. package/src/clipen/media/probe.py +16 -44
  88. package/src/clipen/media/service.py +6 -19
  89. package/src/clipen/media/storage.py +33 -81
  90. package/src/clipen/music_vocabulary.py +33 -4
  91. package/src/clipen/power.py +8 -3
  92. package/src/clipen/projects/__init__.py +1 -1
  93. package/src/clipen/projects/deletion.py +19 -32
  94. package/src/clipen/projects/finishing_schema.py +3 -1
  95. package/src/clipen/projects/models.py +2 -5
  96. package/src/clipen/projects/picker.py +13 -37
  97. package/src/clipen/projects/service.py +8 -24
  98. package/src/clipen/projects/storage.py +226 -246
  99. package/src/clipen/provider_registry.py +4 -2
  100. package/src/clipen/providers/account.py +86 -35
  101. package/src/clipen/providers/claude.py +59 -25
  102. package/src/clipen/providers/claude_editing.py +14 -7
  103. package/src/clipen/providers/codex.py +73 -118
  104. package/src/clipen/providers/codex_editing.py +2 -2
  105. package/src/clipen/providers/editing_agent.py +19 -17
  106. package/src/clipen/providers/recovery.py +7 -8
  107. package/src/clipen/rendering/cover.py +18 -5
  108. package/src/clipen/rendering/custom_components.py +167 -79
  109. package/src/clipen/rendering/custom_render.py +62 -41
  110. package/src/clipen/rendering/production_effects.py +77 -45
  111. package/src/clipen/rendering/program_components.py +134 -73
  112. package/src/clipen/rendering/program_creator.py +432 -277
  113. package/src/clipen/rendering/program_identities.py +277 -182
  114. package/src/clipen/rendering/program_motion.py +140 -95
  115. package/src/clipen/rendering/program_studio.py +175 -116
  116. package/src/clipen/rendering/program_styles.py +231 -145
  117. package/src/clipen/rendering/program_subtitles.py +71 -34
  118. package/src/clipen/rendering/renderer.py +150 -121
  119. package/src/clipen/rendering/storage.py +9 -22
  120. package/src/clipen/rendering/titles.py +193 -86
  121. package/src/clipen/skills/__init__.py +1 -0
  122. package/src/clipen/skills/catalog.py +151 -55
  123. package/src/clipen/skills/library.py +13 -7
  124. package/src/clipen/skills/package.py +46 -23
  125. package/src/clipen/skills/visual_styles.py +29 -18
  126. package/src/clipen/workspace.py +15 -44
  127. package/src/clipen/planning/__init__.py +0 -9
@@ -1,141 +1,186 @@
1
1
  """Original broadcast graphics: bounded layouts and frame-driven entrance motion."""
2
+
2
3
  import math
3
4
 
5
+ from .program_styles import (
6
+ draw_style_text,
7
+ draw_styled_graphic,
8
+ load_style_font,
9
+ skin,
10
+ style_font,
11
+ styled_text_length,
12
+ type_outline,
13
+ )
4
14
  from .titles import TitleRenderError
5
- from .program_styles import skin, style_font, load_style_font, styled_text_length, draw_styled_graphic, draw_style_text, type_outline
6
-
7
15
 
8
16
  # Each family owns its composition, rather than stretching the small label style.
9
17
  FAMILIES = {
10
- 'program_title': (.125, .80, .29, 24, 8),
11
- 'headline': (.135, .82, .24, 20, 7),
12
- 'impact': (.145, .74, .27, 16, 6),
13
- 'chapter': (.075, .78, .18, 22, 8),
14
- 'burst': (.108, .62, .27, 20, 6),
18
+ "program_title": (0.125, 0.80, 0.29, 24, 8),
19
+ "headline": (0.135, 0.82, 0.24, 20, 7),
20
+ "impact": (0.145, 0.74, 0.27, 16, 6),
21
+ "chapter": (0.075, 0.78, 0.18, 22, 8),
22
+ "burst": (0.108, 0.62, 0.27, 20, 6),
15
23
  }
16
24
 
17
25
 
18
26
  def motion_frames(kind, profile=None):
19
- appearance=(profile or {}).get('presets',{}).get('appearance',{})
20
- return (appearance.get('hero_entry_frames',FAMILIES[kind][3]),
21
- appearance.get('hero_exit_frames',FAMILIES[kind][4]))
27
+ appearance = (profile or {}).get("presets", {}).get("appearance", {})
28
+ return (
29
+ appearance.get("hero_entry_frames", FAMILIES[kind][3]),
30
+ appearance.get("hero_exit_frames", FAMILIES[kind][4]),
31
+ )
22
32
 
23
33
 
24
34
  def layout(draw, font_path, timeline, item, profile):
25
- if skin(profile) == 'studio':
35
+ if skin(profile) == "studio":
26
36
  from .program_studio import layout as studio_layout
37
+
27
38
  return studio_layout(draw, font_path, timeline, item, profile)
28
- scale, max_width, height, _, _ = FAMILIES[profile['component_id']]
29
- font_path=style_font(font_path,profile)
30
- scale*=profile['presets'].get('appearance',{}).get('hero_scale',1.)
39
+ scale, max_width, height, _, _ = FAMILIES[profile["component_id"]]
40
+ font_path = style_font(font_path, profile)
41
+ scale *= profile["presets"].get("appearance", {}).get("hero_scale", 1.0)
31
42
  w, h = timeline.width, timeline.height
32
- x, y = round(w*profile['x']), round(h*profile['y'])
33
- pad = max(8, round(h*.025))
34
- primary, _, detail = item.text.partition('\n')
35
- limit = min(w*max_width, w*.945-x)
36
- size = max(14, round(h*scale))
37
- minimum = max(14, round(h*scale*.70))
43
+ x, y = round(w * profile["x"]), round(h * profile["y"])
44
+ pad = max(8, round(h * 0.025))
45
+ primary, _, detail = item.text.partition("\n")
46
+ limit = min(w * max_width, w * 0.945 - x)
47
+ size = max(14, round(h * scale))
48
+ minimum = max(14, round(h * scale * 0.70))
38
49
  while True:
39
- font = load_style_font(font_path, size,profile)
50
+ font = load_style_font(font_path, size, profile)
40
51
  # Room for outline, shadow, skew and framing, including transient motion.
41
- width = styled_text_length(primary,font)+pad*4
52
+ width = styled_text_length(primary, font) + pad * 4
42
53
  if width <= limit or size <= minimum:
43
54
  break
44
55
  size -= 1
45
- small = load_style_font(font_path,max(12,round(h*.027)),profile,role='detail')
46
- width = max(width, styled_text_length(detail,small)+pad*4 if detail else 0, w*.30)
47
- bottom = y+round(h*height)
48
- if width > limit or bottom > h*.77:
49
- raise TitleRenderError('program_component_overflow')
50
- return (x, y, x+math.ceil(width), bottom), font, pad
56
+ small = load_style_font(font_path, max(12, round(h * 0.027)), profile, role="detail")
57
+ width = max(width, styled_text_length(detail, small) + pad * 4 if detail else 0, w * 0.30)
58
+ bottom = y + round(h * height)
59
+ if width > limit or bottom > h * 0.77:
60
+ raise TitleRenderError("program_component_overflow")
61
+ return (x, y, x + math.ceil(width), bottom), font, pad
51
62
 
52
63
 
53
64
  def draw_motion_graphic(draw, font_path, timeline, item, profile, relative_frame=None):
54
65
  bounds, font, pad = layout(draw, font_path, timeline, item, profile)
55
- if skin(profile)!='variety':
56
- return draw_styled_graphic(draw,font_path,timeline,item,profile,bounds,font,pad,relative_frame)
57
- kind = profile['component_id']
58
- entry, exit_frames = motion_frames(kind,profile)
66
+ if skin(profile) != "variety":
67
+ return draw_styled_graphic(draw, font_path, timeline, item, profile, bounds, font, pad, relative_frame)
68
+ kind = profile["component_id"]
69
+ entry, exit_frames = motion_frames(kind, profile)
59
70
  relative = entry if relative_frame is None else relative_frame
60
- progress = min(1., max(0., (relative+1)/entry))
61
- ease = 1-(1-progress)**3
62
- opacity = min(1., max(0., (item.duration_frames-relative)/exit_frames))
63
- palette = profile['presets']['palette']
71
+ progress = min(1.0, max(0.0, (relative + 1) / entry))
72
+ ease = 1 - (1 - progress) ** 3
73
+ opacity = min(1.0, max(0.0, (item.duration_frames - relative) / exit_frames))
74
+ palette = profile["presets"]["palette"]
64
75
 
65
- def color(name, alpha=1.):
76
+ def color(name, alpha=1.0):
66
77
  r, g, b, a = palette[name]
67
- return r, g, b, round(a*opacity*alpha)
78
+ return r, g, b, round(a * opacity * alpha)
68
79
 
69
80
  x, y, right, bottom = bounds
70
- width, height = right-x, bottom-y
71
- stroke = max(2, round(timeline.height*.004))
72
- primary, _, detail = item.text.partition('\n')
73
- small = load_style_font(font_path, max(12, round(timeline.height*.027)),profile,role='detail')
74
- kicker = load_style_font(font_path, max(10, round(timeline.height*.020)),profile,role='detail')
81
+ width, height = right - x, bottom - y
82
+ stroke = max(2, round(timeline.height * 0.004))
83
+ primary, _, detail = item.text.partition("\n")
84
+ small = load_style_font(font_path, max(12, round(timeline.height * 0.027)), profile, role="detail")
85
+ kicker = load_style_font(font_path, max(10, round(timeline.height * 0.020)), profile, role="detail")
75
86
 
76
- def text(position, value, *, fill='paper', selected_font=font, outline=True):
77
- draw_style_text(draw,position,value,selected_font,color(fill),type_outline(profile,selected_font,stroke*2) if outline else 0,color('ink'))
87
+ def text(position, value, *, fill="paper", selected_font=font, outline=True):
88
+ draw_style_text(
89
+ draw,
90
+ position,
91
+ value,
92
+ selected_font,
93
+ color(fill),
94
+ type_outline(profile, selected_font, stroke * 2) if outline else 0,
95
+ color("ink"),
96
+ )
78
97
  # Embolden the glyph itself; CJK collections may expose a light default face.
79
- if not profile['presets'].get('font_roles'):
80
- draw_style_text(draw,position,value,selected_font,color(fill),max(1,stroke//2) if selected_font is font else 0,color(fill))
98
+ if not profile["presets"].get("font_roles"):
99
+ draw_style_text(
100
+ draw,
101
+ position,
102
+ value,
103
+ selected_font,
104
+ color(fill),
105
+ max(1, stroke // 2) if selected_font is font else 0,
106
+ color(fill),
107
+ )
81
108
 
82
- if kind == 'program_title':
109
+ if kind == "program_title":
83
110
  # Two framing strokes reveal first; the title rises into the open frame.
84
- reveal = width*ease
85
- draw.rectangle((x, y, x+reveal, y+stroke*2), fill=color('accent'))
86
- draw.rectangle((right-reveal, bottom-stroke, right, bottom), fill=color('secondary'))
87
- draw.rectangle((x, y+stroke*2, x+stroke, bottom), fill=color('accent', ease))
88
- draw.rectangle((x+pad, y+pad*.5, x+pad+max(width*.25, timeline.width*.16)*ease, y+pad*2.0), fill=color('accent'))
89
- draw.text((x+pad*1.2, y+pad*.74), 'ON LOCATION', font=kicker, fill=color('ink'), anchor='lt')
90
- tx, ty = x+pad*1.4, y+height*.32+(1-ease)*pad
91
- text((tx+stroke*2, ty+stroke*2), primary, fill='ink')
111
+ reveal = width * ease
112
+ draw.rectangle((x, y, x + reveal, y + stroke * 2), fill=color("accent"))
113
+ draw.rectangle((right - reveal, bottom - stroke, right, bottom), fill=color("secondary"))
114
+ draw.rectangle((x, y + stroke * 2, x + stroke, bottom), fill=color("accent", ease))
115
+ draw.rectangle(
116
+ (x + pad, y + pad * 0.5, x + pad + max(width * 0.25, timeline.width * 0.16) * ease, y + pad * 2.0),
117
+ fill=color("accent"),
118
+ )
119
+ draw.text((x + pad * 1.2, y + pad * 0.74), "ON LOCATION", font=kicker, fill=color("ink"), anchor="lt")
120
+ tx, ty = x + pad * 1.4, y + height * 0.32 + (1 - ease) * pad
121
+ text((tx + stroke * 2, ty + stroke * 2), primary, fill="ink")
92
122
  text((tx, ty), primary)
93
- elif kind == 'headline':
123
+ elif kind == "headline":
94
124
  # Word-sized punches arrive left-to-right over an expanding slanted band.
95
- band_y = y+height*.10
96
- draw.polygon([(x,band_y+height*.12),(x+width*ease,band_y),
97
- (x+width*ease-pad, y+height*.76),(x,y+height*.76)],fill=color('accent'))
98
- cursor=x+pad*1.5
125
+ band_y = y + height * 0.10
126
+ draw.polygon(
127
+ [
128
+ (x, band_y + height * 0.12),
129
+ (x + width * ease, band_y),
130
+ (x + width * ease - pad, y + height * 0.76),
131
+ (x, y + height * 0.76),
132
+ ],
133
+ fill=color("accent"),
134
+ )
135
+ cursor = x + pad * 1.5
99
136
  for n, char in enumerate(primary):
100
- local=min(1.,max(0.,progress*1.8-n/max(1,len(primary))*.8))
137
+ local = min(1.0, max(0.0, progress * 1.8 - n / max(1, len(primary)) * 0.8))
101
138
  if local:
102
- text((cursor,y+height*.19+(1-local)**2*pad),char,fill='ink',outline=False)
103
- cursor+=draw.textlength(char,font=font)
104
- elif kind == 'impact':
139
+ text((cursor, y + height * 0.19 + (1 - local) ** 2 * pad), char, fill="ink", outline=False)
140
+ cursor += draw.textlength(char, font=font)
141
+ elif kind == "impact":
105
142
  # A slam contracts from a displaced shadow into solid outlined type.
106
- hit = min(1., progress*1.8)
107
- tx, ty = x+pad*2, y+height*.20
108
- offset=round((1-hit)*pad*1.5)+stroke*2
109
- text((tx+offset,ty+offset),primary,fill='secondary')
110
- text((tx,ty),primary,fill='accent')
111
- for side in (-1,1):
112
- edge=x+pad*.8 if side<0 else right-pad*.8
113
- draw.line((edge,y+height*.2,edge+side*pad*.5*ease,y+height*.05),fill=color('accent'),width=stroke*2)
114
- draw.line((edge,y+height*.48,edge+side*pad*.5*ease,y+height*.56),fill=color('paper'),width=stroke)
115
- elif kind == 'chapter':
143
+ hit = min(1.0, progress * 1.8)
144
+ tx, ty = x + pad * 2, y + height * 0.20
145
+ offset = round((1 - hit) * pad * 1.5) + stroke * 2
146
+ text((tx + offset, ty + offset), primary, fill="secondary")
147
+ text((tx, ty), primary, fill="accent")
148
+ for side in (-1, 1):
149
+ edge = x + pad * 0.8 if side < 0 else right - pad * 0.8
150
+ draw.line(
151
+ (edge, y + height * 0.2, edge + side * pad * 0.5 * ease, y + height * 0.05),
152
+ fill=color("accent"),
153
+ width=stroke * 2,
154
+ )
155
+ draw.line(
156
+ (edge, y + height * 0.48, edge + side * pad * 0.5 * ease, y + height * 0.56),
157
+ fill=color("paper"),
158
+ width=stroke,
159
+ )
160
+ elif kind == "chapter":
116
161
  # A tab and panel wipe establish a new segment while footage stays visible.
117
- end=x+width*ease
118
- draw.polygon([(x,y),(end,y),(end-pad,y+height*.78),(x,y+height*.78)],fill=color('ink'))
119
- draw.rectangle((x,y,x+pad*.65,y+height*.78),fill=color('secondary'))
120
- draw.line((x+pad,bottom-stroke,x+width*ease,bottom-stroke),fill=color('accent'),width=stroke*2)
121
- if progress > .28:
122
- text((x+pad*1.5,y+height*.16),primary)
162
+ end = x + width * ease
163
+ draw.polygon([(x, y), (end, y), (end - pad, y + height * 0.78), (x, y + height * 0.78)], fill=color("ink"))
164
+ draw.rectangle((x, y, x + pad * 0.65, y + height * 0.78), fill=color("secondary"))
165
+ draw.line((x + pad, bottom - stroke, x + width * ease, bottom - stroke), fill=color("accent"), width=stroke * 2)
166
+ if progress > 0.28:
167
+ text((x + pad * 1.5, y + height * 0.16), primary)
123
168
  else: # burst: an angular outlined badge with outward growing rays.
124
- cx,cy=(x+right)/2,y+height*.43
125
- rx,ry=width*.44*ease,height*.39*ease
126
- points=[]
169
+ cx, cy = (x + right) / 2, y + height * 0.43
170
+ rx, ry = width * 0.44 * ease, height * 0.39 * ease
171
+ points = []
127
172
  for n in range(20):
128
- angle=math.tau*n/20
129
- radius=1. if n%2==0 else .80
130
- points.append((cx+math.cos(angle)*rx*radius,cy+math.sin(angle)*ry*radius))
131
- draw.polygon(points,fill=color('ink'),outline=color('accent'),width=stroke*2)
132
- if progress>.35:
133
- text((x+pad*2,y+height*.27),primary,fill='accent')
134
- for angle in (0,math.pi*.20,math.pi*.80,math.pi):
135
- start=(cx+math.cos(angle)*width*.46,cy+math.sin(angle)*height*.44)
136
- end=(start[0]+math.cos(angle)*pad*.6*ease,start[1]+math.sin(angle)*pad*.5*ease)
137
- draw.line((start,end),fill=color('secondary'),width=stroke*2)
173
+ angle = math.tau * n / 20
174
+ radius = 1.0 if n % 2 == 0 else 0.80
175
+ points.append((cx + math.cos(angle) * rx * radius, cy + math.sin(angle) * ry * radius))
176
+ draw.polygon(points, fill=color("ink"), outline=color("accent"), width=stroke * 2)
177
+ if progress > 0.35:
178
+ text((x + pad * 2, y + height * 0.27), primary, fill="accent")
179
+ for angle in (0, math.pi * 0.20, math.pi * 0.80, math.pi):
180
+ start = (cx + math.cos(angle) * width * 0.46, cy + math.sin(angle) * height * 0.44)
181
+ end = (start[0] + math.cos(angle) * pad * 0.6 * ease, start[1] + math.sin(angle) * pad * 0.5 * ease)
182
+ draw.line((start, end), fill=color("secondary"), width=stroke * 2)
138
183
  if detail:
139
184
  # Secondary line has reserved space; never lies on top of the main title.
140
- text((x+pad*1.5,bottom-pad*1.9),detail,selected_font=small)
185
+ text((x + pad * 1.5, bottom - pad * 1.9), detail, selected_font=small)
141
186
  return bounds