@synthetic-ai/premiere-mcp 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -0
- package/LICENSE +21 -0
- package/README.md +242 -0
- package/cep-plugin/.debug +8 -0
- package/cep-plugin/CSInterface.js +70 -0
- package/cep-plugin/CSXS/manifest.xml +49 -0
- package/cep-plugin/host.jsx +7 -0
- package/cep-plugin/index.html +419 -0
- package/cep-plugin/main.js +327 -0
- package/cep-plugin/premiere.jsx +24947 -0
- package/cep-plugin/synthetic-logo.png +0 -0
- package/dist/bridge/file-bridge.d.ts +29 -0
- package/dist/bridge/file-bridge.js +145 -0
- package/dist/bridge/script-builder.d.ts +19 -0
- package/dist/bridge/script-builder.js +408 -0
- package/dist/http-server.d.ts +21 -0
- package/dist/http-server.js +140 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +70 -0
- package/dist/resources/extendscript-reference.d.ts +2 -0
- package/dist/resources/extendscript-reference.js +219 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.js +276 -0
- package/dist/tools/advanced.d.ts +530 -0
- package/dist/tools/advanced.js +923 -0
- package/dist/tools/audio-advanced.d.ts +847 -0
- package/dist/tools/audio-advanced.js +1653 -0
- package/dist/tools/audio.d.ts +84 -0
- package/dist/tools/audio.js +123 -0
- package/dist/tools/captions.d.ts +30 -0
- package/dist/tools/captions.js +73 -0
- package/dist/tools/clipboard.d.ts +153 -0
- package/dist/tools/clipboard.js +381 -0
- package/dist/tools/color-advanced.d.ts +821 -0
- package/dist/tools/color-advanced.js +772 -0
- package/dist/tools/discovery.d.ts +128 -0
- package/dist/tools/discovery.js +445 -0
- package/dist/tools/effects.d.ts +211 -0
- package/dist/tools/effects.js +554 -0
- package/dist/tools/export-presets.d.ts +333 -0
- package/dist/tools/export-presets.js +490 -0
- package/dist/tools/export.d.ts +320 -0
- package/dist/tools/export.js +618 -0
- package/dist/tools/health.d.ts +9 -0
- package/dist/tools/health.js +25 -0
- package/dist/tools/inspection.d.ts +179 -0
- package/dist/tools/inspection.js +1089 -0
- package/dist/tools/keyframes.d.ts +253 -0
- package/dist/tools/keyframes.js +611 -0
- package/dist/tools/markers.d.ts +117 -0
- package/dist/tools/markers.js +206 -0
- package/dist/tools/media.d.ts +297 -0
- package/dist/tools/media.js +493 -0
- package/dist/tools/metadata.d.ts +178 -0
- package/dist/tools/metadata.js +278 -0
- package/dist/tools/multicam.d.ts +199 -0
- package/dist/tools/multicam.js +212 -0
- package/dist/tools/playback.d.ts +34 -0
- package/dist/tools/playback.js +63 -0
- package/dist/tools/playhead.d.ts +77 -0
- package/dist/tools/playhead.js +185 -0
- package/dist/tools/project-manager.d.ts +65 -0
- package/dist/tools/project-manager.js +81 -0
- package/dist/tools/project.d.ts +390 -0
- package/dist/tools/project.js +596 -0
- package/dist/tools/scripting.d.ts +98 -0
- package/dist/tools/scripting.js +434 -0
- package/dist/tools/selection.d.ts +120 -0
- package/dist/tools/selection.js +334 -0
- package/dist/tools/sequence-advanced.d.ts +84 -0
- package/dist/tools/sequence-advanced.js +471 -0
- package/dist/tools/sequence-settings.d.ts +397 -0
- package/dist/tools/sequence-settings.js +967 -0
- package/dist/tools/sequence.d.ts +211 -0
- package/dist/tools/sequence.js +378 -0
- package/dist/tools/source-monitor.d.ts +95 -0
- package/dist/tools/source-monitor.js +180 -0
- package/dist/tools/text.d.ts +97 -0
- package/dist/tools/text.js +159 -0
- package/dist/tools/timeline.d.ts +265 -0
- package/dist/tools/timeline.js +575 -0
- package/dist/tools/track-management.d.ts +482 -0
- package/dist/tools/track-management.js +787 -0
- package/dist/tools/track-targeting.d.ts +666 -0
- package/dist/tools/track-targeting.js +1318 -0
- package/dist/tools/tracks.d.ts +90 -0
- package/dist/tools/tracks.js +183 -0
- package/dist/tools/transitions-motion.d.ts +788 -0
- package/dist/tools/transitions-motion.js +680 -0
- package/dist/tools/transitions.d.ts +124 -0
- package/dist/tools/transitions.js +267 -0
- package/dist/tools/utility.d.ts +469 -0
- package/dist/tools/utility.js +1118 -0
- package/dist/tools/workspace.d.ts +25 -0
- package/dist/tools/workspace.js +61 -0
- package/package.json +66 -0
- package/scripts/build-chat-dmg.sh +210 -0
- package/scripts/build-chat-zip.sh +291 -0
- package/scripts/install-cep-windows.ps1 +99 -0
- package/scripts/install-cep.sh +66 -0
- package/scripts/install-chat-plugin.bat +67 -0
- package/scripts/install-chat-plugin.sh +85 -0
- package/scripts/install-windows.bat +95 -0
- package/scripts/package.mjs +218 -0
|
@@ -0,0 +1,967 @@
|
|
|
1
|
+
import { buildToolScript } from "../bridge/script-builder.js";
|
|
2
|
+
import { sendCommand } from "../bridge/file-bridge.js";
|
|
3
|
+
export function getSequenceSettingsTools(bridgeOptions) {
|
|
4
|
+
return {
|
|
5
|
+
get_sequence_settings: {
|
|
6
|
+
description: "Get detailed settings for a specific sequence including frame size, frame rate, sample rate, codec, and color space.",
|
|
7
|
+
parameters: {
|
|
8
|
+
type: "object",
|
|
9
|
+
properties: {
|
|
10
|
+
sequence_index: { type: "number", description: "Sequence index (0-based). Default: active sequence (0)." },
|
|
11
|
+
},
|
|
12
|
+
required: [],
|
|
13
|
+
},
|
|
14
|
+
handler: async (args) => {
|
|
15
|
+
const seqIndex = args.sequence_index ?? 0;
|
|
16
|
+
const script = buildToolScript(`
|
|
17
|
+
var seq = app.project.sequences[${seqIndex}];
|
|
18
|
+
if (!seq) return __error("Sequence index ${seqIndex} not found");
|
|
19
|
+
var settings = seq.getSettings();
|
|
20
|
+
var fps = 0;
|
|
21
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
22
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
23
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
24
|
+
}
|
|
25
|
+
return __result({
|
|
26
|
+
name: seq.name,
|
|
27
|
+
sequenceID: seq.sequenceID,
|
|
28
|
+
width: settings ? settings.videoFrameWidth : 0,
|
|
29
|
+
height: settings ? settings.videoFrameHeight : 0,
|
|
30
|
+
frameRate: fps,
|
|
31
|
+
frameRateTicks: settings && settings.videoFrameRate ? settings.videoFrameRate.ticks : "0",
|
|
32
|
+
sampleRate: settings ? settings.audioSampleRate : 0,
|
|
33
|
+
displayFormat: settings ? settings.videoDisplayFormat : 0,
|
|
34
|
+
audioDisplayFormat: settings ? settings.audioDisplayFormat : 0,
|
|
35
|
+
previewFileFormat: settings ? settings.videoPreviewFileFormat : "",
|
|
36
|
+
previewCodec: settings ? settings.videoPreviewCodec : "",
|
|
37
|
+
maximumBitDepth: settings ? settings.videoMaximumBitDepth : false,
|
|
38
|
+
maximumRenderQuality: settings ? settings.videoMaximumRenderQuality : false,
|
|
39
|
+
compositeLinearColor: settings ? settings.videoCompositeLinearColor : false
|
|
40
|
+
});
|
|
41
|
+
`);
|
|
42
|
+
return sendCommand(script, bridgeOptions);
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
set_sequence_settings: {
|
|
46
|
+
description: "Update sequence settings such as frame size, frame rate, sample rate, and codec. Use get_sequence_settings first to see current values.",
|
|
47
|
+
parameters: {
|
|
48
|
+
type: "object",
|
|
49
|
+
properties: {
|
|
50
|
+
sequence_index: { type: "number", description: "Sequence index (0-based). Default: 0." },
|
|
51
|
+
width: { type: "number", description: "Frame width in pixels (e.g. 1920, 1280, 3840)" },
|
|
52
|
+
height: { type: "number", description: "Frame height in pixels (e.g. 1080, 720, 2160)" },
|
|
53
|
+
frame_rate: { type: "number", description: "Frame rate (e.g. 23.976, 24, 25, 29.97, 30, 59.94, 60)" },
|
|
54
|
+
sample_rate: { type: "number", description: "Audio sample rate in Hz (e.g. 44100, 48000)" },
|
|
55
|
+
display_format: { type: "number", description: "Timecode display format (102=SMPTE 29.97 drop, 103=SMPTE 29.97 non-drop)" },
|
|
56
|
+
},
|
|
57
|
+
required: [],
|
|
58
|
+
},
|
|
59
|
+
handler: async (args) => {
|
|
60
|
+
const seqIndex = args.sequence_index ?? 0;
|
|
61
|
+
const width = args.width !== undefined ? args.width : -1;
|
|
62
|
+
const height = args.height !== undefined ? args.height : -1;
|
|
63
|
+
const frameRate = args.frame_rate !== undefined ? args.frame_rate : -1;
|
|
64
|
+
const sampleRate = args.sample_rate !== undefined ? args.sample_rate : -1;
|
|
65
|
+
const displayFormat = args.display_format !== undefined ? args.display_format : -1;
|
|
66
|
+
const script = buildToolScript(`
|
|
67
|
+
var seq = app.project.sequences[${seqIndex}];
|
|
68
|
+
if (!seq) return __error("Sequence index ${seqIndex} not found");
|
|
69
|
+
var settings = seq.getSettings();
|
|
70
|
+
if (!settings) return __error("Could not get sequence settings");
|
|
71
|
+
var changed = [];
|
|
72
|
+
if (${width} !== -1) { settings.videoFrameWidth = ${width}; changed.push("width"); }
|
|
73
|
+
if (${height} !== -1) { settings.videoFrameHeight = ${height}; changed.push("height"); }
|
|
74
|
+
if (${frameRate} !== -1) {
|
|
75
|
+
var ticks = Math.round(TICKS_PER_SECOND / ${frameRate});
|
|
76
|
+
settings.videoFrameRate.ticks = String(ticks);
|
|
77
|
+
changed.push("frameRate");
|
|
78
|
+
}
|
|
79
|
+
if (${sampleRate} !== -1) { settings.audioSampleRate = ${sampleRate}; changed.push("sampleRate"); }
|
|
80
|
+
if (${displayFormat} !== -1) { settings.videoDisplayFormat = ${displayFormat}; changed.push("displayFormat"); }
|
|
81
|
+
seq.setSettings(settings);
|
|
82
|
+
return __result({ success: true, changed: changed });
|
|
83
|
+
`);
|
|
84
|
+
return sendCommand(script, bridgeOptions);
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
get_sequence_color_space: {
|
|
88
|
+
description: "Get the color space setting for the active sequence.",
|
|
89
|
+
parameters: {
|
|
90
|
+
type: "object",
|
|
91
|
+
properties: {},
|
|
92
|
+
required: [],
|
|
93
|
+
},
|
|
94
|
+
handler: async (_args) => {
|
|
95
|
+
const script = buildToolScript(`
|
|
96
|
+
var seq = app.project.activeSequence;
|
|
97
|
+
if (!seq) return __error("No active sequence");
|
|
98
|
+
var settings = seq.getSettings();
|
|
99
|
+
var info = { sequenceName: seq.name };
|
|
100
|
+
var found = false;
|
|
101
|
+
// The correct property for color space is videoColorSpace (NOT videoDisplayFormat,
|
|
102
|
+
// which is the TIMECODE display format). Read from settings first, then the sequence.
|
|
103
|
+
try {
|
|
104
|
+
if (settings && settings.videoColorSpace !== undefined && settings.videoColorSpace !== null) {
|
|
105
|
+
info.videoColorSpace = settings.videoColorSpace;
|
|
106
|
+
found = true;
|
|
107
|
+
}
|
|
108
|
+
} catch(eSettings) {}
|
|
109
|
+
if (!found) {
|
|
110
|
+
try {
|
|
111
|
+
if (seq.videoColorSpace !== undefined && seq.videoColorSpace !== null) {
|
|
112
|
+
info.videoColorSpace = seq.videoColorSpace;
|
|
113
|
+
found = true;
|
|
114
|
+
}
|
|
115
|
+
} catch(eSeq) {}
|
|
116
|
+
}
|
|
117
|
+
if (!found) {
|
|
118
|
+
info.videoColorSpace = "unknown";
|
|
119
|
+
info.note = "videoColorSpace property is not available in this Premiere Pro version. Set color space via Sequence > Sequence Settings > Working Color Space in the UI.";
|
|
120
|
+
}
|
|
121
|
+
if (seq.getWorkArea) {
|
|
122
|
+
try { info.workAreaType = seq.getWorkArea().type; } catch(e) {}
|
|
123
|
+
}
|
|
124
|
+
return __result(info);
|
|
125
|
+
`);
|
|
126
|
+
return sendCommand(script, bridgeOptions);
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
set_sequence_color_space: {
|
|
130
|
+
description: "Set the color space for the active sequence.",
|
|
131
|
+
parameters: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {
|
|
134
|
+
color_space: { type: "string", description: "Color space name (e.g. 'Rec. 709', 'Rec. 2020', 'P3 D65', 'sRGB')" },
|
|
135
|
+
},
|
|
136
|
+
required: ["color_space"],
|
|
137
|
+
},
|
|
138
|
+
handler: async (args) => {
|
|
139
|
+
const colorSpaceEsc = args.color_space.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
140
|
+
const script = buildToolScript(`
|
|
141
|
+
var seq = app.project.activeSequence;
|
|
142
|
+
if (!seq) return __error("No active sequence");
|
|
143
|
+
var settings = seq.getSettings();
|
|
144
|
+
if (!settings) return __error("Could not get sequence settings");
|
|
145
|
+
var requested = "${colorSpaceEsc}";
|
|
146
|
+
// NOTE: Do NOT write settings.videoDisplayFormat here. That property is the
|
|
147
|
+
// TIMECODE display format, not the color space, and setting it corrupts timecode.
|
|
148
|
+
// The color space, when settable, lives on settings.videoColorSpace.
|
|
149
|
+
try {
|
|
150
|
+
if (settings.videoColorSpace !== undefined && settings.videoColorSpace !== null) {
|
|
151
|
+
settings.videoColorSpace = requested;
|
|
152
|
+
seq.setSettings(settings);
|
|
153
|
+
return __result({ applied: requested, videoColorSpace: settings.videoColorSpace });
|
|
154
|
+
}
|
|
155
|
+
} catch(e) {}
|
|
156
|
+
return __result({ note: "Color space is not directly settable via ExtendScript in this Premiere Pro version (videoColorSpace is unavailable). Set it via Sequence > Sequence Settings > Working Color Space in the UI.", requested: requested });
|
|
157
|
+
`);
|
|
158
|
+
return sendCommand(script, bridgeOptions);
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
get_sequence_duration: {
|
|
162
|
+
description: "Get the total duration of the active sequence in seconds and as timecode.",
|
|
163
|
+
parameters: {
|
|
164
|
+
type: "object",
|
|
165
|
+
properties: {},
|
|
166
|
+
required: [],
|
|
167
|
+
},
|
|
168
|
+
handler: async (_args) => {
|
|
169
|
+
const script = buildToolScript(`
|
|
170
|
+
var seq = app.project.activeSequence;
|
|
171
|
+
if (!seq) return __error("No active sequence");
|
|
172
|
+
var settings = seq.getSettings();
|
|
173
|
+
var fps = 25;
|
|
174
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
175
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
176
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
177
|
+
}
|
|
178
|
+
// seq.end is already a ticks STRING in PP (not a Time object — no .ticks)
|
|
179
|
+
var endTicks = (seq.end != null) ? String(seq.end) : "0";
|
|
180
|
+
var durationSecs = __ticksToSeconds(endTicks);
|
|
181
|
+
var timecode = __ticksToTimecode(endTicks, fps);
|
|
182
|
+
return __result({
|
|
183
|
+
durationSeconds: durationSecs,
|
|
184
|
+
timecode: timecode,
|
|
185
|
+
frameRate: fps,
|
|
186
|
+
endTicks: endTicks
|
|
187
|
+
});
|
|
188
|
+
`);
|
|
189
|
+
return sendCommand(script, bridgeOptions);
|
|
190
|
+
},
|
|
191
|
+
},
|
|
192
|
+
get_frame_count: {
|
|
193
|
+
description: "Get the total number of frames in the active sequence.",
|
|
194
|
+
parameters: {
|
|
195
|
+
type: "object",
|
|
196
|
+
properties: {},
|
|
197
|
+
required: [],
|
|
198
|
+
},
|
|
199
|
+
handler: async (_args) => {
|
|
200
|
+
const script = buildToolScript(`
|
|
201
|
+
var seq = app.project.activeSequence;
|
|
202
|
+
if (!seq) return __error("No active sequence");
|
|
203
|
+
var settings = seq.getSettings();
|
|
204
|
+
var fps = 25;
|
|
205
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
206
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
207
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
208
|
+
}
|
|
209
|
+
var endTicks = (seq.end != null) ? parseFloat(String(seq.end)) : 0;
|
|
210
|
+
var frameRateTicks = fps > 0 ? TICKS_PER_SECOND / fps : TICKS_PER_SECOND / 25;
|
|
211
|
+
var totalFrames = frameRateTicks > 0 ? Math.round(endTicks / frameRateTicks) : 0;
|
|
212
|
+
return __result({
|
|
213
|
+
totalFrames: totalFrames,
|
|
214
|
+
frameRate: fps,
|
|
215
|
+
durationSeconds: endTicks / TICKS_PER_SECOND
|
|
216
|
+
});
|
|
217
|
+
`);
|
|
218
|
+
return sendCommand(script, bridgeOptions);
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
get_current_timecode: {
|
|
222
|
+
description: "Get the current playhead position as a formatted timecode string.",
|
|
223
|
+
parameters: {
|
|
224
|
+
type: "object",
|
|
225
|
+
properties: {},
|
|
226
|
+
required: [],
|
|
227
|
+
},
|
|
228
|
+
handler: async (_args) => {
|
|
229
|
+
const script = buildToolScript(`
|
|
230
|
+
var seq = app.project.activeSequence;
|
|
231
|
+
if (!seq) return __error("No active sequence");
|
|
232
|
+
var settings = seq.getSettings();
|
|
233
|
+
var fps = 25;
|
|
234
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
235
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
236
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
237
|
+
}
|
|
238
|
+
var pos = seq.getPlayerPosition();
|
|
239
|
+
var posTicks = pos ? pos.ticks : "0";
|
|
240
|
+
var posSeconds = __ticksToSeconds(posTicks);
|
|
241
|
+
var timecode = __ticksToTimecode(posTicks, fps);
|
|
242
|
+
return __result({
|
|
243
|
+
timecode: timecode,
|
|
244
|
+
seconds: posSeconds,
|
|
245
|
+
ticks: posTicks,
|
|
246
|
+
frameRate: fps
|
|
247
|
+
});
|
|
248
|
+
`);
|
|
249
|
+
return sendCommand(script, bridgeOptions);
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
set_time_display_format: {
|
|
253
|
+
description: "Set the time display format for the active sequence (timecode, frames, samples, etc.).",
|
|
254
|
+
parameters: {
|
|
255
|
+
type: "object",
|
|
256
|
+
properties: {
|
|
257
|
+
format: { type: "number", description: "Time format code (102=29.97 drop-frame, 103=29.97 NDF, 105=23.976, 201=frames, 202=feet+frames)" },
|
|
258
|
+
},
|
|
259
|
+
required: ["format"],
|
|
260
|
+
},
|
|
261
|
+
handler: async (args) => {
|
|
262
|
+
const script = buildToolScript(`
|
|
263
|
+
var seq = app.project.activeSequence;
|
|
264
|
+
if (!seq) return __error("No active sequence");
|
|
265
|
+
var settings = seq.getSettings();
|
|
266
|
+
if (!settings) return __error("Could not get sequence settings");
|
|
267
|
+
settings.videoDisplayFormat = ${args.format};
|
|
268
|
+
seq.setSettings(settings);
|
|
269
|
+
return __result({ displayFormat: ${args.format} });
|
|
270
|
+
`);
|
|
271
|
+
return sendCommand(script, bridgeOptions);
|
|
272
|
+
},
|
|
273
|
+
},
|
|
274
|
+
get_timeline_settings: {
|
|
275
|
+
description: "Get timeline display settings including snapping, zoom level, and other options.",
|
|
276
|
+
parameters: {
|
|
277
|
+
type: "object",
|
|
278
|
+
properties: {},
|
|
279
|
+
required: [],
|
|
280
|
+
},
|
|
281
|
+
handler: async (_args) => {
|
|
282
|
+
const script = buildToolScript(`
|
|
283
|
+
var seq = app.project.activeSequence;
|
|
284
|
+
if (!seq) return __error("No active sequence");
|
|
285
|
+
var settings = seq.getSettings();
|
|
286
|
+
var fps = 25;
|
|
287
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
288
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
289
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
290
|
+
}
|
|
291
|
+
return __result({
|
|
292
|
+
sequenceName: seq.name,
|
|
293
|
+
frameRate: fps,
|
|
294
|
+
videoDisplayFormat: settings ? settings.videoDisplayFormat : 0,
|
|
295
|
+
audioDisplayFormat: settings ? settings.audioDisplayFormat : 0,
|
|
296
|
+
width: settings ? settings.videoFrameWidth : 0,
|
|
297
|
+
height: settings ? settings.videoFrameHeight : 0,
|
|
298
|
+
numVideoTracks: seq.videoTracks ? seq.videoTracks.numTracks : 0,
|
|
299
|
+
numAudioTracks: seq.audioTracks ? seq.audioTracks.numTracks : 0,
|
|
300
|
+
note: "Snapping and zoom settings are UI-only and not accessible via ExtendScript."
|
|
301
|
+
});
|
|
302
|
+
`);
|
|
303
|
+
return sendCommand(script, bridgeOptions);
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
set_video_transition_default_duration: {
|
|
307
|
+
description: "Set the default duration for video transitions in frames.",
|
|
308
|
+
parameters: {
|
|
309
|
+
type: "object",
|
|
310
|
+
properties: {
|
|
311
|
+
frames: { type: "number", description: "Default transition duration in frames (e.g. 25 for ~1 second at 25fps)" },
|
|
312
|
+
},
|
|
313
|
+
required: ["frames"],
|
|
314
|
+
},
|
|
315
|
+
handler: async (args) => {
|
|
316
|
+
const script = buildToolScript(`
|
|
317
|
+
try {
|
|
318
|
+
app.enableQE();
|
|
319
|
+
if (qe && qe.project && qe.project.setVideoTransitionDefaultDuration) {
|
|
320
|
+
qe.project.setVideoTransitionDefaultDuration(${args.frames});
|
|
321
|
+
return __result({ frames: ${args.frames}, method: "qe" });
|
|
322
|
+
}
|
|
323
|
+
} catch(e) {}
|
|
324
|
+
return __result({ note: "Default transition duration set to ${args.frames} frames. Apply via Edit > Preferences > Timeline in Premiere Pro UI if QE DOM unavailable.", frames: ${args.frames} });
|
|
325
|
+
`);
|
|
326
|
+
return sendCommand(script, bridgeOptions);
|
|
327
|
+
},
|
|
328
|
+
},
|
|
329
|
+
get_renderer_info: {
|
|
330
|
+
description: "Get information about the current video renderer (Software, Mercury GPU Acceleration, etc.).",
|
|
331
|
+
parameters: {
|
|
332
|
+
type: "object",
|
|
333
|
+
properties: {},
|
|
334
|
+
required: [],
|
|
335
|
+
},
|
|
336
|
+
handler: async (_args) => {
|
|
337
|
+
const script = buildToolScript(`
|
|
338
|
+
var info = { version: app.version };
|
|
339
|
+
try {
|
|
340
|
+
app.enableQE();
|
|
341
|
+
if (qe && qe.project) {
|
|
342
|
+
if (qe.project.getActiveRenderer) {
|
|
343
|
+
info.renderer = qe.project.getActiveRenderer();
|
|
344
|
+
}
|
|
345
|
+
if (qe.project.getAvailableRenderers) {
|
|
346
|
+
info.availableRenderers = qe.project.getAvailableRenderers();
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
} catch(e) {
|
|
350
|
+
info.rendererNote = "QE DOM unavailable: " + e.toString();
|
|
351
|
+
}
|
|
352
|
+
if (!info.renderer) {
|
|
353
|
+
info.renderer = "unknown";
|
|
354
|
+
info.note = "Renderer info requires QE DOM access. Check Edit > Project Settings > General > Renderer in Premiere Pro UI.";
|
|
355
|
+
}
|
|
356
|
+
return __result(info);
|
|
357
|
+
`);
|
|
358
|
+
return sendCommand(script, bridgeOptions);
|
|
359
|
+
},
|
|
360
|
+
},
|
|
361
|
+
get_gpu_info: {
|
|
362
|
+
description: "Get information about the GPU available for Mercury GPU Acceleration.",
|
|
363
|
+
parameters: {
|
|
364
|
+
type: "object",
|
|
365
|
+
properties: {},
|
|
366
|
+
required: [],
|
|
367
|
+
},
|
|
368
|
+
handler: async (_args) => {
|
|
369
|
+
const script = buildToolScript(`
|
|
370
|
+
var info = { version: app.version, os: $.os };
|
|
371
|
+
try {
|
|
372
|
+
app.enableQE();
|
|
373
|
+
if (qe && qe.project) {
|
|
374
|
+
info.gpuAcceleration = "enabled (QE DOM accessible)";
|
|
375
|
+
if (qe.project.getActiveRenderer) {
|
|
376
|
+
var renderer = qe.project.getActiveRenderer();
|
|
377
|
+
info.activeRenderer = renderer;
|
|
378
|
+
info.gpuAcceleration = (renderer && renderer.indexOf("GPU") !== -1) ? "GPU" : "Software";
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
} catch(e) {
|
|
382
|
+
info.gpuAcceleration = "unknown";
|
|
383
|
+
info.note = "GPU info limited in ExtendScript. " + e.toString();
|
|
384
|
+
}
|
|
385
|
+
return __result(info);
|
|
386
|
+
`);
|
|
387
|
+
return sendCommand(script, bridgeOptions);
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
set_renderer: {
|
|
391
|
+
description: "Set the video renderer for Premiere Pro (Software, Mercury CUDA, Mercury Metal, etc.).",
|
|
392
|
+
parameters: {
|
|
393
|
+
type: "object",
|
|
394
|
+
properties: {
|
|
395
|
+
renderer_name: { type: "string", description: "Renderer name (e.g. 'Mercury Playback Engine Software Only', 'Mercury Playback Engine GPU Acceleration (CUDA)')" },
|
|
396
|
+
},
|
|
397
|
+
required: ["renderer_name"],
|
|
398
|
+
},
|
|
399
|
+
handler: async (args) => {
|
|
400
|
+
const rendererNameEsc = args.renderer_name.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
401
|
+
const script = buildToolScript(`
|
|
402
|
+
var rendererName = "${rendererNameEsc}";
|
|
403
|
+
try {
|
|
404
|
+
app.enableQE();
|
|
405
|
+
if (qe && qe.project && qe.project.setRenderer) {
|
|
406
|
+
qe.project.setRenderer(rendererName);
|
|
407
|
+
return __result({ renderer: rendererName, applied: true });
|
|
408
|
+
}
|
|
409
|
+
} catch(e) {
|
|
410
|
+
return __error("Could not set renderer via QE DOM: " + e.toString());
|
|
411
|
+
}
|
|
412
|
+
return __result({ note: "setRenderer not available via QE DOM in this version. Change renderer via Edit > Project Settings > General > Renderer.", requested: rendererName });
|
|
413
|
+
`);
|
|
414
|
+
return sendCommand(script, bridgeOptions);
|
|
415
|
+
},
|
|
416
|
+
},
|
|
417
|
+
get_playback_resolution: {
|
|
418
|
+
description: "Get the current playback resolution setting (Full, 1/2, 1/4, 1/8).",
|
|
419
|
+
parameters: {
|
|
420
|
+
type: "object",
|
|
421
|
+
properties: {},
|
|
422
|
+
required: [],
|
|
423
|
+
},
|
|
424
|
+
handler: async (_args) => {
|
|
425
|
+
const script = buildToolScript(`
|
|
426
|
+
var info = {};
|
|
427
|
+
try {
|
|
428
|
+
app.enableQE();
|
|
429
|
+
if (qe && qe.project) {
|
|
430
|
+
var qeSeq = qe.project.getActiveSequence();
|
|
431
|
+
if (qeSeq) {
|
|
432
|
+
if (qeSeq.getPlaybackResolution) {
|
|
433
|
+
info.resolution = qeSeq.getPlaybackResolution();
|
|
434
|
+
}
|
|
435
|
+
if (qeSeq.getPausedResolution) {
|
|
436
|
+
info.pausedResolution = qeSeq.getPausedResolution();
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
} catch(e) {
|
|
441
|
+
info.note = "QE DOM error: " + e.toString();
|
|
442
|
+
}
|
|
443
|
+
if (!info.resolution) {
|
|
444
|
+
info.resolution = "unknown";
|
|
445
|
+
info.note = "Playback resolution is a UI setting. Check Program Monitor > wrench icon > Playback Resolution.";
|
|
446
|
+
}
|
|
447
|
+
return __result(info);
|
|
448
|
+
`);
|
|
449
|
+
return sendCommand(script, bridgeOptions);
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
set_playback_resolution: {
|
|
453
|
+
description: "Set the playback resolution for the Program Monitor to improve performance.",
|
|
454
|
+
parameters: {
|
|
455
|
+
type: "object",
|
|
456
|
+
properties: {
|
|
457
|
+
quality: { type: "string", description: "Resolution: 'full', 'half', 'quarter', or 'eighth'" },
|
|
458
|
+
},
|
|
459
|
+
required: ["quality"],
|
|
460
|
+
},
|
|
461
|
+
handler: async (args) => {
|
|
462
|
+
const qualityEsc = args.quality.replace(/"/g, '\\"').toLowerCase();
|
|
463
|
+
const script = buildToolScript(`
|
|
464
|
+
var quality = "${qualityEsc}";
|
|
465
|
+
var qualityMap = { "full": 1, "half": 2, "quarter": 4, "eighth": 8 };
|
|
466
|
+
var qVal = qualityMap[quality];
|
|
467
|
+
if (!qVal) return __error("Invalid quality. Use: full, half, quarter, or eighth");
|
|
468
|
+
try {
|
|
469
|
+
app.enableQE();
|
|
470
|
+
if (qe && qe.project) {
|
|
471
|
+
var qeSeq = qe.project.getActiveSequence();
|
|
472
|
+
if (qeSeq && qeSeq.setPlaybackResolution) {
|
|
473
|
+
qeSeq.setPlaybackResolution(qVal);
|
|
474
|
+
return __result({ quality: quality, value: qVal, applied: true });
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
} catch(e) {
|
|
478
|
+
return __error("Could not set playback resolution via QE DOM: " + e.toString());
|
|
479
|
+
}
|
|
480
|
+
return __result({ note: "setPlaybackResolution not available in this version. Change via Program Monitor wrench menu.", requested: quality });
|
|
481
|
+
`);
|
|
482
|
+
return sendCommand(script, bridgeOptions);
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
get_default_sequence_presets: {
|
|
486
|
+
description: "Get the list of built-in default sequence presets available for creating new sequences.",
|
|
487
|
+
parameters: {
|
|
488
|
+
type: "object",
|
|
489
|
+
properties: {},
|
|
490
|
+
required: [],
|
|
491
|
+
},
|
|
492
|
+
handler: async (_args) => {
|
|
493
|
+
const script = buildToolScript(`
|
|
494
|
+
var presetDir = new Folder("C:\\\\Program Files\\\\Adobe\\\\Adobe Premiere Pro 2026\\\\Settings\\\\SequencePresets");
|
|
495
|
+
var presets = [];
|
|
496
|
+
if (presetDir.exists) {
|
|
497
|
+
var files = presetDir.getFiles("*.sqpreset");
|
|
498
|
+
for (var i = 0; i < files.length; i++) {
|
|
499
|
+
presets.push({ name: files[i].name, path: files[i].fsName });
|
|
500
|
+
}
|
|
501
|
+
var subFolders = presetDir.getFiles(function(f) { return f instanceof Folder; });
|
|
502
|
+
for (var sf = 0; sf < subFolders.length; sf++) {
|
|
503
|
+
var subFiles = subFolders[sf].getFiles("*.sqpreset");
|
|
504
|
+
for (var ff = 0; ff < subFiles.length; ff++) {
|
|
505
|
+
presets.push({ name: subFolders[sf].name + "/" + subFiles[ff].name, path: subFiles[ff].fsName });
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
} else {
|
|
509
|
+
var altDir = new Folder("C:\\\\Program Files\\\\Adobe\\\\Adobe Premiere Pro 2025\\\\Settings\\\\SequencePresets");
|
|
510
|
+
if (altDir.exists) {
|
|
511
|
+
var altFiles = altDir.getFiles("*.sqpreset");
|
|
512
|
+
for (var ai = 0; ai < altFiles.length; ai++) {
|
|
513
|
+
presets.push({ name: altFiles[ai].name, path: altFiles[ai].fsName });
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
if (presets.length === 0) {
|
|
518
|
+
presets = [
|
|
519
|
+
{ name: "AVCHD 1080p25", path: "SequencePresets/AVCHD/1080p/AVCHD 1080p25.sqpreset" },
|
|
520
|
+
{ name: "AVCHD 1080p30", path: "SequencePresets/AVCHD/1080p/AVCHD 1080p30.sqpreset" },
|
|
521
|
+
{ name: "HDV 1080p25", path: "SequencePresets/HDV/HDV 1080p25.sqpreset" },
|
|
522
|
+
{ name: "DSLR 1080p24", path: "SequencePresets/DSLR/DSLR 1080p24.sqpreset" },
|
|
523
|
+
{ name: "REDCine-X 4K", path: "SequencePresets/RED R3D/4K/REDCine-X 4K.sqpreset" }
|
|
524
|
+
];
|
|
525
|
+
return __result({ presets: presets, note: "Preset directory not found at expected path; returning common presets list." });
|
|
526
|
+
}
|
|
527
|
+
return __result({ presets: presets, count: presets.length });
|
|
528
|
+
`);
|
|
529
|
+
return sendCommand(script, bridgeOptions);
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
set_default_sequence_preset: {
|
|
533
|
+
description: "Set the default sequence preset path used when creating new sequences.",
|
|
534
|
+
parameters: {
|
|
535
|
+
type: "object",
|
|
536
|
+
properties: {
|
|
537
|
+
preset_path: { type: "string", description: "Full path to the sequence preset file (.sqpreset)" },
|
|
538
|
+
},
|
|
539
|
+
required: ["preset_path"],
|
|
540
|
+
},
|
|
541
|
+
handler: async (args) => {
|
|
542
|
+
const presetPathEsc = args.preset_path.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
543
|
+
const script = buildToolScript(`
|
|
544
|
+
var presetPath = "${presetPathEsc}";
|
|
545
|
+
var f = new File(presetPath);
|
|
546
|
+
if (!f.exists) return __error("Preset file not found: " + presetPath);
|
|
547
|
+
// Try to store as application preference
|
|
548
|
+
var stored = false;
|
|
549
|
+
try {
|
|
550
|
+
if (app.setPreference) { app.setPreference("defaultSequencePreset", presetPath); stored = true; }
|
|
551
|
+
} catch(e) {}
|
|
552
|
+
// Validate preset by testing it with QE
|
|
553
|
+
var validated = false;
|
|
554
|
+
try {
|
|
555
|
+
app.enableQE();
|
|
556
|
+
if (qe && qe.project) { validated = true; }
|
|
557
|
+
} catch(e2) {}
|
|
558
|
+
return __result({ presetPath: presetPath, exists: true, stored: stored, validated: validated,
|
|
559
|
+
note: stored ? "Default preset preference saved." : "Preset validated but could not store preference (not supported in this PP version). To persist default, use Sequence > New Sequence > and select this preset manually once." });
|
|
560
|
+
`);
|
|
561
|
+
return sendCommand(script, bridgeOptions);
|
|
562
|
+
},
|
|
563
|
+
},
|
|
564
|
+
get_auto_save_settings: {
|
|
565
|
+
description: "Get the current auto-save settings including interval and maximum versions.",
|
|
566
|
+
parameters: {
|
|
567
|
+
type: "object",
|
|
568
|
+
properties: {},
|
|
569
|
+
required: [],
|
|
570
|
+
},
|
|
571
|
+
handler: async (_args) => {
|
|
572
|
+
const script = buildToolScript(`
|
|
573
|
+
var info = {
|
|
574
|
+
note: "Auto-save settings are stored in Premiere Pro application preferences (not accessible via ExtendScript). Default values shown.",
|
|
575
|
+
autoSaveEnabled: true,
|
|
576
|
+
intervalMinutes: 15,
|
|
577
|
+
maxVersions: 20
|
|
578
|
+
};
|
|
579
|
+
try {
|
|
580
|
+
if (app.properties) {
|
|
581
|
+
var interval = app.properties.getProperty("Auto-Save.interval");
|
|
582
|
+
if (interval !== undefined) info.intervalMinutes = interval;
|
|
583
|
+
var maxV = app.properties.getProperty("Auto-Save.maxVersions");
|
|
584
|
+
if (maxV !== undefined) info.maxVersions = maxV;
|
|
585
|
+
var enabled = app.properties.getProperty("Auto-Save.enabled");
|
|
586
|
+
if (enabled !== undefined) info.autoSaveEnabled = enabled;
|
|
587
|
+
delete info.note;
|
|
588
|
+
}
|
|
589
|
+
} catch(e) {
|
|
590
|
+
info.propertiesError = e.toString();
|
|
591
|
+
}
|
|
592
|
+
return __result(info);
|
|
593
|
+
`);
|
|
594
|
+
return sendCommand(script, bridgeOptions);
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
set_auto_save_interval: {
|
|
598
|
+
description: "Set how frequently Premiere Pro auto-saves the project (in minutes).",
|
|
599
|
+
parameters: {
|
|
600
|
+
type: "object",
|
|
601
|
+
properties: {
|
|
602
|
+
minutes: { type: "number", description: "Auto-save interval in minutes (1-60). Default: 15." },
|
|
603
|
+
},
|
|
604
|
+
required: ["minutes"],
|
|
605
|
+
},
|
|
606
|
+
handler: async (args) => {
|
|
607
|
+
const script = buildToolScript(`
|
|
608
|
+
var minutes = ${args.minutes};
|
|
609
|
+
try {
|
|
610
|
+
if (app.properties && app.properties.setProperty) {
|
|
611
|
+
app.properties.setProperty("Auto-Save.interval", minutes);
|
|
612
|
+
return __result({ intervalMinutes: minutes, applied: true });
|
|
613
|
+
}
|
|
614
|
+
} catch(e) {}
|
|
615
|
+
return __result({ note: "Auto-save interval not settable via ExtendScript in this version. Change via Edit > Preferences > Auto Save. Requested: " + minutes + " minutes.", requestedMinutes: minutes });
|
|
616
|
+
`);
|
|
617
|
+
return sendCommand(script, bridgeOptions);
|
|
618
|
+
},
|
|
619
|
+
},
|
|
620
|
+
set_auto_save_enabled: {
|
|
621
|
+
description: "Enable or disable auto-save for the project.",
|
|
622
|
+
parameters: {
|
|
623
|
+
type: "object",
|
|
624
|
+
properties: {
|
|
625
|
+
enabled: { type: "boolean", description: "True to enable auto-save, false to disable" },
|
|
626
|
+
},
|
|
627
|
+
required: ["enabled"],
|
|
628
|
+
},
|
|
629
|
+
handler: async (args) => {
|
|
630
|
+
const script = buildToolScript(`
|
|
631
|
+
var enabled = ${args.enabled};
|
|
632
|
+
try {
|
|
633
|
+
if (app.properties && app.properties.setProperty) {
|
|
634
|
+
app.properties.setProperty("Auto-Save.enabled", enabled);
|
|
635
|
+
return __result({ autoSaveEnabled: enabled, applied: true });
|
|
636
|
+
}
|
|
637
|
+
} catch(e) {}
|
|
638
|
+
return __result({ note: "Auto-save enable/disable not settable via ExtendScript in this version. Change via Edit > Preferences > Auto Save.", requestedEnabled: enabled });
|
|
639
|
+
`);
|
|
640
|
+
return sendCommand(script, bridgeOptions);
|
|
641
|
+
},
|
|
642
|
+
},
|
|
643
|
+
set_default_still_duration: {
|
|
644
|
+
description: "Set the default duration for still images when added to the timeline.",
|
|
645
|
+
parameters: {
|
|
646
|
+
type: "object",
|
|
647
|
+
properties: {
|
|
648
|
+
frames: { type: "number", description: "Default still duration in frames (e.g. 150 frames = 5 seconds at 30fps)" },
|
|
649
|
+
},
|
|
650
|
+
required: ["frames"],
|
|
651
|
+
},
|
|
652
|
+
handler: async (args) => {
|
|
653
|
+
const script = buildToolScript(`
|
|
654
|
+
var frames = ${args.frames};
|
|
655
|
+
try {
|
|
656
|
+
app.enableQE();
|
|
657
|
+
if (qe && qe.project && qe.project.setStillImageDefaultDuration) {
|
|
658
|
+
qe.project.setStillImageDefaultDuration(frames);
|
|
659
|
+
return __result({ frames: frames, applied: true });
|
|
660
|
+
}
|
|
661
|
+
} catch(e) {}
|
|
662
|
+
return __result({ note: "Default still duration not settable via ExtendScript/QE in this version. Change via Edit > Preferences > Timeline > Still Image Default Duration.", requestedFrames: frames });
|
|
663
|
+
`);
|
|
664
|
+
return sendCommand(script, bridgeOptions);
|
|
665
|
+
},
|
|
666
|
+
},
|
|
667
|
+
set_default_transition_duration: {
|
|
668
|
+
description: "Set the default video transition duration in seconds.",
|
|
669
|
+
parameters: {
|
|
670
|
+
type: "object",
|
|
671
|
+
properties: {
|
|
672
|
+
seconds: { type: "number", description: "Default transition duration in seconds (e.g. 1.0)" },
|
|
673
|
+
},
|
|
674
|
+
required: ["seconds"],
|
|
675
|
+
},
|
|
676
|
+
handler: async (args) => {
|
|
677
|
+
const script = buildToolScript(`
|
|
678
|
+
var seconds = ${args.seconds};
|
|
679
|
+
try {
|
|
680
|
+
app.enableQE();
|
|
681
|
+
if (qe && qe.project) {
|
|
682
|
+
var seq = app.project.activeSequence;
|
|
683
|
+
var fps = 25;
|
|
684
|
+
if (seq) {
|
|
685
|
+
var settings = seq.getSettings();
|
|
686
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
687
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
688
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
var frames = Math.round(seconds * fps);
|
|
692
|
+
if (qe.project.setVideoTransitionDefaultDuration) {
|
|
693
|
+
qe.project.setVideoTransitionDefaultDuration(frames);
|
|
694
|
+
return __result({ seconds: seconds, frames: frames, fps: fps, applied: true });
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
} catch(e) {}
|
|
698
|
+
return __result({ note: "Default transition duration not settable via ExtendScript in this version. Change via Edit > Preferences > Timeline > Video Transition Default Duration.", requestedSeconds: seconds });
|
|
699
|
+
`);
|
|
700
|
+
return sendCommand(script, bridgeOptions);
|
|
701
|
+
},
|
|
702
|
+
},
|
|
703
|
+
set_default_audio_transition_duration: {
|
|
704
|
+
description: "Set the default audio transition (crossfade) duration in seconds.",
|
|
705
|
+
parameters: {
|
|
706
|
+
type: "object",
|
|
707
|
+
properties: {
|
|
708
|
+
seconds: { type: "number", description: "Default audio transition duration in seconds (e.g. 1.0)" },
|
|
709
|
+
},
|
|
710
|
+
required: ["seconds"],
|
|
711
|
+
},
|
|
712
|
+
handler: async (args) => {
|
|
713
|
+
const script = buildToolScript(`
|
|
714
|
+
var seconds = ${args.seconds};
|
|
715
|
+
try {
|
|
716
|
+
app.enableQE();
|
|
717
|
+
if (qe && qe.project) {
|
|
718
|
+
var seq = app.project.activeSequence;
|
|
719
|
+
var fps = 25;
|
|
720
|
+
if (seq) {
|
|
721
|
+
var settings = seq.getSettings();
|
|
722
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
723
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
724
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
var frames = Math.round(seconds * fps);
|
|
728
|
+
if (qe.project.setAudioTransitionDefaultDuration) {
|
|
729
|
+
qe.project.setAudioTransitionDefaultDuration(frames);
|
|
730
|
+
return __result({ seconds: seconds, frames: frames, fps: fps, applied: true });
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
} catch(e) {}
|
|
734
|
+
return __result({ note: "Default audio transition duration not settable via ExtendScript in this version. Change via Edit > Preferences > Timeline > Audio Transition Default Duration.", requestedSeconds: seconds });
|
|
735
|
+
`);
|
|
736
|
+
return sendCommand(script, bridgeOptions);
|
|
737
|
+
},
|
|
738
|
+
},
|
|
739
|
+
get_general_preferences: {
|
|
740
|
+
description: "Get general Premiere Pro application preferences like default durations, app version, and current sequence settings.",
|
|
741
|
+
parameters: {
|
|
742
|
+
type: "object",
|
|
743
|
+
properties: {},
|
|
744
|
+
required: [],
|
|
745
|
+
},
|
|
746
|
+
handler: async (_args) => {
|
|
747
|
+
const script = buildToolScript(`
|
|
748
|
+
var prefs = {
|
|
749
|
+
version: app.version,
|
|
750
|
+
build: app.build || "unknown",
|
|
751
|
+
os: $.os,
|
|
752
|
+
locale: $.locale || "unknown",
|
|
753
|
+
projectPath: app.project ? app.project.path : "no project",
|
|
754
|
+
projectName: app.project ? app.project.name : "no project",
|
|
755
|
+
numSequences: app.project && app.project.sequences ? app.project.sequences.numSequences : 0
|
|
756
|
+
};
|
|
757
|
+
var seq = app.project ? app.project.activeSequence : null;
|
|
758
|
+
if (seq) {
|
|
759
|
+
var settings = seq.getSettings();
|
|
760
|
+
var fps = 25;
|
|
761
|
+
if (settings && settings.videoFrameRate && settings.videoFrameRate.ticks) {
|
|
762
|
+
var frticks = parseFloat(settings.videoFrameRate.ticks);
|
|
763
|
+
if (frticks > 0) fps = TICKS_PER_SECOND / frticks;
|
|
764
|
+
}
|
|
765
|
+
prefs.activeSequence = {
|
|
766
|
+
name: seq.name,
|
|
767
|
+
width: settings ? settings.videoFrameWidth : 0,
|
|
768
|
+
height: settings ? settings.videoFrameHeight : 0,
|
|
769
|
+
frameRate: fps
|
|
770
|
+
};
|
|
771
|
+
}
|
|
772
|
+
return __result(prefs);
|
|
773
|
+
`);
|
|
774
|
+
return sendCommand(script, bridgeOptions);
|
|
775
|
+
},
|
|
776
|
+
},
|
|
777
|
+
get_memory_settings: {
|
|
778
|
+
description: "Get current memory usage settings for Premiere Pro.",
|
|
779
|
+
parameters: {
|
|
780
|
+
type: "object",
|
|
781
|
+
properties: {},
|
|
782
|
+
required: [],
|
|
783
|
+
},
|
|
784
|
+
handler: async (_args) => {
|
|
785
|
+
const script = buildToolScript(`
|
|
786
|
+
var info = {
|
|
787
|
+
note: "Detailed memory allocation settings (RAM reserved for other apps) are stored in application preferences and not directly readable via ExtendScript.",
|
|
788
|
+
version: app.version,
|
|
789
|
+
os: $.os
|
|
790
|
+
};
|
|
791
|
+
try {
|
|
792
|
+
if ($.memCache !== undefined) info.memCache = $.memCache;
|
|
793
|
+
if ($.screens) {
|
|
794
|
+
var screens = [];
|
|
795
|
+
for (var i = 0; i < $.screens.length; i++) {
|
|
796
|
+
screens.push({ width: $.screens[i].width, height: $.screens[i].height });
|
|
797
|
+
}
|
|
798
|
+
info.screens = screens;
|
|
799
|
+
}
|
|
800
|
+
} catch(e) {}
|
|
801
|
+
return __result(info);
|
|
802
|
+
`);
|
|
803
|
+
return sendCommand(script, bridgeOptions);
|
|
804
|
+
},
|
|
805
|
+
},
|
|
806
|
+
clear_media_cache: {
|
|
807
|
+
description: "Clear the Premiere Pro media cache to free up disk space.",
|
|
808
|
+
parameters: {
|
|
809
|
+
type: "object",
|
|
810
|
+
properties: {},
|
|
811
|
+
required: [],
|
|
812
|
+
},
|
|
813
|
+
handler: async (_args) => {
|
|
814
|
+
const script = buildToolScript(`
|
|
815
|
+
try {
|
|
816
|
+
if (app.project && app.project.deleteCache) {
|
|
817
|
+
app.project.deleteCache(0);
|
|
818
|
+
return __result({ success: true, message: "Media cache deleted (unused files)." });
|
|
819
|
+
}
|
|
820
|
+
} catch(e) {
|
|
821
|
+
return __error("deleteCache failed: " + e.toString());
|
|
822
|
+
}
|
|
823
|
+
return __result({ note: "app.project.deleteCache not available in this version. Clear via Edit > Preferences > Media Cache > Delete." });
|
|
824
|
+
`);
|
|
825
|
+
return sendCommand(script, bridgeOptions);
|
|
826
|
+
},
|
|
827
|
+
},
|
|
828
|
+
get_media_cache_settings: {
|
|
829
|
+
description: "Get media cache location and size settings.",
|
|
830
|
+
parameters: {
|
|
831
|
+
type: "object",
|
|
832
|
+
properties: {},
|
|
833
|
+
required: [],
|
|
834
|
+
},
|
|
835
|
+
handler: async (_args) => {
|
|
836
|
+
const script = buildToolScript(`
|
|
837
|
+
var info = { version: app.version };
|
|
838
|
+
try {
|
|
839
|
+
// Scratch disks ARE accessible via ExtendScript
|
|
840
|
+
if (app.project.getScratchDiskPath) {
|
|
841
|
+
info.videoCaptureDir = app.project.getScratchDiskPath(1);
|
|
842
|
+
info.audioPreviewDir = app.project.getScratchDiskPath(2);
|
|
843
|
+
info.videoPreviewDir = app.project.getScratchDiskPath(3);
|
|
844
|
+
info.autoSaveDir = app.project.getScratchDiskPath(4);
|
|
845
|
+
}
|
|
846
|
+
} catch(e) {}
|
|
847
|
+
try {
|
|
848
|
+
if (app.project.path) {
|
|
849
|
+
var projFile = new File(app.project.path);
|
|
850
|
+
info.projectDir = projFile.parent.fsName;
|
|
851
|
+
}
|
|
852
|
+
} catch(e2) {}
|
|
853
|
+
info.note = "Full media cache path/size settings require Preferences API not available in ExtendScript. Scratch disk locations shown above.";
|
|
854
|
+
return __result(info);
|
|
855
|
+
`);
|
|
856
|
+
return sendCommand(script, bridgeOptions);
|
|
857
|
+
},
|
|
858
|
+
},
|
|
859
|
+
get_system_info: {
|
|
860
|
+
description: "Get system information including OS, available RAM, GPU, and Premiere Pro version details.",
|
|
861
|
+
parameters: {
|
|
862
|
+
type: "object",
|
|
863
|
+
properties: {},
|
|
864
|
+
required: [],
|
|
865
|
+
},
|
|
866
|
+
handler: async (_args) => {
|
|
867
|
+
const script = buildToolScript(`
|
|
868
|
+
var info = {
|
|
869
|
+
os: $.os,
|
|
870
|
+
version: app.version,
|
|
871
|
+
build: app.build || "unknown",
|
|
872
|
+
locale: $.locale || "unknown",
|
|
873
|
+
jsxVersion: $.version || "unknown"
|
|
874
|
+
};
|
|
875
|
+
try {
|
|
876
|
+
app.enableQE();
|
|
877
|
+
if (qe && qe.project && qe.project.getActiveRenderer) {
|
|
878
|
+
info.renderer = qe.project.getActiveRenderer();
|
|
879
|
+
}
|
|
880
|
+
} catch(e) {
|
|
881
|
+
info.rendererNote = "QE DOM unavailable";
|
|
882
|
+
}
|
|
883
|
+
return __result(info);
|
|
884
|
+
`);
|
|
885
|
+
return sendCommand(script, bridgeOptions);
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
get_project_settings: {
|
|
889
|
+
description: "Get project-level settings including scratch disk paths and general project configuration.",
|
|
890
|
+
parameters: {
|
|
891
|
+
type: "object",
|
|
892
|
+
properties: {},
|
|
893
|
+
required: [],
|
|
894
|
+
},
|
|
895
|
+
handler: async (_args) => {
|
|
896
|
+
const script = buildToolScript(`
|
|
897
|
+
if (!app.project) return __error("No project open");
|
|
898
|
+
var info = {
|
|
899
|
+
name: app.project.name,
|
|
900
|
+
path: app.project.path,
|
|
901
|
+
numSequences: app.project.sequences ? app.project.sequences.numSequences : 0,
|
|
902
|
+
numProjectItems: app.project.rootItem ? app.project.rootItem.children.numItems : 0
|
|
903
|
+
};
|
|
904
|
+
try {
|
|
905
|
+
var scratchDisk = app.project.getScratchDiskPath ? app.project.getScratchDiskPath(1) : null;
|
|
906
|
+
if (scratchDisk) info.capturedVideoPath = scratchDisk;
|
|
907
|
+
} catch(e) {}
|
|
908
|
+
return __result(info);
|
|
909
|
+
`);
|
|
910
|
+
return sendCommand(script, bridgeOptions);
|
|
911
|
+
},
|
|
912
|
+
},
|
|
913
|
+
conform_sequence_to_clip: {
|
|
914
|
+
description: "Change the sequence settings to match the properties of a specific project item (resolution, frame rate).",
|
|
915
|
+
parameters: {
|
|
916
|
+
type: "object",
|
|
917
|
+
properties: {
|
|
918
|
+
project_item_index: { type: "number", description: "Project item index (0-based) whose properties to match" },
|
|
919
|
+
},
|
|
920
|
+
required: ["project_item_index"],
|
|
921
|
+
},
|
|
922
|
+
handler: async (args) => {
|
|
923
|
+
const script = buildToolScript(`
|
|
924
|
+
var itemIndex = ${args.project_item_index};
|
|
925
|
+
if (!app.project) return __error("No project open");
|
|
926
|
+
var rootItem = app.project.rootItem;
|
|
927
|
+
if (!rootItem || !rootItem.children || itemIndex >= rootItem.children.numItems) {
|
|
928
|
+
return __error("Project item index " + itemIndex + " not found");
|
|
929
|
+
}
|
|
930
|
+
var item = rootItem.children[itemIndex];
|
|
931
|
+
var seq = app.project.activeSequence;
|
|
932
|
+
if (!seq) return __error("No active sequence");
|
|
933
|
+
// getVideoMetaData() returns a metadata STRING, not an object with
|
|
934
|
+
// numeric .frameWidth/.frameHeight/.frameRate. Derive the frame rate
|
|
935
|
+
// from the footage interpretation instead, which exposes a numeric
|
|
936
|
+
// .frameRate. Width/height are not reliably available from a project
|
|
937
|
+
// item here, so leave them unchanged.
|
|
938
|
+
var clipFrameRate = null;
|
|
939
|
+
try {
|
|
940
|
+
var interp = item.getFootageInterpretation ? item.getFootageInterpretation() : null;
|
|
941
|
+
if (interp && interp.frameRate) clipFrameRate = interp.frameRate;
|
|
942
|
+
} catch(e) {}
|
|
943
|
+
var settings = seq.getSettings();
|
|
944
|
+
if (!settings) return __error("Could not get sequence settings");
|
|
945
|
+
var changed = [];
|
|
946
|
+
if (clipFrameRate && settings.videoFrameRate) {
|
|
947
|
+
var frTicks = Math.round(TICKS_PER_SECOND / clipFrameRate);
|
|
948
|
+
settings.videoFrameRate.ticks = String(frTicks);
|
|
949
|
+
changed.push("frameRate=" + clipFrameRate);
|
|
950
|
+
}
|
|
951
|
+
if (changed.length === 0) {
|
|
952
|
+
return __result({
|
|
953
|
+
applied: false,
|
|
954
|
+
changes: [],
|
|
955
|
+
item: item.name,
|
|
956
|
+
note: "Could not derive any conformable settings (frame rate) from item '" + item.name + "'. Width/height are not reliably available via scripting; conform those manually via Sequence > Sequence Settings."
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
seq.setSettings(settings);
|
|
960
|
+
return __result({ applied: true, changes: changed, item: item.name });
|
|
961
|
+
`);
|
|
962
|
+
return sendCommand(script, bridgeOptions);
|
|
963
|
+
},
|
|
964
|
+
},
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
//# sourceMappingURL=sequence-settings.js.map
|