premiere-cli 0.2.0__py3-none-any.whl

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 (247) hide show
  1. premiere_cli/__init__.py +11 -0
  2. premiere_cli/cli.py +3664 -0
  3. premiere_cli/log.py +66 -0
  4. premiere_cli/panel/.debug +8 -0
  5. premiere_cli/panel/CSXS/manifest.xml +52 -0
  6. premiere_cli/panel/css/style.css +53 -0
  7. premiere_cli/panel/host/commands/add-adjustment-layer.jsx +190 -0
  8. premiere_cli/panel/host/commands/add-audio-keyframes.jsx +176 -0
  9. premiere_cli/panel/host/commands/add-custom-metadata-field.jsx +63 -0
  10. premiere_cli/panel/host/commands/add-keyframe.jsx +181 -0
  11. premiere_cli/panel/host/commands/add-marker-to-project-item.jsx +194 -0
  12. premiere_cli/panel/host/commands/add-marker.jsx +129 -0
  13. premiere_cli/panel/host/commands/add-text-overlay.jsx +101 -0
  14. premiere_cli/panel/host/commands/add-to-render-queue.jsx +120 -0
  15. premiere_cli/panel/host/commands/add-to-timeline.jsx +300 -0
  16. premiere_cli/panel/host/commands/add-track.jsx +188 -0
  17. premiere_cli/panel/host/commands/add-transition.jsx +134 -0
  18. premiere_cli/panel/host/commands/adjust-audio-levels.jsx +132 -0
  19. premiere_cli/panel/host/commands/apply-audio-effect.jsx +118 -0
  20. premiere_cli/panel/host/commands/apply-effect.jsx +122 -0
  21. premiere_cli/panel/host/commands/apply-lut.jsx +107 -0
  22. premiere_cli/panel/host/commands/attach-custom-property.jsx +66 -0
  23. premiere_cli/panel/host/commands/auto-reframe-sequence.jsx +124 -0
  24. premiere_cli/panel/host/commands/batch-add-transitions.jsx +158 -0
  25. premiere_cli/panel/host/commands/batch-apply-effect.jsx +182 -0
  26. premiere_cli/panel/host/commands/batch-rename-clips.jsx +170 -0
  27. premiere_cli/panel/host/commands/batch-set-clips-enabled.jsx +145 -0
  28. premiere_cli/panel/host/commands/clear-item-in-out.jsx +117 -0
  29. premiere_cli/panel/host/commands/clear-sequence-in-out.jsx +100 -0
  30. premiere_cli/panel/host/commands/close-all-source-clips.jsx +32 -0
  31. premiere_cli/panel/host/commands/close-sequence.jsx +80 -0
  32. premiere_cli/panel/host/commands/close-source-monitor.jsx +32 -0
  33. premiere_cli/panel/host/commands/color-correct.jsx +164 -0
  34. premiere_cli/panel/host/commands/copy-effect-values.jsx +183 -0
  35. premiere_cli/panel/host/commands/copy-effects-between-clips.jsx +234 -0
  36. premiere_cli/panel/host/commands/create-bars-and-tone.jsx +152 -0
  37. premiere_cli/panel/host/commands/create-bin.jsx +76 -0
  38. premiere_cli/panel/host/commands/create-caption-track.jsx +159 -0
  39. premiere_cli/panel/host/commands/create-sequence-from-clips.jsx +170 -0
  40. premiere_cli/panel/host/commands/create-sequence-from-preset.jsx +90 -0
  41. premiere_cli/panel/host/commands/create-sequence.jsx +166 -0
  42. premiere_cli/panel/host/commands/create-smart-bin.jsx +80 -0
  43. premiere_cli/panel/host/commands/create-subclip.jsx +248 -0
  44. premiere_cli/panel/host/commands/create-subsequence.jsx +136 -0
  45. premiere_cli/panel/host/commands/debug-qe-inspect.jsx +248 -0
  46. premiere_cli/panel/host/commands/debug-qe-try-mutate.jsx +305 -0
  47. premiere_cli/panel/host/commands/delete-marker.jsx +178 -0
  48. premiere_cli/panel/host/commands/deselect-all-clips.jsx +98 -0
  49. premiere_cli/panel/host/commands/detach-proxy.jsx +116 -0
  50. premiere_cli/panel/host/commands/duplicate-clip.jsx +140 -0
  51. premiere_cli/panel/host/commands/duplicate-sequence.jsx +150 -0
  52. premiere_cli/panel/host/commands/encode-file.jsx +86 -0
  53. premiere_cli/panel/host/commands/encode-project-item.jsx +145 -0
  54. premiere_cli/panel/host/commands/export-aaf.jsx +77 -0
  55. premiere_cli/panel/host/commands/export-fcp-xml.jsx +65 -0
  56. premiere_cli/panel/host/commands/export-frame.jsx +381 -0
  57. premiere_cli/panel/host/commands/export-omf.jsx +95 -0
  58. premiere_cli/panel/host/commands/export-sequence-as-project.jsx +65 -0
  59. premiere_cli/panel/host/commands/export-sequence.jsx +100 -0
  60. premiere_cli/panel/host/commands/extract-audio-track.jsx +181 -0
  61. premiere_cli/panel/host/commands/extract-selection.jsx +113 -0
  62. premiere_cli/panel/host/commands/find-items-by-media-path.jsx +112 -0
  63. premiere_cli/panel/host/commands/freeze-frame.jsx +215 -0
  64. premiere_cli/panel/host/commands/get-active-sequence.jsx +103 -0
  65. premiere_cli/panel/host/commands/get-all-project-paths.jsx +72 -0
  66. premiere_cli/panel/host/commands/get-bin-contents.jsx +176 -0
  67. premiere_cli/panel/host/commands/get-clip-adjustment-layer.jsx +83 -0
  68. premiere_cli/panel/host/commands/get-clip-at-playhead.jsx +99 -0
  69. premiere_cli/panel/host/commands/get-clip-at-position.jsx +120 -0
  70. premiere_cli/panel/host/commands/get-clip-links.jsx +135 -0
  71. premiere_cli/panel/host/commands/get-clip-markers.jsx +144 -0
  72. premiere_cli/panel/host/commands/get-clip-speed.jsx +69 -0
  73. premiere_cli/panel/host/commands/get-color-label.jsx +89 -0
  74. premiere_cli/panel/host/commands/get-color-space.jsx +99 -0
  75. premiere_cli/panel/host/commands/get-duplicate-media.jsx +78 -0
  76. premiere_cli/panel/host/commands/get-effect-properties.jsx +129 -0
  77. premiere_cli/panel/host/commands/get-encoder-presets.jsx +131 -0
  78. premiere_cli/panel/host/commands/get-export-file-extension.jsx +56 -0
  79. premiere_cli/panel/host/commands/get-footage-interpretation.jsx +113 -0
  80. premiere_cli/panel/host/commands/get-full-clip-info.jsx +162 -0
  81. premiere_cli/panel/host/commands/get-full-project-overview.jsx +193 -0
  82. premiere_cli/panel/host/commands/get-full-sequence-info.jsx +184 -0
  83. premiere_cli/panel/host/commands/get-graphics-white-luminance.jsx +31 -0
  84. premiere_cli/panel/host/commands/get-insertion-bin.jsx +35 -0
  85. premiere_cli/panel/host/commands/get-item-metadata.jsx +94 -0
  86. premiere_cli/panel/host/commands/get-keyframes.jsx +158 -0
  87. premiere_cli/panel/host/commands/get-mogrt-component.jsx +111 -0
  88. premiere_cli/panel/host/commands/get-next-edit-point.jsx +131 -0
  89. premiere_cli/panel/host/commands/get-offline-media.jsx +67 -0
  90. premiere_cli/panel/host/commands/get-open-projects.jsx +50 -0
  91. premiere_cli/panel/host/commands/get-premiere-state.jsx +164 -0
  92. premiere_cli/panel/host/commands/get-project-info.jsx +63 -0
  93. premiere_cli/panel/host/commands/get-project-item-info.jsx +247 -0
  94. premiere_cli/panel/host/commands/get-project-panel-metadata.jsx +30 -0
  95. premiere_cli/panel/host/commands/get-qe-clip-info.jsx +198 -0
  96. premiere_cli/panel/host/commands/get-render-queue-status.jsx +35 -0
  97. premiere_cli/panel/host/commands/get-sequence-count.jsx +24 -0
  98. premiere_cli/panel/host/commands/get-sequence-in-out.jsx +76 -0
  99. premiere_cli/panel/host/commands/get-sequence-markers-by-type.jsx +89 -0
  100. premiere_cli/panel/host/commands/get-source-monitor-info.jsx +34 -0
  101. premiere_cli/panel/host/commands/get-source-monitor-position.jsx +30 -0
  102. premiere_cli/panel/host/commands/get-target-tracks.jsx +76 -0
  103. premiere_cli/panel/host/commands/get-timeline-gaps.jsx +124 -0
  104. premiere_cli/panel/host/commands/get-timeline-summary.jsx +154 -0
  105. premiere_cli/panel/host/commands/get-total-clip-count.jsx +67 -0
  106. premiere_cli/panel/host/commands/get-track-info.jsx +117 -0
  107. premiere_cli/panel/host/commands/get-unused-media.jsx +99 -0
  108. premiere_cli/panel/host/commands/get-used-media-report.jsx +125 -0
  109. premiere_cli/panel/host/commands/get-value-at-time.jsx +135 -0
  110. premiere_cli/panel/host/commands/get-version-info.jsx +33 -0
  111. premiere_cli/panel/host/commands/get-work-area.jsx +52 -0
  112. premiere_cli/panel/host/commands/get-workspaces.jsx +29 -0
  113. premiere_cli/panel/host/commands/get-xmp-metadata.jsx +107 -0
  114. premiere_cli/panel/host/commands/import-ae-comps.jsx +129 -0
  115. premiere_cli/panel/host/commands/import-fcp-xml.jsx +103 -0
  116. premiere_cli/panel/host/commands/import-folder.jsx +193 -0
  117. premiere_cli/panel/host/commands/import-image-sequence.jsx +171 -0
  118. premiere_cli/panel/host/commands/import-media.jsx +217 -0
  119. premiere_cli/panel/host/commands/import-mogrt-from-library.jsx +105 -0
  120. premiere_cli/panel/host/commands/import-mogrt.jsx +111 -0
  121. premiere_cli/panel/host/commands/import-sequences-from-project.jsx +80 -0
  122. premiere_cli/panel/host/commands/insert-from-source.jsx +162 -0
  123. premiere_cli/panel/host/commands/inspect-dom-object.jsx +162 -0
  124. premiere_cli/panel/host/commands/invert-selection.jsx +114 -0
  125. premiere_cli/panel/host/commands/is-work-area-enabled.jsx +88 -0
  126. premiere_cli/panel/host/commands/lift-selection.jsx +106 -0
  127. premiere_cli/panel/host/commands/link-selection.jsx +111 -0
  128. premiere_cli/panel/host/commands/list-available-audio-effects.jsx +33 -0
  129. premiere_cli/panel/host/commands/list-available-audio-transitions.jsx +35 -0
  130. premiere_cli/panel/host/commands/list-available-effects.jsx +33 -0
  131. premiere_cli/panel/host/commands/list-available-transitions.jsx +74 -0
  132. premiere_cli/panel/host/commands/list-markers.jsx +69 -0
  133. premiere_cli/panel/host/commands/list-project-items.jsx +105 -0
  134. premiere_cli/panel/host/commands/lock-track.jsx +114 -0
  135. premiere_cli/panel/host/commands/manage-proxies.jsx +176 -0
  136. premiere_cli/panel/host/commands/match-frame.jsx +141 -0
  137. premiere_cli/panel/host/commands/move-clip-to-track.jsx +220 -0
  138. premiere_cli/panel/host/commands/move-clip.jsx +97 -0
  139. premiere_cli/panel/host/commands/move-items-to-bin.jsx +194 -0
  140. premiere_cli/panel/host/commands/move-playhead-to-edit.jsx +174 -0
  141. premiere_cli/panel/host/commands/move-playhead.jsx +137 -0
  142. premiere_cli/panel/host/commands/nest-clips.jsx +179 -0
  143. premiere_cli/panel/host/commands/open-in-source.jsx +117 -0
  144. premiere_cli/panel/host/commands/open-project.jsx +61 -0
  145. premiere_cli/panel/host/commands/overwrite-clip-at.jsx +350 -0
  146. premiere_cli/panel/host/commands/overwrite-from-source.jsx +150 -0
  147. premiere_cli/panel/host/commands/play-source-monitor.jsx +36 -0
  148. premiere_cli/panel/host/commands/play-timeline.jsx +24 -0
  149. premiere_cli/panel/host/commands/razor-all-tracks.jsx +171 -0
  150. premiere_cli/panel/host/commands/redo.jsx +69 -0
  151. premiere_cli/panel/host/commands/refresh-media.jsx +101 -0
  152. premiere_cli/panel/host/commands/relink-media.jsx +132 -0
  153. premiere_cli/panel/host/commands/remove-all-effects.jsx +114 -0
  154. premiere_cli/panel/host/commands/remove-effect-by-name.jsx +143 -0
  155. premiere_cli/panel/host/commands/remove-effect.jsx +122 -0
  156. premiere_cli/panel/host/commands/remove-from-timeline.jsx +93 -0
  157. premiere_cli/panel/host/commands/remove-keyframe-range.jsx +173 -0
  158. premiere_cli/panel/host/commands/remove-keyframe.jsx +192 -0
  159. premiere_cli/panel/host/commands/remove-selected-clips.jsx +126 -0
  160. premiere_cli/panel/host/commands/remove-track-intervals.jsx +254 -0
  161. premiere_cli/panel/host/commands/remove-transition.jsx +164 -0
  162. premiere_cli/panel/host/commands/rename-bin.jsx +88 -0
  163. premiere_cli/panel/host/commands/rename-clip.jsx +127 -0
  164. premiere_cli/panel/host/commands/rename-project-item.jsx +111 -0
  165. premiere_cli/panel/host/commands/rename-track.jsx +84 -0
  166. premiere_cli/panel/host/commands/replace-clip-media.jsx +140 -0
  167. premiere_cli/panel/host/commands/replace-clip.jsx +188 -0
  168. premiere_cli/panel/host/commands/reverse-clip.jsx +187 -0
  169. premiere_cli/panel/host/commands/ripple-delete-clip.jsx +156 -0
  170. premiere_cli/panel/host/commands/roll-edit.jsx +162 -0
  171. premiere_cli/panel/host/commands/save-project-as.jsx +55 -0
  172. premiere_cli/panel/host/commands/save-project.jsx +57 -0
  173. premiere_cli/panel/host/commands/scene-edit-detection.jsx +128 -0
  174. premiere_cli/panel/host/commands/search-project-items.jsx +180 -0
  175. premiere_cli/panel/host/commands/select-all-clips.jsx +107 -0
  176. premiere_cli/panel/host/commands/select-clips-by-color.jsx +142 -0
  177. premiere_cli/panel/host/commands/select-clips-by-name.jsx +133 -0
  178. premiere_cli/panel/host/commands/select-clips-in-range.jsx +133 -0
  179. premiere_cli/panel/host/commands/select-disabled-clips.jsx +127 -0
  180. premiere_cli/panel/host/commands/select-project-item.jsx +115 -0
  181. premiere_cli/panel/host/commands/set-active-project.jsx +184 -0
  182. premiere_cli/panel/host/commands/set-active-sequence.jsx +87 -0
  183. premiere_cli/panel/host/commands/set-all-tracks-targeted.jsx +112 -0
  184. premiere_cli/panel/host/commands/set-anti-alias-quality.jsx +125 -0
  185. premiere_cli/panel/host/commands/set-blend-mode.jsx +111 -0
  186. premiere_cli/panel/host/commands/set-clip-anchor-point.jsx +102 -0
  187. premiere_cli/panel/host/commands/set-clip-enabled.jsx +127 -0
  188. premiere_cli/panel/host/commands/set-clip-opacity.jsx +102 -0
  189. premiere_cli/panel/host/commands/set-clip-pan.jsx +107 -0
  190. premiere_cli/panel/host/commands/set-clip-position.jsx +103 -0
  191. premiere_cli/panel/host/commands/set-clip-properties.jsx +221 -0
  192. premiere_cli/panel/host/commands/set-clip-rotation.jsx +102 -0
  193. premiere_cli/panel/host/commands/set-clip-scale.jsx +102 -0
  194. premiere_cli/panel/host/commands/set-clip-selection.jsx +144 -0
  195. premiere_cli/panel/host/commands/set-clip-speed.jsx +160 -0
  196. premiere_cli/panel/host/commands/set-clip-volume.jsx +128 -0
  197. premiere_cli/panel/host/commands/set-color-label.jsx +123 -0
  198. premiere_cli/panel/host/commands/set-color-value.jsx +155 -0
  199. premiere_cli/panel/host/commands/set-effect-property.jsx +124 -0
  200. premiere_cli/panel/host/commands/set-footage-interpretation.jsx +173 -0
  201. premiere_cli/panel/host/commands/set-frame-blend.jsx +145 -0
  202. premiere_cli/panel/host/commands/set-graphics-white-luminance.jsx +73 -0
  203. premiere_cli/panel/host/commands/set-item-in-out.jsx +180 -0
  204. premiere_cli/panel/host/commands/set-item-metadata.jsx +134 -0
  205. premiere_cli/panel/host/commands/set-item-offline.jsx +109 -0
  206. premiere_cli/panel/host/commands/set-item-start-time.jsx +139 -0
  207. premiere_cli/panel/host/commands/set-keyframe-interpolation.jsx +186 -0
  208. premiere_cli/panel/host/commands/set-override-frame-rate.jsx +123 -0
  209. premiere_cli/panel/host/commands/set-override-pixel-aspect-ratio.jsx +129 -0
  210. premiere_cli/panel/host/commands/set-poster-frame.jsx +192 -0
  211. premiere_cli/panel/host/commands/set-project-panel-metadata.jsx +69 -0
  212. premiere_cli/panel/host/commands/set-scale-to-frame-size.jsx +101 -0
  213. premiere_cli/panel/host/commands/set-scale-width-height.jsx +140 -0
  214. premiere_cli/panel/host/commands/set-sequence-in-out.jsx +65 -0
  215. premiere_cli/panel/host/commands/set-sequence-settings.jsx +184 -0
  216. premiere_cli/panel/host/commands/set-source-in-out.jsx +98 -0
  217. premiere_cli/panel/host/commands/set-target-track.jsx +91 -0
  218. premiere_cli/panel/host/commands/set-time-interpolation.jsx +141 -0
  219. premiere_cli/panel/host/commands/set-track-mute.jsx +91 -0
  220. premiere_cli/panel/host/commands/set-track-visibility.jsx +94 -0
  221. premiere_cli/panel/host/commands/set-transcode-on-ingest.jsx +78 -0
  222. premiere_cli/panel/host/commands/set-uniform-scale.jsx +104 -0
  223. premiere_cli/panel/host/commands/set-work-area.jsx +76 -0
  224. premiere_cli/panel/host/commands/set-workspace.jsx +35 -0
  225. premiere_cli/panel/host/commands/set-xmp-metadata.jsx +157 -0
  226. premiere_cli/panel/host/commands/slide-edit.jsx +162 -0
  227. premiere_cli/panel/host/commands/slip-edit.jsx +167 -0
  228. premiere_cli/panel/host/commands/split-clip.jsx +144 -0
  229. premiere_cli/panel/host/commands/stabilize-clip.jsx +139 -0
  230. premiere_cli/panel/host/commands/stop-playback.jsx +23 -0
  231. premiere_cli/panel/host/commands/trim-clip.jsx +111 -0
  232. premiere_cli/panel/host/commands/undo.jsx +114 -0
  233. premiere_cli/panel/host/commands/unlink-selection.jsx +106 -0
  234. premiere_cli/panel/host/commands/unnest-sequence.jsx +207 -0
  235. premiere_cli/panel/host/commands/update-marker.jsx +120 -0
  236. premiere_cli/panel/host/index.jsx +1227 -0
  237. premiere_cli/panel/host/presets/default-4k-25fps.sqpreset +63 -0
  238. premiere_cli/panel/index.html +16 -0
  239. premiere_cli/panel/js/cs-interface.js +11 -0
  240. premiere_cli/panel/js/main.js +409 -0
  241. premiere_cli/panel_install.py +220 -0
  242. premiere_cli-0.2.0.dist-info/METADATA +127 -0
  243. premiere_cli-0.2.0.dist-info/RECORD +247 -0
  244. premiere_cli-0.2.0.dist-info/WHEEL +5 -0
  245. premiere_cli-0.2.0.dist-info/entry_points.txt +3 -0
  246. premiere_cli-0.2.0.dist-info/licenses/LICENSE +428 -0
  247. premiere_cli-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,181 @@
