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,99 @@
1
+ // Command: get-unused-media → ppb_getUnusedMedia
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
+ // ensureQEEnabled, findSequenceByName, ...) are already defined there.
5
+ //
6
+ // Two-pass: first collects every project-item nodeId referenced by any
7
+ // clip in any sequence, then walks the whole bin tree (same shape as
8
+ // list-project-items.jsx) reporting non-bin items whose nodeId was never
9
+ // seen. Helper names are prefixed ppbUnusedMedia_ to avoid colliding with
10
+ // same-purpose helpers in other lazily-loaded command files evaluated into
11
+ // this same global context.
12
+
13
+ function ppbUnusedMedia_isBin(item) {
14
+ try {
15
+ return typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
16
+ } catch (e) {
17
+ return false;
18
+ }
19
+ }
20
+
21
+ function ppbUnusedMedia_collectUsedIds(tracks, usedIds) {
22
+ for (var t = 0; t < tracks.numTracks; t++) {
23
+ var track = tracks[t];
24
+ var numClips = 0;
25
+ try {
26
+ numClips = track.clips.numItems;
27
+ } catch (e) {
28
+ numClips = 0;
29
+ }
30
+ for (var c = 0; c < numClips; c++) {
31
+ try {
32
+ var src = track.clips[c].projectItem;
33
+ if (src) {
34
+ usedIds[src.nodeId] = true;
35
+ }
36
+ } catch (e) {
37
+ // skip unreadable clip
38
+ }
39
+ }
40
+ }
41
+ }
42
+
43
+ // Capped at depth 32 to defend against pathological/circular bin
44
+ // structures rather than looping forever.
45
+ function ppbUnusedMedia_findUnused(item, depth, usedIds, results) {
46
+ if (depth > 32) {
47
+ return;
48
+ }
49
+
50
+ var isBin = ppbUnusedMedia_isBin(item);
51
+
52
+ if (!isBin) {
53
+ var nodeId = null;
54
+ try {
55
+ nodeId = item.nodeId;
56
+ } catch (e) {
57
+ nodeId = null;
58
+ }
59
+
60
+ if (nodeId && !usedIds[nodeId]) {
61
+ var entry = { nodeId: nodeId, name: null, treePath: null, mediaPath: null };
62
+ try { entry.name = item.name; } catch (e) { entry.name = null; }
63
+ try { entry.treePath = item.treePath; } catch (e) { entry.treePath = null; }
64
+ try { entry.mediaPath = item.getMediaPath(); } catch (e) { entry.mediaPath = null; }
65
+ results.push(entry);
66
+ }
67
+ }
68
+
69
+ if (isBin && item.children) {
70
+ for (var i = 0; i < item.children.numItems; i++) {
71
+ ppbUnusedMedia_findUnused(item.children[i], depth + 1, usedIds, results);
72
+ }
73
+ }
74
+ }
75
+
76
+ function ppb_getUnusedMedia(argsJson) {
77
+ try {
78
+ if (!app.project) {
79
+ return JSON.stringify({ ok: false, error: "no project open" });
80
+ }
81
+
82
+ var usedIds = {};
83
+ for (var s = 0; s < app.project.sequences.numSequences; s++) {
84
+ var seq = app.project.sequences[s];
85
+ ppbUnusedMedia_collectUsedIds(seq.videoTracks, usedIds);
86
+ ppbUnusedMedia_collectUsedIds(seq.audioTracks, usedIds);
87
+ }
88
+
89
+ var results = [];
90
+ var root = app.project.rootItem;
91
+ for (var i = 0; i < root.children.numItems; i++) {
92
+ ppbUnusedMedia_findUnused(root.children[i], 1, usedIds, results);
93
+ }
94
+
95
+ return JSON.stringify({ ok: true, result: { unusedCount: results.length, items: results } });
96
+ } catch (e) {
97
+ return JSON.stringify({ ok: false, error: e.toString() });
98
+ }
99
+ }
@@ -0,0 +1,125 @@
1
+ // Command: get-used-media-report → ppb_getUsedMediaReport
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, ...) are already defined there.
5
+ //
6
+ // Standard-DOM read only, no QE DOM needed. Scans every clip on every
7
+ // video/audio track of the resolved sequence, grouping by source
8
+ // projectItem.nodeId. Helper names are prefixed ppbUsedMediaReport_ to
9
+ // avoid colliding with same-purpose helpers in other lazily-loaded command
10
+ // files evaluated into this same global context.
11
+
12
+ function ppbUsedMediaReport_scanTracks(tracks, trackTypeLabel, mediaMap, order) {
13
+ for (var t = 0; t < tracks.numTracks; t++) {
14
+ var track = tracks[t];
15
+ var numClips = 0;
16
+ try {
17
+ numClips = track.clips.numItems;
18
+ } catch (e) {
19
+ numClips = 0;
20
+ }
21
+
22
+ for (var c = 0; c < numClips; c++) {
23
+ var clip = track.clips[c];
24
+ var src = null;
25
+ try {
26
+ src = clip.projectItem;
27
+ } catch (e) {
28
+ src = null;
29
+ }
30
+ if (!src) {
31
+ continue;
32
+ }
33
+
34
+ var key = null;
35
+ try {
36
+ key = src.nodeId;
37
+ } catch (e) {
38
+ key = null;
39
+ }
40
+ if (!key) {
41
+ continue;
42
+ }
43
+
44
+ if (!mediaMap[key]) {
45
+ var entry = { nodeId: key, name: null, mediaPath: null, offline: null, useCount: 0, tracksSet: {} };
46
+ try { entry.name = src.name; } catch (e) { entry.name = null; }
47
+ try { entry.mediaPath = src.getMediaPath(); } catch (e) { entry.mediaPath = null; }
48
+ try { entry.offline = src.isOffline(); } catch (e) { entry.offline = null; }
49
+ mediaMap[key] = entry;
50
+ order.push(key);
51
+ }
52
+
53
+ mediaMap[key].useCount++;
54
+ mediaMap[key].tracksSet[trackTypeLabel + t] = true;
55
+ }
56
+ }
57
+ }
58
+
59
+ function ppb_getUsedMediaReport(argsJson) {
60
+ try {
61
+ var args;
62
+ try {
63
+ args = JSON.parse(argsJson);
64
+ } catch (e) {
65
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
66
+ }
67
+
68
+ if (!app.project) {
69
+ return JSON.stringify({ ok: false, error: "no project open" });
70
+ }
71
+
72
+ var seq = null;
73
+ if (args.sequenceName && typeof args.sequenceName === "string") {
74
+ seq = findSequenceByName(args.sequenceName);
75
+ if (!seq) {
76
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
77
+ }
78
+ } else {
79
+ seq = app.project.activeSequence;
80
+ if (!seq) {
81
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
82
+ }
83
+ }
84
+
85
+ var mediaMap = {};
86
+ var order = [];
87
+ ppbUsedMediaReport_scanTracks(seq.videoTracks, "V", mediaMap, order);
88
+ ppbUsedMediaReport_scanTracks(seq.audioTracks, "A", mediaMap, order);
89
+
90
+ var media = [];
91
+ var offlineUsedCount = 0;
92
+ for (var i = 0; i < order.length; i++) {
93
+ var entry = mediaMap[order[i]];
94
+ var trackList = [];
95
+ for (var k in entry.tracksSet) {
96
+ if (entry.tracksSet.hasOwnProperty(k)) {
97
+ trackList.push(k);
98
+ }
99
+ }
100
+ if (entry.offline === true) {
101
+ offlineUsedCount++;
102
+ }
103
+ media.push({
104
+ nodeId: entry.nodeId,
105
+ name: entry.name,
106
+ mediaPath: entry.mediaPath,
107
+ offline: entry.offline,
108
+ useCount: entry.useCount,
109
+ tracks: trackList
110
+ });
111
+ }
112
+
113
+ return JSON.stringify({
114
+ ok: true,
115
+ result: {
116
+ sequenceName: seq.name,
117
+ uniqueMediaCount: media.length,
118
+ offlineUsedCount: offlineUsedCount,
119
+ media: media
120
+ }
121
+ });
122
+ } catch (e) {
123
+ return JSON.stringify({ ok: false, error: e.toString() });
124
+ }
125
+ }
@@ -0,0 +1,135 @@
1
+ // Command: get-value-at-time → ppb_getValueAtTime
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, READ-only. Ported from leancoderkavy's premiere-pro-mcp
8
+ // `get_value_at_time` tool (keyframes.ts), addressed here by
9
+ // trackType/trackIndex/clipIndex + componentName/propertyName. `seconds`
10
+ // is clip-relative, offset by clip.start to sequence time, then passed to
11
+ // prop.getValueAtTime() via tryTimeForms() (ticksString, then Time object,
12
+ // then raw seconds — key-time argument form is disputed across builds per
13
+ // PREMIERE_API_NOTES.md).
14
+ function ppb_getValueAtTime(argsJson) {
15
+ try {
16
+ var args;
17
+ try {
18
+ args = JSON.parse(argsJson);
19
+ } catch (e) {
20
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
21
+ }
22
+
23
+ if (args.trackType !== "video" && args.trackType !== "audio") {
24
+ return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
25
+ }
26
+ if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
27
+ return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
28
+ }
29
+ if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
30
+ return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
31
+ }
32
+ if (typeof args.componentName !== "string" || !args.componentName) {
33
+ return JSON.stringify({ ok: false, error: "componentName is required" });
34
+ }
35
+ if (typeof args.propertyName !== "string" || !args.propertyName) {
36
+ return JSON.stringify({ ok: false, error: "propertyName is required" });
37
+ }
38
+ if (typeof args.seconds !== "number") {
39
+ return JSON.stringify({ ok: false, error: "seconds must be a number (clip-relative)" });
40
+ }
41
+
42
+ if (!app.project) {
43
+ return JSON.stringify({ ok: false, error: "no project open" });
44
+ }
45
+
46
+ var seq = null;
47
+ if (args.sequenceName && typeof args.sequenceName === "string") {
48
+ seq = findSequenceByName(args.sequenceName);
49
+ if (!seq) {
50
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
51
+ }
52
+ } else {
53
+ seq = app.project.activeSequence;
54
+ if (!seq) {
55
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
56
+ }
57
+ }
58
+
59
+ var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
60
+ var numTracks = trackCollection.numTracks;
61
+ if (args.trackIndex >= numTracks) {
62
+ return JSON.stringify({
63
+ ok: false,
64
+ error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
65
+ });
66
+ }
67
+
68
+ var track = trackCollection[args.trackIndex];
69
+ var numClips = track.clips.numItems;
70
+ if (args.clipIndex >= numClips) {
71
+ return JSON.stringify({
72
+ ok: false,
73
+ error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
74
+ });
75
+ }
76
+
77
+ var clip = track.clips[args.clipIndex];
78
+ var clipName = null;
79
+ try { clipName = clip.name; } catch (e) { clipName = null; }
80
+
81
+ var clipStartSeconds = 0;
82
+ try { clipStartSeconds = timeValueToSeconds(clip.start) || 0; } catch (e) { clipStartSeconds = 0; }
83
+
84
+ var comp = findClipComponent(clip, [args.componentName], [args.componentName]);
85
+ if (!comp) {
86
+ return JSON.stringify({
87
+ ok: false,
88
+ error: "component \"" + args.componentName + "\" not found on clip (matched against matchName and displayName)"
89
+ });
90
+ }
91
+ var compDisplayName = null;
92
+ try { compDisplayName = comp.displayName; } catch (e) { compDisplayName = null; }
93
+
94
+ var prop = findComponentProperty(comp, [args.propertyName]);
95
+ if (!prop) {
96
+ return JSON.stringify({
97
+ ok: false,
98
+ error: "property \"" + args.propertyName + "\" not found on component \"" + compDisplayName + "\""
99
+ });
100
+ }
101
+
102
+ var sequenceSeconds = clipStartSeconds + args.seconds;
103
+
104
+ var attempt = tryTimeForms(sequenceSeconds, function (t) {
105
+ return prop.getValueAtTime(t);
106
+ });
107
+
108
+ if (!attempt.success) {
109
+ return JSON.stringify({
110
+ ok: false,
111
+ error: "getValueAtTime() failed with every known time-argument form (ticksString, Time object, seconds)",
112
+ attempts: attempt.attempts
113
+ });
114
+ }
115
+
116
+ return JSON.stringify({
117
+ ok: true,
118
+ result: {
119
+ sequenceName: seq.name,
120
+ trackType: args.trackType,
121
+ trackIndex: args.trackIndex,
122
+ clipIndex: args.clipIndex,
123
+ clipName: clipName,
124
+ componentName: compDisplayName,
125
+ propertyName: args.propertyName,
126
+ seconds: args.seconds,
127
+ sequenceSeconds: sequenceSeconds,
128
+ value: attempt.result,
129
+ attempts: attempt.attempts
130
+ }
131
+ });
132
+ } catch (e) {
133
+ return JSON.stringify({ ok: false, error: e.toString() });
134
+ }
135
+ }
@@ -0,0 +1,33 @@
1
+ // Command: get-version-info → ppb_getVersionInfo
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context.
4
+ //
5
+ // Ported from leancoderkavy/premiere-pro-mcp's track-targeting.ts
6
+ // get_version_info. App-level — no project or sequence involved. Every
7
+ // field is individually best-effort (null if unreadable), matching the
8
+ // reference's per-field try/catch.
9
+ function ppb_getVersionInfo(argsJson) {
10
+ try {
11
+ var version = null;
12
+ var buildNumber = null;
13
+ var isDocumentOpen = null;
14
+ var path = null;
15
+
16
+ try { version = app.version; } catch (e) { version = null; }
17
+ try { buildNumber = app.build; } catch (e) { buildNumber = null; }
18
+ try { isDocumentOpen = app.isDocumentOpen(); } catch (e) { isDocumentOpen = null; }
19
+ try { path = app.path; } catch (e) { path = null; }
20
+
21
+ return JSON.stringify({
22
+ ok: true,
23
+ result: {
24
+ version: version,
25
+ buildNumber: buildNumber,
26
+ isDocumentOpen: isDocumentOpen,
27
+ path: path
28
+ }
29
+ });
30
+ } catch (e) {
31
+ return JSON.stringify({ ok: false, error: e.toString() });
32
+ }
33
+ }
@@ -0,0 +1,52 @@
1
+ // Command: get-work-area → ppb_getWorkArea
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/premiere-pro-mcp's playhead.ts get_work_area.
7
+ // Reads the given (or active) sequence's work area bar bounds
8
+ // (seq.workInPoint/seq.workOutPoint — Time-like objects per
9
+ // PREMIERE_API_NOTES.md's "Work area" row) and reports them in seconds.
10
+ function ppb_getWorkArea(argsJson) {
11
+ try {
12
+ var args;
13
+ try {
14
+ args = JSON.parse(argsJson);
15
+ } catch (e) {
16
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
17
+ }
18
+
19
+ if (!app.project) {
20
+ return JSON.stringify({ ok: false, error: "no project open" });
21
+ }
22
+
23
+ var seq = null;
24
+ if (args.sequenceName && typeof args.sequenceName === "string") {
25
+ seq = findSequenceByName(args.sequenceName);
26
+ if (!seq) {
27
+ return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
28
+ }
29
+ } else {
30
+ seq = app.project.activeSequence;
31
+ if (!seq) {
32
+ return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
33
+ }
34
+ }
35
+
36
+ var inSeconds = null;
37
+ var outSeconds = null;
38
+ try { inSeconds = timeValueToSeconds(seq.workInPoint); } catch (e) { inSeconds = null; }
39
+ try { outSeconds = timeValueToSeconds(seq.workOutPoint); } catch (e) { outSeconds = null; }
40
+
41
+ return JSON.stringify({
42
+ ok: true,
43
+ result: {
44
+ sequenceName: seq.name,
45
+ inSeconds: inSeconds,
46
+ outSeconds: outSeconds
47
+ }
48
+ });
49
+ } catch (e) {
50
+ return JSON.stringify({ ok: false, error: e.toString() });
51
+ }
52
+ }
@@ -0,0 +1,29 @@
1
+ // Command: get-workspaces → ppb_getWorkspaces
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context.
4
+ //
5
+ // Ported from leancoderkavy/premiere-pro-mcp's workspace.ts get_workspaces.
6
+ // App-level — no project or sequence involved.
7
+ function ppb_getWorkspaces(argsJson) {
8
+ try {
9
+ var workspaces = null;
10
+ try {
11
+ workspaces = app.getWorkspaces();
12
+ } catch (e) {
13
+ return JSON.stringify({ ok: false, error: "could not retrieve workspaces: " + e.toString() });
14
+ }
15
+
16
+ if (!workspaces) {
17
+ return JSON.stringify({ ok: false, error: "could not retrieve workspaces" });
18
+ }
19
+
20
+ var list = [];
21
+ for (var i = 0; i < workspaces.length; i++) {
22
+ list.push(workspaces[i]);
23
+ }
24
+
25
+ return JSON.stringify({ ok: true, result: { workspaces: list, count: list.length } });
26
+ } catch (e) {
27
+ return JSON.stringify({ ok: false, error: e.toString() });
28
+ }
29
+ }
@@ -0,0 +1,107 @@
1
+ // Command: get-xmp-metadata → ppb_getXmpMetadata
2
+ // Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
3
+ // same global ExtendScript context.
4
+ //
5
+ // Project-item addressing: at least one of nodeId/name is required (see
6
+ // get-item-metadata.jsx for the shared design note — the resolver is
7
+ // duplicated per-file since command files load independently).
8
+ //
9
+ // XMP metadata can be a large XML blob — truncated to 100KB (102400
10
+ // chars) with a `truncated` flag so callers aren't surprised by a huge
11
+ // response.
12
+
13
+ var PPB_XMP_METADATA_MAX_CHARS = 102400;
14
+
15
+ function ppbFindItemGetXmpMetadata_walk(item, args, depth) {
16
+ if (depth > 32) {
17
+ return null;
18
+ }
19
+
20
+ var isBin = false;
21
+ try {
22
+ isBin = typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
23
+ } catch (e) {
24
+ isBin = false;
25
+ }
26
+
27
+ var matched = false;
28
+ if (args.nodeId !== null) {
29
+ try { matched = item.nodeId === args.nodeId; } catch (e) { matched = false; }
30
+ } else if (args.name !== null) {
31
+ try { matched = item.name === args.name; } catch (e) { matched = false; }
32
+ }
33
+ if (matched) {
34
+ return item;
35
+ }
36
+
37
+ if (isBin && item.children) {
38
+ for (var i = 0; i < item.children.numItems; i++) {
39
+ var found = ppbFindItemGetXmpMetadata_walk(item.children[i], args, depth + 1);
40
+ if (found) {
41
+ return found;
42
+ }
43
+ }
44
+ }
45
+ return null;
46
+ }
47
+
48
+ function ppbFindItemGetXmpMetadata_resolve(args) {
49
+ var root = app.project.rootItem;
50
+ for (var i = 0; i < root.children.numItems; i++) {
51
+ var found = ppbFindItemGetXmpMetadata_walk(root.children[i], args, 1);
52
+ if (found) {
53
+ return found;
54
+ }
55
+ }
56
+ return null;
57
+ }
58
+
59
+ function ppb_getXmpMetadata(argsJson) {
60
+ try {
61
+ var args;
62
+ try {
63
+ args = JSON.parse(argsJson);
64
+ } catch (e) {
65
+ return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
66
+ }
67
+
68
+ var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
69
+ var hasName = typeof args.name === "string" && args.name.length > 0;
70
+ if (!hasNodeId && !hasName) {
71
+ return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
72
+ }
73
+
74
+ if (!app.project) {
75
+ return JSON.stringify({ ok: false, error: "no project open" });
76
+ }
77
+
78
+ var item = ppbFindItemGetXmpMetadata_resolve({
79
+ nodeId: hasNodeId ? args.nodeId : null,
80
+ name: hasNodeId ? null : args.name
81
+ });
82
+ if (!item) {
83
+ return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
84
+ }
85
+
86
+ var xmp = null;
87
+ try {
88
+ xmp = item.getXMPMetadata();
89
+ } catch (e) {
90
+ return JSON.stringify({ ok: false, error: "getXMPMetadata() failed: " + e.toString() });
91
+ }
92
+
93
+ var truncated = false;
94
+ if (typeof xmp === "string" && xmp.length > PPB_XMP_METADATA_MAX_CHARS) {
95
+ xmp = xmp.substring(0, PPB_XMP_METADATA_MAX_CHARS);
96
+ truncated = true;
97
+ }
98
+
99
+ var result = { name: null, nodeId: null, xmpMetadata: xmp, truncated: truncated };
100
+ try { result.name = item.name; } catch (e) { result.name = null; }
101
+ try { result.nodeId = item.nodeId; } catch (e) { result.nodeId = null; }
102
+
103
+ return JSON.stringify({ ok: true, result: result });
104
+ } catch (e) {
105
+ return JSON.stringify({ ok: false, error: e.toString() });
106
+ }
107
+ }