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,142 @@
1
+ // Command: select-clips-by-color → ppb_selectClipsByColor
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (findSequenceByName,
4
+ // timeValueToSeconds, ...) are already defined there.
5
+ //
6
+ // Standard-DOM only — no QE needed. Ported from leancoderkavy's
7
+ // premiere-pro-mcp `select_clips_by_color` tool (selection.ts): selects
8
+ // every clip whose source projectItem's color label
9
+ // (projectItem.getColorLabel()) matches colorLabel (0-15). If
10
+ // getColorLabel isn't available on this Premiere build, degrades honestly
11
+ // (same pattern as search-project-items' colorLabel filter) rather than
12
+ // silently reporting zero matches. Mutation — verified via
13
+ // seq.getSelection() afterward.
14
+
15
+ function ppb_selectClipsByColorCollectSelection(seq) {
16
+ var sel = null;
17
+ try {
18
+ sel = seq.getSelection();
19
+ } catch (e) {
20
+ sel = null;
21
+ }
22
+ var selCount = 0;
23
+ if (sel) {
24
+ if (typeof sel.numItems === "number") {
25
+ selCount = sel.numItems;
26
+ } else if (typeof sel.length === "number") {
27
+ selCount = sel.length;
28
+ }
29
+ }
30
+ var selectedClips = [];
31
+ var cap = selCount > 20 ? 20 : selCount;
32
+ for (var i = 0; i < cap; i++) {
33
+ var item = sel[i];
34
+ var entry = { name: null, mediaType: null, startSeconds: null, endSeconds: null, nodeId: null };
35
+ try { entry.name = item.name; } catch (e) { entry.name = null; }
36
+ try { entry.mediaType = item.mediaType; } catch (e) { entry.mediaType = null; }
37
+ try { entry.startSeconds = timeValueToSeconds(item.start); } catch (e) { entry.startSeconds = null; }
38
+ try { entry.endSeconds = timeValueToSeconds(item.end); } catch (e) { entry.endSeconds = null; }
39
+ try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
40
+ selectedClips.push(entry);
41
+ }
42
+ var result = { selectedCount: selCount, selectedClips: selectedClips };
43
+ if (selCount > 20) {
44
+ result.truncated = true;
45
+ }
46
+ return result;
47
+ }
48
+
49
+ function ppb_selectClipsByColor(argsJson) {
50
+ try {
51
+ var args;
52
+ try {
53
+ args = JSON.parse(argsJson);
54
+ } catch (e) {
55
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
56
+ }
57
+
58
+ if (typeof args.colorLabel !== "number" || args.colorLabel < 0 || args.colorLabel > 15 || Math.floor(args.colorLabel) !== args.colorLabel) {
59
+ return JSON.stringify({ ok: false, error: "colorLabel must be an integer 0-15" });
60
+ }
61
+
62
+ if (!app.project) {
63
+ return JSON.stringify({ ok: false, error: "no project open" });
64
+ }
65
+
66
+ var seq = null;
67
+ if (args.sequenceName && typeof args.sequenceName === "string") {
68
+ seq = findSequenceByName(args.sequenceName);
69
+ if (!seq) {
70
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
71
+ }
72
+ } else {
73
+ seq = app.project.activeSequence;
74
+ if (!seq) {
75
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
76
+ }
77
+ }
78
+
79
+ function deselectAllInTracks(tracks) {
80
+ for (var t = 0; t < tracks.numTracks; t++) {
81
+ var track = tracks[t];
82
+ for (var c = 0; c < track.clips.numItems; c++) {
83
+ try { track.clips[c].setSelected(false, true); } catch (e) { /* best-effort */ }
84
+ }
85
+ }
86
+ }
87
+
88
+ deselectAllInTracks(seq.videoTracks);
89
+ deselectAllInTracks(seq.audioTracks);
90
+
91
+ // null = not yet determined, true = confirmed available, false = confirmed unavailable
92
+ var apiAvailable = null;
93
+
94
+ function scanTracksForColor(tracks) {
95
+ for (var t = 0; t < tracks.numTracks; t++) {
96
+ var track = tracks[t];
97
+ for (var c = 0; c < track.clips.numItems; c++) {
98
+ var clip = track.clips[c];
99
+ var projectItem = null;
100
+ try { projectItem = clip.projectItem; } catch (e) { projectItem = null; }
101
+ if (!projectItem) {
102
+ continue;
103
+ }
104
+ try {
105
+ var label = projectItem.getColorLabel();
106
+ apiAvailable = true;
107
+ if (label === args.colorLabel) {
108
+ try { clip.setSelected(true, true); } catch (e2) { /* best-effort */ }
109
+ }
110
+ } catch (e) {
111
+ if (apiAvailable === null) {
112
+ apiAvailable = false;
113
+ }
114
+ }
115
+ }
116
+ }
117
+ }
118
+
119
+ scanTracksForColor(seq.videoTracks);
120
+ scanTracksForColor(seq.audioTracks);
121
+
122
+ if (apiAvailable === false) {
123
+ return JSON.stringify({ ok: false, error: "getColorLabel is not available on this Premiere build" });
124
+ }
125
+
126
+ var selectionResult = ppb_selectClipsByColorCollectSelection(seq);
127
+
128
+ var result = {
129
+ sequenceName: seq.name,
130
+ colorLabel: args.colorLabel
131
+ };
132
+ result.selectedCount = selectionResult.selectedCount;
133
+ result.selectedClips = selectionResult.selectedClips;
134
+ if (selectionResult.truncated) {
135
+ result.truncated = true;
136
+ }
137
+
138
+ return JSON.stringify({ ok: true, result: result });
139
+ } catch (e) {
140
+ return JSON.stringify({ ok: false, error: e.toString() });
141
+ }
142
+ }
@@ -0,0 +1,133 @@
1
+ // Command: select-clips-by-name → ppb_selectClipsByName
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (findSequenceByName,
4
+ // timeValueToSeconds, ...) are already defined there.
5
+ //
6
+ // Standard-DOM only (clip.setSelected(bool, true)) — no QE needed. Ported
7
+ // from leancoderkavy's premiere-pro-mcp `select_clips_by_name` tool
8
+ // (selection.ts): case-insensitive substring match against clip name,
9
+ // across all video+audio tracks. Mutation — verified via seq.getSelection()
10
+ // afterward, never via setSelected()'s own return value.
11
+
12
+ function ppb_selectClipsByNameCollectSelection(seq) {
13
+ var sel = null;
14
+ try {
15
+ sel = seq.getSelection();
16
+ } catch (e) {
17
+ sel = null;
18
+ }
19
+ var selCount = 0;
20
+ if (sel) {
21
+ if (typeof sel.numItems === "number") {
22
+ selCount = sel.numItems;
23
+ } else if (typeof sel.length === "number") {
24
+ selCount = sel.length;
25
+ }
26
+ }
27
+ var selectedClips = [];
28
+ var cap = selCount > 20 ? 20 : selCount;
29
+ for (var i = 0; i < cap; i++) {
30
+ var item = sel[i];
31
+ var entry = { name: null, mediaType: null, startSeconds: null, endSeconds: null, nodeId: null };
32
+ try { entry.name = item.name; } catch (e) { entry.name = null; }
33
+ try { entry.mediaType = item.mediaType; } catch (e) { entry.mediaType = null; }
34
+ try { entry.startSeconds = timeValueToSeconds(item.start); } catch (e) { entry.startSeconds = null; }
35
+ try { entry.endSeconds = timeValueToSeconds(item.end); } catch (e) { entry.endSeconds = null; }
36
+ try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
37
+ selectedClips.push(entry);
38
+ }
39
+ var result = { selectedCount: selCount, selectedClips: selectedClips };
40
+ if (selCount > 20) {
41
+ result.truncated = true;
42
+ }
43
+ return result;
44
+ }
45
+
46
+ function ppb_selectClipsByName(argsJson) {
47
+ try {
48
+ var args;
49
+ try {
50
+ args = JSON.parse(argsJson);
51
+ } catch (e) {
52
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
53
+ }
54
+
55
+ if (!args.nameContains || typeof args.nameContains !== "string") {
56
+ return JSON.stringify({ ok: false, error: "nameContains is required" });
57
+ }
58
+
59
+ if (!app.project) {
60
+ return JSON.stringify({ ok: false, error: "no project open" });
61
+ }
62
+
63
+ var seq = null;
64
+ if (args.sequenceName && typeof args.sequenceName === "string") {
65
+ seq = findSequenceByName(args.sequenceName);
66
+ if (!seq) {
67
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
68
+ }
69
+ } else {
70
+ seq = app.project.activeSequence;
71
+ if (!seq) {
72
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
73
+ }
74
+ }
75
+
76
+ var addToSelection = !!args.addToSelection;
77
+ var query = args.nameContains.toLowerCase();
78
+
79
+ function deselectAll() {
80
+ var t, c;
81
+ for (t = 0; t < seq.videoTracks.numTracks; t++) {
82
+ var vt = seq.videoTracks[t];
83
+ for (c = 0; c < vt.clips.numItems; c++) {
84
+ try { vt.clips[c].setSelected(false, true); } catch (e) { /* best-effort */ }
85
+ }
86
+ }
87
+ for (t = 0; t < seq.audioTracks.numTracks; t++) {
88
+ var at = seq.audioTracks[t];
89
+ for (c = 0; c < at.clips.numItems; c++) {
90
+ try { at.clips[c].setSelected(false, true); } catch (e) { /* best-effort */ }
91
+ }
92
+ }
93
+ }
94
+
95
+ if (!addToSelection) {
96
+ deselectAll();
97
+ }
98
+
99
+ function selectMatchingInTracks(tracks) {
100
+ for (var t = 0; t < tracks.numTracks; t++) {
101
+ var track = tracks[t];
102
+ for (var c = 0; c < track.clips.numItems; c++) {
103
+ var clip = track.clips[c];
104
+ var clipName = null;
105
+ try { clipName = clip.name; } catch (e) { clipName = null; }
106
+ if (clipName !== null && clipName.toLowerCase().indexOf(query) !== -1) {
107
+ try { clip.setSelected(true, true); } catch (e) { /* best-effort */ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ selectMatchingInTracks(seq.videoTracks);
114
+ selectMatchingInTracks(seq.audioTracks);
115
+
116
+ var selectionResult = ppb_selectClipsByNameCollectSelection(seq);
117
+
118
+ var result = {
119
+ sequenceName: seq.name,
120
+ nameContains: args.nameContains,
121
+ addToSelection: addToSelection
122
+ };
123
+ result.selectedCount = selectionResult.selectedCount;
124
+ result.selectedClips = selectionResult.selectedClips;
125
+ if (selectionResult.truncated) {
126
+ result.truncated = true;
127
+ }
128
+
129
+ return JSON.stringify({ ok: true, result: result });
130
+ } catch (e) {
131
+ return JSON.stringify({ ok: false, error: e.toString() });
132
+ }
133
+ }
@@ -0,0 +1,133 @@
1
+ // Command: select-clips-in-range → ppb_selectClipsInRange
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (findSequenceByName,
4
+ // timeValueToSeconds, ...) are already defined there.
5
+ //
6
+ // Standard-DOM only (clip.setSelected(bool, true)) — no QE needed. Ported
7
+ // from leancoderkavy's premiere-pro-mcp `select_clips_in_range` tool
8
+ // (selection.ts): a clip qualifies if it OVERLAPS the given range
9
+ // (clipStart < rangeEnd && clipEnd > rangeStart), not merely contained by
10
+ // it. Mutation — verified via seq.getSelection() afterward.
11
+
12
+ function ppb_selectClipsInRangeCollectSelection(seq) {
13
+ var sel = null;
14
+ try {
15
+ sel = seq.getSelection();
16
+ } catch (e) {
17
+ sel = null;
18
+ }
19
+ var selCount = 0;
20
+ if (sel) {
21
+ if (typeof sel.numItems === "number") {
22
+ selCount = sel.numItems;
23
+ } else if (typeof sel.length === "number") {
24
+ selCount = sel.length;
25
+ }
26
+ }
27
+ var selectedClips = [];
28
+ var cap = selCount > 20 ? 20 : selCount;
29
+ for (var i = 0; i < cap; i++) {
30
+ var item = sel[i];
31
+ var entry = { name: null, mediaType: null, startSeconds: null, endSeconds: null, nodeId: null };
32
+ try { entry.name = item.name; } catch (e) { entry.name = null; }
33
+ try { entry.mediaType = item.mediaType; } catch (e) { entry.mediaType = null; }
34
+ try { entry.startSeconds = timeValueToSeconds(item.start); } catch (e) { entry.startSeconds = null; }
35
+ try { entry.endSeconds = timeValueToSeconds(item.end); } catch (e) { entry.endSeconds = null; }
36
+ try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
37
+ selectedClips.push(entry);
38
+ }
39
+ var result = { selectedCount: selCount, selectedClips: selectedClips };
40
+ if (selCount > 20) {
41
+ result.truncated = true;
42
+ }
43
+ return result;
44
+ }
45
+
46
+ function ppb_selectClipsInRange(argsJson) {
47
+ try {
48
+ var args;
49
+ try {
50
+ args = JSON.parse(argsJson);
51
+ } catch (e) {
52
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
53
+ }
54
+
55
+ if (typeof args.startSeconds !== "number" || !isFinite(args.startSeconds) || args.startSeconds < 0) {
56
+ return JSON.stringify({ ok: false, error: "startSeconds must be a non-negative number" });
57
+ }
58
+ if (typeof args.endSeconds !== "number" || !isFinite(args.endSeconds) || args.endSeconds < 0) {
59
+ return JSON.stringify({ ok: false, error: "endSeconds must be a non-negative number" });
60
+ }
61
+ if (args.endSeconds <= args.startSeconds) {
62
+ return JSON.stringify({ ok: false, error: "endSeconds must be greater than startSeconds" });
63
+ }
64
+
65
+ if (!app.project) {
66
+ return JSON.stringify({ ok: false, error: "no project open" });
67
+ }
68
+
69
+ var seq = null;
70
+ if (args.sequenceName && typeof args.sequenceName === "string") {
71
+ seq = findSequenceByName(args.sequenceName);
72
+ if (!seq) {
73
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
74
+ }
75
+ } else {
76
+ seq = app.project.activeSequence;
77
+ if (!seq) {
78
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
79
+ }
80
+ }
81
+
82
+ function deselectAllInTracks(tracks) {
83
+ for (var t = 0; t < tracks.numTracks; t++) {
84
+ var track = tracks[t];
85
+ for (var c = 0; c < track.clips.numItems; c++) {
86
+ try { track.clips[c].setSelected(false, true); } catch (e) { /* best-effort */ }
87
+ }
88
+ }
89
+ }
90
+
91
+ deselectAllInTracks(seq.videoTracks);
92
+ deselectAllInTracks(seq.audioTracks);
93
+
94
+ function selectOverlappingInTracks(tracks) {
95
+ for (var t = 0; t < tracks.numTracks; t++) {
96
+ var track = tracks[t];
97
+ for (var c = 0; c < track.clips.numItems; c++) {
98
+ var clip = track.clips[c];
99
+ var cs = null;
100
+ var ce = null;
101
+ try { cs = timeValueToSeconds(clip.start); } catch (e) { cs = null; }
102
+ try { ce = timeValueToSeconds(clip.end); } catch (e) { ce = null; }
103
+ if (cs === null || ce === null) {
104
+ continue;
105
+ }
106
+ if (cs < args.endSeconds && ce > args.startSeconds) {
107
+ try { clip.setSelected(true, true); } catch (e) { /* best-effort */ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+
113
+ selectOverlappingInTracks(seq.videoTracks);
114
+ selectOverlappingInTracks(seq.audioTracks);
115
+
116
+ var selectionResult = ppb_selectClipsInRangeCollectSelection(seq);
117
+
118
+ var result = {
119
+ sequenceName: seq.name,
120
+ startSeconds: args.startSeconds,
121
+ endSeconds: args.endSeconds
122
+ };
123
+ result.selectedCount = selectionResult.selectedCount;
124
+ result.selectedClips = selectionResult.selectedClips;
125
+ if (selectionResult.truncated) {
126
+ result.truncated = true;
127
+ }
128
+
129
+ return JSON.stringify({ ok: true, result: result });
130
+ } catch (e) {
131
+ return JSON.stringify({ ok: false, error: e.toString() });
132
+ }
133
+ }
@@ -0,0 +1,127 @@
1
+ // Command: select-disabled-clips → ppb_selectDisabledClips
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context — shared helpers (findSequenceByName,
4
+ // timeValueToSeconds, ...) are already defined there.
5
+ //
6
+ // Standard-DOM only (clip.disabled property, same field serializeTrackItem
7
+ // already reads) — no QE needed. Ported from leancoderkavy's
8
+ // premiere-pro-mcp `select_disabled_clips` tool (selection.ts), which
9
+ // reads clip.isDisabled() — on this codebase's standard DOM the
10
+ // equivalent, already-proven-readable field is the clip.disabled
11
+ // property (see serializeTrackItem in host/index.jsx), used here instead.
12
+ // A clip whose .disabled throws is skipped (left untouched). Mutation —
13
+ // verified via seq.getSelection() afterward.
14
+
15
+ function ppb_selectDisabledClipsCollectSelection(seq) {
16
+ var sel = null;
17
+ try {
18
+ sel = seq.getSelection();
19
+ } catch (e) {
20
+ sel = null;
21
+ }
22
+ var selCount = 0;
23
+ if (sel) {
24
+ if (typeof sel.numItems === "number") {
25
+ selCount = sel.numItems;
26
+ } else if (typeof sel.length === "number") {
27
+ selCount = sel.length;
28
+ }
29
+ }
30
+ var selectedClips = [];
31
+ var cap = selCount > 20 ? 20 : selCount;
32
+ for (var i = 0; i < cap; i++) {
33
+ var item = sel[i];
34
+ var entry = { name: null, mediaType: null, startSeconds: null, endSeconds: null, nodeId: null };
35
+ try { entry.name = item.name; } catch (e) { entry.name = null; }
36
+ try { entry.mediaType = item.mediaType; } catch (e) { entry.mediaType = null; }
37
+ try { entry.startSeconds = timeValueToSeconds(item.start); } catch (e) { entry.startSeconds = null; }
38
+ try { entry.endSeconds = timeValueToSeconds(item.end); } catch (e) { entry.endSeconds = null; }
39
+ try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
40
+ selectedClips.push(entry);
41
+ }
42
+ var result = { selectedCount: selCount, selectedClips: selectedClips };
43
+ if (selCount > 20) {
44
+ result.truncated = true;
45
+ }
46
+ return result;
47
+ }
48
+
49
+ function ppb_selectDisabledClips(argsJson) {
50
+ try {
51
+ var args;
52
+ try {
53
+ args = JSON.parse(argsJson);
54
+ } catch (e) {
55
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
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
+ function deselectAllInTracks(tracks) {
76
+ for (var t = 0; t < tracks.numTracks; t++) {
77
+ var track = tracks[t];
78
+ for (var c = 0; c < track.clips.numItems; c++) {
79
+ try { track.clips[c].setSelected(false, true); } catch (e) { /* best-effort */ }
80
+ }
81
+ }
82
+ }
83
+
84
+ deselectAllInTracks(seq.videoTracks);
85
+ deselectAllInTracks(seq.audioTracks);
86
+
87
+ var skipped = 0;
88
+
89
+ function selectDisabledInTracks(tracks) {
90
+ for (var t = 0; t < tracks.numTracks; t++) {
91
+ var track = tracks[t];
92
+ for (var c = 0; c < track.clips.numItems; c++) {
93
+ var clip = track.clips[c];
94
+ var disabled;
95
+ try {
96
+ disabled = clip.disabled;
97
+ } catch (e) {
98
+ skipped++;
99
+ continue;
100
+ }
101
+ if (disabled === true) {
102
+ try { clip.setSelected(true, true); } catch (e) { /* best-effort */ }
103
+ }
104
+ }
105
+ }
106
+ }
107
+
108
+ selectDisabledInTracks(seq.videoTracks);
109
+ selectDisabledInTracks(seq.audioTracks);
110
+
111
+ var selectionResult = ppb_selectDisabledClipsCollectSelection(seq);
112
+
113
+ var result = {
114
+ sequenceName: seq.name,
115
+ skippedUnreadable: skipped
116
+ };
117
+ result.selectedCount = selectionResult.selectedCount;
118
+ result.selectedClips = selectionResult.selectedClips;
119
+ if (selectionResult.truncated) {
120
+ result.truncated = true;
121
+ }
122
+
123
+ return JSON.stringify({ ok: true, result: result });
124
+ } catch (e) {
125
+ return JSON.stringify({ ok: false, error: e.toString() });
126
+ }
127
+ }
@@ -0,0 +1,115 @@
1
+ // Command: select-project-item → ppb_selectProjectItem
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context.
4
+ //
5
+ // Ported from leancoderkavy's premiere-pro-mcp select_item tool (renamed
6
+ // select-project-item here for clarity, since this panel already has
7
+ // several clip/track "select" concepts and this one is specifically the
8
+ // Project panel). Project-item addressing matches get-item-metadata.jsx
9
+ // (nodeId/name, depth-first bin walk, duplicated locally per this panel's
10
+ // convention). The reference calls item.select() directly with no
11
+ // verification at all — no confirmed "read current Project-panel
12
+ // selection" API exists anywhere in PREMIERE_API_NOTES.md (the documented
13
+ // seq.getSelection() is for TIMELINE selection, a different thing).
14
+ //
15
+ // MUTATION RULE / HONESTY NOTE: item.select() is called and any exception
16
+ // is surfaced as a failure. There is deliberately NO claim of a confirmed
17
+ // state change beyond "the call did not throw" — this is reported
18
+ // explicitly in the result rather than glossed over, per this wave's
19
+ // mutation rules (verify where feasible; where nothing is feasible, say
20
+ // so).
21
+
22
+ function ppbSelectProjectItem_walk(item, args, depth) {
23
+ if (depth > 32) {
24
+ return null;
25
+ }
26
+
27
+ var isBin = false;
28
+ try {
29
+ isBin = typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
30
+ } catch (e) {
31
+ isBin = false;
32
+ }
33
+
34
+ var matched = false;
35
+ if (args.nodeId !== null) {
36
+ try { matched = item.nodeId === args.nodeId; } catch (e) { matched = false; }
37
+ } else if (args.name !== null) {
38
+ try { matched = item.name === args.name; } catch (e) { matched = false; }
39
+ }
40
+ if (matched) {
41
+ return item;
42
+ }
43
+
44
+ if (isBin && item.children) {
45
+ for (var i = 0; i < item.children.numItems; i++) {
46
+ var found = ppbSelectProjectItem_walk(item.children[i], args, depth + 1);
47
+ if (found) {
48
+ return found;
49
+ }
50
+ }
51
+ }
52
+ return null;
53
+ }
54
+
55
+ function ppbSelectProjectItem_resolve(args) {
56
+ var root = app.project.rootItem;
57
+ for (var i = 0; i < root.children.numItems; i++) {
58
+ var found = ppbSelectProjectItem_walk(root.children[i], args, 1);
59
+ if (found) {
60
+ return found;
61
+ }
62
+ }
63
+ return null;
64
+ }
65
+
66
+ function ppb_selectProjectItem(argsJson) {
67
+ try {
68
+ var args;
69
+ try {
70
+ args = JSON.parse(argsJson);
71
+ } catch (e) {
72
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
73
+ }
74
+
75
+ var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
76
+ var hasName = typeof args.name === "string" && args.name.length > 0;
77
+ if (!hasNodeId && !hasName) {
78
+ return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
79
+ }
80
+
81
+ if (!app.project) {
82
+ return JSON.stringify({ ok: false, error: "no project open" });
83
+ }
84
+
85
+ var item = ppbSelectProjectItem_resolve({
86
+ nodeId: hasNodeId ? args.nodeId : null,
87
+ name: hasNodeId ? null : args.name
88
+ });
89
+ if (!item) {
90
+ return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
91
+ }
92
+
93
+ if (typeof item.select !== "function") {
94
+ return JSON.stringify({ ok: false, error: "item.select() is not available on this Premiere build for this item" });
95
+ }
96
+
97
+ try {
98
+ item.select();
99
+ } catch (e) {
100
+ return JSON.stringify({ ok: false, error: "item.select() failed: " + e.toString() });
101
+ }
102
+
103
+ return JSON.stringify({
104
+ ok: true,
105
+ result: {
106
+ item: (function () { try { return item.name; } catch (e) { return null; } })(),
107
+ nodeId: (function () { try { return item.nodeId; } catch (e) { return null; } })(),
108
+ called: true,
109
+ note: "no confirmed Project-panel-selection read-back API exists (seq.getSelection() is timeline-only) — this only reports that item.select() did not throw, not an independently verified selection state"
110
+ }
111
+ });
112
+ } catch (e) {
113
+ return JSON.stringify({ ok: false, error: e.toString() });
114
+ }
115
+ }