1
+ // Command: add-keyframe → ppb_addKeyframe
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (findSequenceByName,
4
+ // findClipComponent, findComponentProperty, timeValueToSeconds,
5
+ // tryTimeForms, ...) are already defined there.
6
+ //
7
+ // Standard-DOM mutation. Ported from leancoderkavy's premiere-pro-mcp
8
+ // `add_keyframe` tool (keyframes.ts), addressed here by
9
+ // trackType/trackIndex/clipIndex + componentName/propertyName. Per
10
+ // PREMIERE_API_NOTES.md: prop.setTimeVarying(true) is REQUIRED before
11
+ // addKey()/setValueAtKey() (called here only if not already time-varying —
12
+ // wasAlreadyTimeVarying reports which); `seconds` is clip-relative
13
+ // (matching add-audio-keyframes' convention) and offset by clip.start to
14
+ // sequence time before use. Key-time argument form is disputed across
15
+ // builds — tryTimeForms() tries ticksString, then a Time object, then a
16
+ // raw seconds number, recording every attempt. Verified via a getKeys()
17
+ // COUNT comparison before/after (not an exact-time match) — remove-keyframe
18
+ // is the cleanup path if this adds the wrong thing, since undo is
19
+ // non-functional on this build.
20
+ function ppb_addKeyframe(argsJson) {
21
+ try {
22
+ var args;
23
+ try {
24
+ args = JSON.parse(argsJson);
25
+ } catch (e) {
26
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
27
+ }
28
+
29
+ if (args.trackType !== "video" && args.trackType !== "audio") {
30
+ return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
31
+ }
32
+ if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
33
+ return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
34
+ }
35
+ if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
36
+ return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
37
+ }
38
+ if (typeof args.componentName !== "string" || !args.componentName) {
39
+ return JSON.stringify({ ok: false, error: "componentName is required" });
40
+ }
41
+ if (typeof args.propertyName !== "string" || !args.propertyName) {
42
+ return JSON.stringify({ ok: false, error: "propertyName is required" });
43
+ }
44
+ if (typeof args.seconds !== "number") {
45
+ return JSON.stringify({ ok: false, error: "seconds must be a number (clip-relative)" });
46
+ }
47
+ if (typeof args.value === "undefined") {
48
+ return JSON.stringify({ ok: false, error: "value is required" });
49
+ }
50
+
51
+ if (!app.project) {
52
+ return JSON.stringify({ ok: false, error: "no project open" });
53
+ }
54
+
55
+ var seq = null;
56
+ if (args.sequenceName && typeof args.sequenceName === "string") {
57
+ seq = findSequenceByName(args.sequenceName);
58
+ if (!seq) {
59
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
60
+ }
61
+ } else {
62
+ seq = app.project.activeSequence;
63
+ if (!seq) {
64
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
65
+ }
66
+ }
67
+
68
+ var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
69
+ var numTracks = trackCollection.numTracks;
70
+ if (args.trackIndex >= numTracks) {
71
+ return JSON.stringify({
72
+ ok: false,
73
+ error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
74
+ });
75
+ }
76
+
77
+ var track = trackCollection[args.trackIndex];
78
+ var numClips = track.clips.numItems;
79
+ if (args.clipIndex >= numClips) {
80
+ return JSON.stringify({
81
+ ok: false,
82
+ error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
83
+ });
84
+ }
85
+
86
+ var clip = track.clips[args.clipIndex];
87
+ var clipName = null;
88
+ try { clipName = clip.name; } catch (e) { clipName = null; }
89
+
90
+ var clipStartSeconds = 0;
91
+ try { clipStartSeconds = timeValueToSeconds(clip.start) || 0; } catch (e) { clipStartSeconds = 0; }
92
+
93
+ var comp = findClipComponent(clip, [args.componentName], [args.componentName]);
94
+ if (!comp) {
95
+ return JSON.stringify({
96
+ ok: false,
97
+ error: "component \"" + args.componentName + "\" not found on clip (matched against matchName and displayName)"
98
+ });
99
+ }
100
+ var compDisplayName = null;
101
+ try { compDisplayName = comp.displayName; } catch (e) { compDisplayName = null; }
102
+
103
+ var prop = findComponentProperty(comp, [args.propertyName]);
104
+ if (!prop) {
105
+ return JSON.stringify({
106
+ ok: false,
107
+ error: "property \"" + args.propertyName + "\" not found on component \"" + compDisplayName + "\""
108
+ });
109
+ }
110
+
111
+ var wasAlreadyTimeVarying = false;
112
+ try { wasAlreadyTimeVarying = prop.isTimeVarying(); } catch (e) { wasAlreadyTimeVarying = false; }
113
+
114
+ var setTimeVaryingError = null;
115
+ if (!wasAlreadyTimeVarying) {
116
+ try {
117
+ prop.setTimeVarying(true);
118
+ } catch (e) {
119
+ setTimeVaryingError = e.toString();
120
+ }
121
+ }
122
+
123
+ var keyCountBefore = 0;
124
+ try {
125
+ var keysBefore = prop.getKeys();
126
+ keyCountBefore = keysBefore ? keysBefore.length : 0;
127
+ } catch (e) {
128
+ keyCountBefore = null;
129
+ }
130
+
131
+ var sequenceSeconds = clipStartSeconds + args.seconds;
132
+ var value = args.value;
133
+
134
+ var addAttempt = tryTimeForms(sequenceSeconds, function (t) {
135
+ prop.addKey(t);
136
+ });
137
+
138
+ var setAttempt = null;
139
+ if (addAttempt.success) {
140
+ setAttempt = tryTimeForms(sequenceSeconds, function (t) {
141
+ prop.setValueAtKey(t, value, true);
142
+ });
143
+ }
144
+
145
+ var keyCountAfter = 0;
146
+ try {
147
+ var keysAfter = prop.getKeys();
148
+ keyCountAfter = keysAfter ? keysAfter.length : 0;
149
+ } catch (e) {
150
+ keyCountAfter = null;
151
+ }
152
+
153
+ var verified = (keyCountBefore !== null && keyCountAfter !== null && keyCountAfter === keyCountBefore + 1);
154
+
155
+ return JSON.stringify({
156
+ ok: true,
157
+ result: {
158
+ sequenceName: seq.name,
159
+ trackType: args.trackType,
160
+ trackIndex: args.trackIndex,
161
+ clipIndex: args.clipIndex,
162
+ clipName: clipName,
163
+ componentName: compDisplayName,
164
+ propertyName: args.propertyName,
165
+ seconds: args.seconds,
166
+ sequenceSeconds: sequenceSeconds,
167
+ value: value,
168
+ wasAlreadyTimeVarying: wasAlreadyTimeVarying,
169
+ setTimeVaryingError: setTimeVaryingError,
170
+ addKeyAttempts: addAttempt.attempts,
171
+ setValueAttempts: setAttempt ? setAttempt.attempts : null,
172
+ keyCountBefore: keyCountBefore,
173
+ keyCountAfter: keyCountAfter,
174
+ verified: verified,
175
+ note: "verified is a KEY-COUNT comparison, not an exact-time match — use get-keyframes to confirm the new key's time/value. remove-keyframe is the cleanup path (undo is non-functional on this build)."
176
+ }
177
+ });
178
+ } catch (e) {
179
+ return JSON.stringify({ ok: false, error: e.toString() });
180
+ }
181
+ }
@@ -0,0 +1,194 @@
1
+ // Command: add-marker-to-project-item → ppb_addMarkerToProjectItem
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers are already defined
4
+ // there (this file needs none of them beyond app itself).
5
+ //
6
+ // Ported from leancoderkavy's premiere-pro-mcp add_marker_to_project_item
7
+ // tool. Project-item addressing matches get-item-metadata.jsx (at least
8
+ // one of nodeId/name required, depth-first bin walk, nodeId matched
9
+ // exactly, name matched exactly against item.name, first match wins) —
10
+ // duplicated locally per this panel's convention since each command file
11
+ // loads independently. Adds a SOURCE marker via item.getMarkers(), the
12
+ // same marker API shape as seq.markers per PREMIERE_API_NOTES.md
13
+ // (createMarker(SECONDS), .name/.comments/.type setters, .end in
14
+ // seconds, .setColorByIndex(0-7)).
15
+ //
16
+ // MUTATION RULE: verified by re-finding the marker just created via a
17
+ // fresh item.getMarkers() walk matched on .guid — never trusting the
18
+ // object createMarker() handed back alone.
19
+ //
20
+ // Wire-arg note: the project item is addressed by nodeId/name (like
21
+ // get-item-metadata), so the marker's own label uses "markerName" instead
22
+ // of "name" to avoid colliding with the item-addressing "name" field.
23
+
24
+ function ppbAddMarkerToProjectItem_walk(item, args, depth) {
25
+ if (depth > 32) {
26
+ return null;
27
+ }
28
+
29
+ var isBin = false;
30
+ try {
31
+ isBin = typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
32
+ } catch (e) {
33
+ isBin = false;
34
+ }
35
+
36
+ var matched = false;
37
+ if (args.nodeId !== null) {
38
+ try { matched = item.nodeId === args.nodeId; } catch (e) { matched = false; }
39
+ } else if (args.name !== null) {
40
+ try { matched = item.name === args.name; } catch (e) { matched = false; }
41
+ }
42
+ if (matched) {
43
+ return item;
44
+ }
45
+
46
+ if (isBin && item.children) {
47
+ for (var i = 0; i < item.children.numItems; i++) {
48
+ var found = ppbAddMarkerToProjectItem_walk(item.children[i], args, depth + 1);
49
+ if (found) {
50
+ return found;
51
+ }
52
+ }
53
+ }
54
+ return null;
55
+ }
56
+
57
+ function ppbAddMarkerToProjectItem_resolve(args) {
58
+ var root = app.project.rootItem;
59
+ for (var i = 0; i < root.children.numItems; i++) {
60
+ var found = ppbAddMarkerToProjectItem_walk(root.children[i], args, 1);
61
+ if (found) {
62
+ return found;
63
+ }
64
+ }
65
+ return null;
66
+ }
67
+
68
+ function ppbAddMarkerToProjectItem_serializeOne(m) {
69
+ var entry = { name: null, comments: null, type: null, startSeconds: null, endSeconds: null, guid: null };
70
+ try { entry.name = m.name; } catch (e) { entry.name = null; }
71
+ try { entry.comments = m.comments; } catch (e) { entry.comments = null; }
72
+ try { entry.type = m.type; } catch (e) { entry.type = null; }
73
+ try {
74
+ entry.startSeconds = typeof m.start.seconds === "number" ? m.start.seconds : Number(m.start.ticks) / TICKS_PER_SECOND;
75
+ } catch (e) { entry.startSeconds = null; }
76
+ try {
77
+ entry.endSeconds = typeof m.end.seconds === "number" ? m.end.seconds : Number(m.end.ticks) / TICKS_PER_SECOND;
78
+ } catch (e) { entry.endSeconds = null; }
79
+ try { entry.guid = m.guid; } catch (e) { entry.guid = null; }
80
+ return entry;
81
+ }
82
+
83
+ function ppbAddMarkerToProjectItem_findByGuid(markers, guid) {
84
+ var m = markers.getFirstMarker();
85
+ var iterations = 0;
86
+ while (m !== null && typeof m !== "undefined" && iterations < 10000) {
87
+ var thisGuid = null;
88
+ try { thisGuid = m.guid; } catch (e) { thisGuid = null; }
89
+ if (thisGuid === guid) {
90
+ return m;
91
+ }
92
+ m = markers.getNextMarker(m);
93
+ iterations++;
94
+ }
95
+ return null;
96
+ }
97
+
98
+ function ppb_addMarkerToProjectItem(argsJson) {
99
+ try {
100
+ var args;
101
+ try {
102
+ args = JSON.parse(argsJson);
103
+ } catch (e) {
104
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
105
+ }
106
+
107
+ var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
108
+ var hasName = typeof args.name === "string" && args.name.length > 0;
109
+ if (!hasNodeId && !hasName) {
110
+ return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
111
+ }
112
+
113
+ if (typeof args.seconds !== "number" || isNaN(args.seconds) || args.seconds < 0) {
114
+ return JSON.stringify({ ok: false, error: "seconds must be a non-negative number" });
115
+ }
116
+
117
+ if (!app.project) {
118
+ return JSON.stringify({ ok: false, error: "no project open" });
119
+ }
120
+
121
+ var item = ppbAddMarkerToProjectItem_resolve({
122
+ nodeId: hasNodeId ? args.nodeId : null,
123
+ name: hasNodeId ? null : args.name
124
+ });
125
+ if (!item) {
126
+ return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
127
+ }
128
+
129
+ var markers;
130
+ try {
131
+ markers = item.getMarkers();
132
+ } catch (e) {
133
+ return JSON.stringify({ ok: false, error: "getMarkers() failed on this item: " + e.toString() });
134
+ }
135
+ if (!markers || typeof markers.createMarker !== "function") {
136
+ return JSON.stringify({ ok: false, error: "this project item has no marker collection" });
137
+ }
138
+
139
+ var marker;
140
+ try {
141
+ marker = markers.createMarker(args.seconds);
142
+ } catch (e) {
143
+ return JSON.stringify({ ok: false, error: "createMarker failed: " + e.toString() });
144
+ }
145
+ if (!marker) {
146
+ return JSON.stringify({ ok: false, error: "createMarker returned no marker" });
147
+ }
148
+
149
+ if (typeof args.markerName === "string") {
150
+ try { marker.name = args.markerName; } catch (e) { /* best-effort */ }
151
+ }
152
+ if (typeof args.comments === "string") {
153
+ try { marker.comments = args.comments; } catch (e) { /* best-effort */ }
154
+ }
155
+ if (typeof args.type === "string") {
156
+ try { marker.type = args.type; } catch (e) { /* best-effort */ }
157
+ }
158
+ if (typeof args.colorIndex === "number") {
159
+ try { marker.setColorByIndex(args.colorIndex); } catch (e) { /* best-effort */ }
160
+ }
161
+ if (typeof args.durationSeconds === "number" && args.durationSeconds > 0) {
162
+ try {
163
+ var endTime = new Time();
164
+ endTime.seconds = args.seconds + args.durationSeconds;
165
+ marker.end = endTime;
166
+ } catch (e) { /* best-effort */ }
167
+ }
168
+
169
+ var guid = null;
170
+ try { guid = marker.guid; } catch (e) { guid = null; }
171
+
172
+ var verified = null;
173
+ if (guid !== null) {
174
+ var found = ppbAddMarkerToProjectItem_findByGuid(markers, guid);
175
+ if (found) {
176
+ verified = ppbAddMarkerToProjectItem_serializeOne(found);
177
+ }
178
+ }
179
+ if (verified === null) {
180
+ verified = ppbAddMarkerToProjectItem_serializeOne(marker);
181
+ }
182
+
183
+ return JSON.stringify({
184
+ ok: true,
185
+ result: {
186
+ item: (function () { try { return item.name; } catch (e) { return null; } })(),
187
+ nodeId: (function () { try { return item.nodeId; } catch (e) { return null; } })(),
188
+ marker: verified
189
+ }
190
+ });
191
+ } catch (e) {
192
+ return JSON.stringify({ ok: false, error: e.toString() });
193
+ }
194
+ }
@@ -0,0 +1,129 @@
1
+ // Command: add-marker → ppb_addMarker
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (TICKS_PER_SECOND,
4
+ // findSequenceByName, timeValueToSeconds, ...) are already defined there.
5
+ //
6
+ // Ported from leancoderkavy's premiere-pro-mcp add_marker tool — adds a
7
+ // marker to the ACTIVE (or named) SEQUENCE's own marker collection
8
+ // (seq.markers), not a project item (see add-marker-to-project-item.jsx
9
+ // for that). Per PREMIERE_API_NOTES.md: markers.createMarker(SECONDS)
10
+ // returns the new marker; .name/.comments/.type are plain setters; .end
11
+ // is also a SECONDS value (not ticks, despite everything else in this
12
+ // panel using ticks strings); color is set via .setColorByIndex(0-7).
13
+ //
14
+ // MUTATION RULE: verified by re-finding the marker just created via a
15
+ // fresh getFirstMarker()/getNextMarker() walk matched on .guid (never
16
+ // trusting the object createMarker() handed back alone) and serializing
17
+ // that freshly-read marker back to the caller.
18
+
19
+ function ppbAddMarker_serializeOne(m) {
20
+ var entry = { name: null, comments: null, type: null, startSeconds: null, endSeconds: null, guid: null };
21
+ try { entry.name = m.name; } catch (e) { entry.name = null; }
22
+ try { entry.comments = m.comments; } catch (e) { entry.comments = null; }
23
+ try { entry.type = m.type; } catch (e) { entry.type = null; }
24
+ try { entry.startSeconds = timeValueToSeconds(m.start); } catch (e) { entry.startSeconds = null; }
25
+ try { entry.endSeconds = timeValueToSeconds(m.end); } catch (e) { entry.endSeconds = null; }
26
+ try { entry.guid = m.guid; } catch (e) { entry.guid = null; }
27
+ return entry;
28
+ }
29
+
30
+ function ppbAddMarker_findByGuid(seq, guid) {
31
+ var m = seq.markers.getFirstMarker();
32
+ var iterations = 0;
33
+ while (m !== null && typeof m !== "undefined" && iterations < 10000) {
34
+ var thisGuid = null;
35
+ try { thisGuid = m.guid; } catch (e) { thisGuid = null; }
36
+ if (thisGuid === guid) {
37
+ return m;
38
+ }
39
+ m = seq.markers.getNextMarker(m);
40
+ iterations++;
41
+ }
42
+ return null;
43
+ }
44
+
45
+ function ppb_addMarker(argsJson) {
46
+ try {
47
+ var args;
48
+ try {
49
+ args = JSON.parse(argsJson);
50
+ } catch (e) {
51
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
52
+ }
53
+
54
+ if (typeof args.seconds !== "number" || isNaN(args.seconds) || args.seconds < 0) {
55
+ return JSON.stringify({ ok: false, error: "seconds must be a non-negative number" });
56
+ }
57
+
58
+ if (!app.project) {
59
+ return JSON.stringify({ ok: false, error: "no project open" });
60
+ }
61
+
62
+ var seq = null;
63
+ if (args.sequenceName && typeof args.sequenceName === "string") {
64
+ seq = findSequenceByName(args.sequenceName);
65
+ if (!seq) {
66
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
67
+ }
68
+ } else {
69
+ seq = app.project.activeSequence;
70
+ if (!seq) {
71
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
72
+ }
73
+ }
74
+
75
+ var marker;
76
+ try {
77
+ marker = seq.markers.createMarker(args.seconds);
78
+ } catch (e) {
79
+ return JSON.stringify({ ok: false, error: "createMarker failed: " + e.toString() });
80
+ }
81
+ if (!marker) {
82
+ return JSON.stringify({ ok: false, error: "createMarker returned no marker" });
83
+ }
84
+
85
+ if (typeof args.name === "string") {
86
+ try { marker.name = args.name; } catch (e) { /* best-effort */ }
87
+ }
88
+ if (typeof args.comments === "string") {
89
+ try { marker.comments = args.comments; } catch (e) { /* best-effort */ }
90
+ }
91
+ if (typeof args.type === "string") {
92
+ try { marker.type = args.type; } catch (e) { /* best-effort */ }
93
+ }
94
+ if (typeof args.colorIndex === "number") {
95
+ try { marker.setColorByIndex(args.colorIndex); } catch (e) { /* best-effort */ }
96
+ }
97
+ if (typeof args.durationSeconds === "number" && args.durationSeconds > 0) {
98
+ try { marker.end = args.seconds + args.durationSeconds; } catch (e) { /* best-effort */ }
99
+ }
100
+
101
+ var guid = null;
102
+ try { guid = marker.guid; } catch (e) { guid = null; }
103
+
104
+ var verified = null;
105
+ if (guid !== null) {
106
+ var found = ppbAddMarker_findByGuid(seq, guid);
107
+ if (found) {
108
+ verified = ppbAddMarker_serializeOne(found);
109
+ }
110
+ }
111
+ if (verified === null) {
112
+ // No guid available, or the re-find failed — fall back to
113
+ // serializing the object createMarker handed back directly. Still a
114
+ // live read of the marker's own properties, just not an
115
+ // independently re-fetched one.
116
+ verified = ppbAddMarker_serializeOne(marker);
117
+ }
118
+
119
+ return JSON.stringify({
120
+ ok: true,
121
+ result: {
122
+ sequenceName: seq.name,
123
+ marker: verified
124
+ }
125
+ });
126
+ } catch (e) {
127
+ return JSON.stringify({ ok: false, error: e.toString() });
128
+ }
129
+ }
@@ -0,0 +1,101 @@
1
+ // Command: add-text-overlay → ppb_addTextOverlay
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — secondsToTicksString is already
4
+ // defined there.
5
+ //
6
+ // Ported from leancoderkavy's premiere-pro-mcp text.ts add_text_overlay —
7
+ // EXACTLY as that reference implements it, including its own documented
8
+ // caveat: "Premiere's ExtendScript API does not expose Essential-Graphics
9
+ // title creation" (confirmed independently in PREMIERE_API_NOTES.md's
10
+ // "No title-creation API exists" line — createNewTitle is gone, Essential
11
+ // Graphics titles cannot be scripted), so this routes text through the
12
+ // Captions/Subtitle API instead of a real freeform title.
13
+ //
14
+ // ⚠️ API ARITY CONFLICT (documented honestly, not resolved): this file
15
+ // calls seq.createCaptionTrack(formatNum) with ONE argument, matching
16
+ // text.ts's own implementation byte-for-byte. PREMIERE_API_NOTES.md's
17
+ // "Captions" line documents a DIFFERENT, 3-argument signature —
18
+ // seq.createCaptionTrack(srtProjectItem, startSeconds, formatConstant) —
19
+ // which is what this panel's own create-caption-track command uses. The
20
+ // two reference tools this panel ports from disagree on arity for the
21
+ // same underlying call, and text.ts's 1-arg form has NOT been live-tested
22
+ // against this Premiere build — it may throw "Illegal Parameter type" (a
23
+ // known failure mode elsewhere in this codebase when a call's real arity
24
+ // is wrong). If this command fails, prefer create-caption-track (which
25
+ // requires an actual imported .srt project item) or render a PNG
26
+ // externally and import it, per PREMIERE_API_NOTES.md's own suggested
27
+ // alternatives.
28
+ //
29
+ // formatMap below is text.ts's own numeric map (Sequence.captionFormat),
30
+ // NOT the Sequence.CAPTION_FORMAT_* named constants create-caption-track
31
+ // uses — kept separate deliberately since this file mirrors text.ts
32
+ // exactly per its own convention.
33
+ function ppb_addTextOverlay(argsJson) {
34
+ try {
35
+ var args;
36
+ try {
37
+ args = JSON.parse(argsJson);
38
+ } catch (e) {
39
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
40
+ }
41
+
42
+ if (typeof args.text !== "string" || !args.text) {
43
+ return JSON.stringify({ ok: false, error: "text is required" });
44
+ }
45
+
46
+ var startSeconds = typeof args.startSeconds === "number" ? args.startSeconds : 0;
47
+ var durationSeconds = typeof args.durationSeconds === "number" ? args.durationSeconds : 5;
48
+
49
+ var formatMap = { "subtitle": 3, "608": 1, "708": 2, "teletext": 4 };
50
+ var captionFormat = (typeof args.captionFormat === "string" && formatMap.hasOwnProperty(args.captionFormat)) ? args.captionFormat : "subtitle";
51
+ var formatNum = formatMap[captionFormat];
52
+
53
+ if (!app.project) {
54
+ return JSON.stringify({ ok: false, error: "no project open" });
55
+ }
56
+ var seq = app.project.activeSequence;
57
+ if (!seq) {
58
+ return JSON.stringify({ ok: false, error: "no active sequence" });
59
+ }
60
+
61
+ var startTicks = secondsToTicksString(startSeconds);
62
+ var endTicks = secondsToTicksString(startSeconds + durationSeconds);
63
+
64
+ var captionTrack = null;
65
+ try {
66
+ captionTrack = seq.createCaptionTrack(formatNum);
67
+ } catch (eCT) {
68
+ return JSON.stringify({ ok: false, error: "createCaptionTrack failed: " + eCT.toString() });
69
+ }
70
+ if (!captionTrack) {
71
+ return JSON.stringify({ ok: false, error: "could not create caption track" });
72
+ }
73
+
74
+ var newCap = null;
75
+ var textSetError = null;
76
+ try {
77
+ newCap = captionTrack.addCaption(startTicks, endTicks);
78
+ if (newCap) {
79
+ try { newCap.text = args.text; } catch (eT) { textSetError = eT.toString(); }
80
+ }
81
+ } catch (eAdd) {
82
+ return JSON.stringify({ ok: false, error: "addCaption failed: " + eAdd.toString() });
83
+ }
84
+
85
+ return JSON.stringify({
86
+ ok: true,
87
+ result: {
88
+ added: true,
89
+ text: args.text,
90
+ captionFormat: formatNum,
91
+ captionFormatName: captionFormat,
92
+ startSeconds: startSeconds,
93
+ durationSeconds: durationSeconds,
94
+ textSetError: textSetError,
95
+ note: "Routed through the Captions API per text.ts's own approach — no Essential-Graphics title-creation API exists on this build. Not live-tested; the 1-arg createCaptionTrack() form conflicts with the 3-arg form PREMIERE_API_NOTES.md documents (see file header comment)."
96
+ }
97
+ });
98
+ } catch (e) {
99
+ return JSON.stringify({ ok: false, error: e.toString() });
100
+ }
101
+ }