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.
- premiere_cli/__init__.py +11 -0
- premiere_cli/cli.py +3664 -0
- premiere_cli/log.py +66 -0
- premiere_cli/panel/.debug +8 -0
- premiere_cli/panel/CSXS/manifest.xml +52 -0
- premiere_cli/panel/css/style.css +53 -0
- premiere_cli/panel/host/commands/add-adjustment-layer.jsx +190 -0
- premiere_cli/panel/host/commands/add-audio-keyframes.jsx +176 -0
- premiere_cli/panel/host/commands/add-custom-metadata-field.jsx +63 -0
- premiere_cli/panel/host/commands/add-keyframe.jsx +181 -0
- premiere_cli/panel/host/commands/add-marker-to-project-item.jsx +194 -0
- premiere_cli/panel/host/commands/add-marker.jsx +129 -0
- premiere_cli/panel/host/commands/add-text-overlay.jsx +101 -0
- premiere_cli/panel/host/commands/add-to-render-queue.jsx +120 -0
- premiere_cli/panel/host/commands/add-to-timeline.jsx +300 -0
- premiere_cli/panel/host/commands/add-track.jsx +188 -0
- premiere_cli/panel/host/commands/add-transition.jsx +134 -0
- premiere_cli/panel/host/commands/adjust-audio-levels.jsx +132 -0
- premiere_cli/panel/host/commands/apply-audio-effect.jsx +118 -0
- premiere_cli/panel/host/commands/apply-effect.jsx +122 -0
- premiere_cli/panel/host/commands/apply-lut.jsx +107 -0
- premiere_cli/panel/host/commands/attach-custom-property.jsx +66 -0
- premiere_cli/panel/host/commands/auto-reframe-sequence.jsx +124 -0
- premiere_cli/panel/host/commands/batch-add-transitions.jsx +158 -0
- premiere_cli/panel/host/commands/batch-apply-effect.jsx +182 -0
- premiere_cli/panel/host/commands/batch-rename-clips.jsx +170 -0
- premiere_cli/panel/host/commands/batch-set-clips-enabled.jsx +145 -0
- premiere_cli/panel/host/commands/clear-item-in-out.jsx +117 -0
- premiere_cli/panel/host/commands/clear-sequence-in-out.jsx +100 -0
- premiere_cli/panel/host/commands/close-all-source-clips.jsx +32 -0
- premiere_cli/panel/host/commands/close-sequence.jsx +80 -0
- premiere_cli/panel/host/commands/close-source-monitor.jsx +32 -0
- premiere_cli/panel/host/commands/color-correct.jsx +164 -0
- premiere_cli/panel/host/commands/copy-effect-values.jsx +183 -0
- premiere_cli/panel/host/commands/copy-effects-between-clips.jsx +234 -0
- premiere_cli/panel/host/commands/create-bars-and-tone.jsx +152 -0
- premiere_cli/panel/host/commands/create-bin.jsx +76 -0
- premiere_cli/panel/host/commands/create-caption-track.jsx +159 -0
- premiere_cli/panel/host/commands/create-sequence-from-clips.jsx +170 -0
- premiere_cli/panel/host/commands/create-sequence-from-preset.jsx +90 -0
- premiere_cli/panel/host/commands/create-sequence.jsx +166 -0
- premiere_cli/panel/host/commands/create-smart-bin.jsx +80 -0
- premiere_cli/panel/host/commands/create-subclip.jsx +248 -0
- premiere_cli/panel/host/commands/create-subsequence.jsx +136 -0
- premiere_cli/panel/host/commands/debug-qe-inspect.jsx +248 -0
- premiere_cli/panel/host/commands/debug-qe-try-mutate.jsx +305 -0
- premiere_cli/panel/host/commands/delete-marker.jsx +178 -0
- premiere_cli/panel/host/commands/deselect-all-clips.jsx +98 -0
- premiere_cli/panel/host/commands/detach-proxy.jsx +116 -0
- premiere_cli/panel/host/commands/duplicate-clip.jsx +140 -0
- premiere_cli/panel/host/commands/duplicate-sequence.jsx +150 -0
- premiere_cli/panel/host/commands/encode-file.jsx +86 -0
- premiere_cli/panel/host/commands/encode-project-item.jsx +145 -0
- premiere_cli/panel/host/commands/export-aaf.jsx +77 -0
- premiere_cli/panel/host/commands/export-fcp-xml.jsx +65 -0
- premiere_cli/panel/host/commands/export-frame.jsx +381 -0
- premiere_cli/panel/host/commands/export-omf.jsx +95 -0
- premiere_cli/panel/host/commands/export-sequence-as-project.jsx +65 -0
- premiere_cli/panel/host/commands/export-sequence.jsx +100 -0
- premiere_cli/panel/host/commands/extract-audio-track.jsx +181 -0
- premiere_cli/panel/host/commands/extract-selection.jsx +113 -0
- premiere_cli/panel/host/commands/find-items-by-media-path.jsx +112 -0
- premiere_cli/panel/host/commands/freeze-frame.jsx +215 -0
- premiere_cli/panel/host/commands/get-active-sequence.jsx +103 -0
- premiere_cli/panel/host/commands/get-all-project-paths.jsx +72 -0
- premiere_cli/panel/host/commands/get-bin-contents.jsx +176 -0
- premiere_cli/panel/host/commands/get-clip-adjustment-layer.jsx +83 -0
- premiere_cli/panel/host/commands/get-clip-at-playhead.jsx +99 -0
- premiere_cli/panel/host/commands/get-clip-at-position.jsx +120 -0
- premiere_cli/panel/host/commands/get-clip-links.jsx +135 -0
- premiere_cli/panel/host/commands/get-clip-markers.jsx +144 -0
- premiere_cli/panel/host/commands/get-clip-speed.jsx +69 -0
- premiere_cli/panel/host/commands/get-color-label.jsx +89 -0
- premiere_cli/panel/host/commands/get-color-space.jsx +99 -0
- premiere_cli/panel/host/commands/get-duplicate-media.jsx +78 -0
- premiere_cli/panel/host/commands/get-effect-properties.jsx +129 -0
- premiere_cli/panel/host/commands/get-encoder-presets.jsx +131 -0
- premiere_cli/panel/host/commands/get-export-file-extension.jsx +56 -0
- premiere_cli/panel/host/commands/get-footage-interpretation.jsx +113 -0
- premiere_cli/panel/host/commands/get-full-clip-info.jsx +162 -0
- premiere_cli/panel/host/commands/get-full-project-overview.jsx +193 -0
- premiere_cli/panel/host/commands/get-full-sequence-info.jsx +184 -0
- premiere_cli/panel/host/commands/get-graphics-white-luminance.jsx +31 -0
- premiere_cli/panel/host/commands/get-insertion-bin.jsx +35 -0
- premiere_cli/panel/host/commands/get-item-metadata.jsx +94 -0
- premiere_cli/panel/host/commands/get-keyframes.jsx +158 -0
- premiere_cli/panel/host/commands/get-mogrt-component.jsx +111 -0
- premiere_cli/panel/host/commands/get-next-edit-point.jsx +131 -0
- premiere_cli/panel/host/commands/get-offline-media.jsx +67 -0
- premiere_cli/panel/host/commands/get-open-projects.jsx +50 -0
- premiere_cli/panel/host/commands/get-premiere-state.jsx +164 -0
- premiere_cli/panel/host/commands/get-project-info.jsx +63 -0
- premiere_cli/panel/host/commands/get-project-item-info.jsx +247 -0
- premiere_cli/panel/host/commands/get-project-panel-metadata.jsx +30 -0
- premiere_cli/panel/host/commands/get-qe-clip-info.jsx +198 -0
- premiere_cli/panel/host/commands/get-render-queue-status.jsx +35 -0
- premiere_cli/panel/host/commands/get-sequence-count.jsx +24 -0
- premiere_cli/panel/host/commands/get-sequence-in-out.jsx +76 -0
- premiere_cli/panel/host/commands/get-sequence-markers-by-type.jsx +89 -0
- premiere_cli/panel/host/commands/get-source-monitor-info.jsx +34 -0
- premiere_cli/panel/host/commands/get-source-monitor-position.jsx +30 -0
- premiere_cli/panel/host/commands/get-target-tracks.jsx +76 -0
- premiere_cli/panel/host/commands/get-timeline-gaps.jsx +124 -0
- premiere_cli/panel/host/commands/get-timeline-summary.jsx +154 -0
- premiere_cli/panel/host/commands/get-total-clip-count.jsx +67 -0
- premiere_cli/panel/host/commands/get-track-info.jsx +117 -0
- premiere_cli/panel/host/commands/get-unused-media.jsx +99 -0
- premiere_cli/panel/host/commands/get-used-media-report.jsx +125 -0
- premiere_cli/panel/host/commands/get-value-at-time.jsx +135 -0
- premiere_cli/panel/host/commands/get-version-info.jsx +33 -0
- premiere_cli/panel/host/commands/get-work-area.jsx +52 -0
- premiere_cli/panel/host/commands/get-workspaces.jsx +29 -0
- premiere_cli/panel/host/commands/get-xmp-metadata.jsx +107 -0
- premiere_cli/panel/host/commands/import-ae-comps.jsx +129 -0
- premiere_cli/panel/host/commands/import-fcp-xml.jsx +103 -0
- premiere_cli/panel/host/commands/import-folder.jsx +193 -0
- premiere_cli/panel/host/commands/import-image-sequence.jsx +171 -0
- premiere_cli/panel/host/commands/import-media.jsx +217 -0
- premiere_cli/panel/host/commands/import-mogrt-from-library.jsx +105 -0
- premiere_cli/panel/host/commands/import-mogrt.jsx +111 -0
- premiere_cli/panel/host/commands/import-sequences-from-project.jsx +80 -0
- premiere_cli/panel/host/commands/insert-from-source.jsx +162 -0
- premiere_cli/panel/host/commands/inspect-dom-object.jsx +162 -0
- premiere_cli/panel/host/commands/invert-selection.jsx +114 -0
- premiere_cli/panel/host/commands/is-work-area-enabled.jsx +88 -0
- premiere_cli/panel/host/commands/lift-selection.jsx +106 -0
- premiere_cli/panel/host/commands/link-selection.jsx +111 -0
- premiere_cli/panel/host/commands/list-available-audio-effects.jsx +33 -0
- premiere_cli/panel/host/commands/list-available-audio-transitions.jsx +35 -0
- premiere_cli/panel/host/commands/list-available-effects.jsx +33 -0
- premiere_cli/panel/host/commands/list-available-transitions.jsx +74 -0
- premiere_cli/panel/host/commands/list-markers.jsx +69 -0
- premiere_cli/panel/host/commands/list-project-items.jsx +105 -0
- premiere_cli/panel/host/commands/lock-track.jsx +114 -0
- premiere_cli/panel/host/commands/manage-proxies.jsx +176 -0
- premiere_cli/panel/host/commands/match-frame.jsx +141 -0
- premiere_cli/panel/host/commands/move-clip-to-track.jsx +220 -0
- premiere_cli/panel/host/commands/move-clip.jsx +97 -0
- premiere_cli/panel/host/commands/move-items-to-bin.jsx +194 -0
- premiere_cli/panel/host/commands/move-playhead-to-edit.jsx +174 -0
- premiere_cli/panel/host/commands/move-playhead.jsx +137 -0
- premiere_cli/panel/host/commands/nest-clips.jsx +179 -0
- premiere_cli/panel/host/commands/open-in-source.jsx +117 -0
- premiere_cli/panel/host/commands/open-project.jsx +61 -0
- premiere_cli/panel/host/commands/overwrite-clip-at.jsx +350 -0
- premiere_cli/panel/host/commands/overwrite-from-source.jsx +150 -0
- premiere_cli/panel/host/commands/play-source-monitor.jsx +36 -0
- premiere_cli/panel/host/commands/play-timeline.jsx +24 -0
- premiere_cli/panel/host/commands/razor-all-tracks.jsx +171 -0
- premiere_cli/panel/host/commands/redo.jsx +69 -0
- premiere_cli/panel/host/commands/refresh-media.jsx +101 -0
- premiere_cli/panel/host/commands/relink-media.jsx +132 -0
- premiere_cli/panel/host/commands/remove-all-effects.jsx +114 -0
- premiere_cli/panel/host/commands/remove-effect-by-name.jsx +143 -0
- premiere_cli/panel/host/commands/remove-effect.jsx +122 -0
- premiere_cli/panel/host/commands/remove-from-timeline.jsx +93 -0
- premiere_cli/panel/host/commands/remove-keyframe-range.jsx +173 -0
- premiere_cli/panel/host/commands/remove-keyframe.jsx +192 -0
- premiere_cli/panel/host/commands/remove-selected-clips.jsx +126 -0
- premiere_cli/panel/host/commands/remove-track-intervals.jsx +254 -0
- premiere_cli/panel/host/commands/remove-transition.jsx +164 -0
- premiere_cli/panel/host/commands/rename-bin.jsx +88 -0
- premiere_cli/panel/host/commands/rename-clip.jsx +127 -0
- premiere_cli/panel/host/commands/rename-project-item.jsx +111 -0
- premiere_cli/panel/host/commands/rename-track.jsx +84 -0
- premiere_cli/panel/host/commands/replace-clip-media.jsx +140 -0
- premiere_cli/panel/host/commands/replace-clip.jsx +188 -0
- premiere_cli/panel/host/commands/reverse-clip.jsx +187 -0
- premiere_cli/panel/host/commands/ripple-delete-clip.jsx +156 -0
- premiere_cli/panel/host/commands/roll-edit.jsx +162 -0
- premiere_cli/panel/host/commands/save-project-as.jsx +55 -0
- premiere_cli/panel/host/commands/save-project.jsx +57 -0
- premiere_cli/panel/host/commands/scene-edit-detection.jsx +128 -0
- premiere_cli/panel/host/commands/search-project-items.jsx +180 -0
- premiere_cli/panel/host/commands/select-all-clips.jsx +107 -0
- premiere_cli/panel/host/commands/select-clips-by-color.jsx +142 -0
- premiere_cli/panel/host/commands/select-clips-by-name.jsx +133 -0
- premiere_cli/panel/host/commands/select-clips-in-range.jsx +133 -0
- premiere_cli/panel/host/commands/select-disabled-clips.jsx +127 -0
- premiere_cli/panel/host/commands/select-project-item.jsx +115 -0
- premiere_cli/panel/host/commands/set-active-project.jsx +184 -0
- premiere_cli/panel/host/commands/set-active-sequence.jsx +87 -0
- premiere_cli/panel/host/commands/set-all-tracks-targeted.jsx +112 -0
- premiere_cli/panel/host/commands/set-anti-alias-quality.jsx +125 -0
- premiere_cli/panel/host/commands/set-blend-mode.jsx +111 -0
- premiere_cli/panel/host/commands/set-clip-anchor-point.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-enabled.jsx +127 -0
- premiere_cli/panel/host/commands/set-clip-opacity.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-pan.jsx +107 -0
- premiere_cli/panel/host/commands/set-clip-position.jsx +103 -0
- premiere_cli/panel/host/commands/set-clip-properties.jsx +221 -0
- premiere_cli/panel/host/commands/set-clip-rotation.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-scale.jsx +102 -0
- premiere_cli/panel/host/commands/set-clip-selection.jsx +144 -0
- premiere_cli/panel/host/commands/set-clip-speed.jsx +160 -0
- premiere_cli/panel/host/commands/set-clip-volume.jsx +128 -0
- premiere_cli/panel/host/commands/set-color-label.jsx +123 -0
- premiere_cli/panel/host/commands/set-color-value.jsx +155 -0
- premiere_cli/panel/host/commands/set-effect-property.jsx +124 -0
- premiere_cli/panel/host/commands/set-footage-interpretation.jsx +173 -0
- premiere_cli/panel/host/commands/set-frame-blend.jsx +145 -0
- premiere_cli/panel/host/commands/set-graphics-white-luminance.jsx +73 -0
- premiere_cli/panel/host/commands/set-item-in-out.jsx +180 -0
- premiere_cli/panel/host/commands/set-item-metadata.jsx +134 -0
- premiere_cli/panel/host/commands/set-item-offline.jsx +109 -0
- premiere_cli/panel/host/commands/set-item-start-time.jsx +139 -0
- premiere_cli/panel/host/commands/set-keyframe-interpolation.jsx +186 -0
- premiere_cli/panel/host/commands/set-override-frame-rate.jsx +123 -0
- premiere_cli/panel/host/commands/set-override-pixel-aspect-ratio.jsx +129 -0
- premiere_cli/panel/host/commands/set-poster-frame.jsx +192 -0
- premiere_cli/panel/host/commands/set-project-panel-metadata.jsx +69 -0
- premiere_cli/panel/host/commands/set-scale-to-frame-size.jsx +101 -0
- premiere_cli/panel/host/commands/set-scale-width-height.jsx +140 -0
- premiere_cli/panel/host/commands/set-sequence-in-out.jsx +65 -0
- premiere_cli/panel/host/commands/set-sequence-settings.jsx +184 -0
- premiere_cli/panel/host/commands/set-source-in-out.jsx +98 -0
- premiere_cli/panel/host/commands/set-target-track.jsx +91 -0
- premiere_cli/panel/host/commands/set-time-interpolation.jsx +141 -0
- premiere_cli/panel/host/commands/set-track-mute.jsx +91 -0
- premiere_cli/panel/host/commands/set-track-visibility.jsx +94 -0
- premiere_cli/panel/host/commands/set-transcode-on-ingest.jsx +78 -0
- premiere_cli/panel/host/commands/set-uniform-scale.jsx +104 -0
- premiere_cli/panel/host/commands/set-work-area.jsx +76 -0
- premiere_cli/panel/host/commands/set-workspace.jsx +35 -0
- premiere_cli/panel/host/commands/set-xmp-metadata.jsx +157 -0
- premiere_cli/panel/host/commands/slide-edit.jsx +162 -0
- premiere_cli/panel/host/commands/slip-edit.jsx +167 -0
- premiere_cli/panel/host/commands/split-clip.jsx +144 -0
- premiere_cli/panel/host/commands/stabilize-clip.jsx +139 -0
- premiere_cli/panel/host/commands/stop-playback.jsx +23 -0
- premiere_cli/panel/host/commands/trim-clip.jsx +111 -0
- premiere_cli/panel/host/commands/undo.jsx +114 -0
- premiere_cli/panel/host/commands/unlink-selection.jsx +106 -0
- premiere_cli/panel/host/commands/unnest-sequence.jsx +207 -0
- premiere_cli/panel/host/commands/update-marker.jsx +120 -0
- premiere_cli/panel/host/index.jsx +1227 -0
- premiere_cli/panel/host/presets/default-4k-25fps.sqpreset +63 -0
- premiere_cli/panel/index.html +16 -0
- premiere_cli/panel/js/cs-interface.js +11 -0
- premiere_cli/panel/js/main.js +409 -0
- premiere_cli/panel_install.py +220 -0
- premiere_cli-0.2.0.dist-info/METADATA +127 -0
- premiere_cli-0.2.0.dist-info/RECORD +247 -0
- premiere_cli-0.2.0.dist-info/WHEEL +5 -0
- premiere_cli-0.2.0.dist-info/entry_points.txt +3 -0
- premiere_cli-0.2.0.dist-info/licenses/LICENSE +428 -0
- premiere_cli-0.2.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// Command: set-sequence-in-out → ppb_setSequenceInOut
|
|
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, trySetSequenceRange, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ported from leancoderkavy/premiere-pro-mcp's playhead.ts
|
|
7
|
+
// set_sequence_in_out_points. Sets the given (or active) sequence's
|
|
8
|
+
// in/out points (used for export range, etc.) — reuses the shared
|
|
9
|
+
// trySetSequenceRange() helper (seconds, then ticksString, then Time
|
|
10
|
+
// object) rather than a single-form seq.setInPoint()/setOutPoint() call,
|
|
11
|
+
// since PREMIERE_API_NOTES.md flags that call's argument type as
|
|
12
|
+
// disagreeing across the reference repos.
|
|
13
|
+
function ppb_setSequenceInOut(argsJson) {
|
|
14
|
+
try {
|
|
15
|
+
var args;
|
|
16
|
+
try {
|
|
17
|
+
args = JSON.parse(argsJson);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (typeof args.inSeconds !== "number" || isNaN(args.inSeconds) ||
|
|
23
|
+
typeof args.outSeconds !== "number" || isNaN(args.outSeconds)) {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "inSeconds and outSeconds (numbers) are both required" });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!app.project) {
|
|
28
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var seq = null;
|
|
32
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
33
|
+
seq = findSequenceByName(args.sequenceName);
|
|
34
|
+
if (!seq) {
|
|
35
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
36
|
+
}
|
|
37
|
+
} else {
|
|
38
|
+
seq = app.project.activeSequence;
|
|
39
|
+
if (!seq) {
|
|
40
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
var rangeResult = trySetSequenceRange(seq, args.inSeconds, args.outSeconds);
|
|
45
|
+
if (!rangeResult.ok) {
|
|
46
|
+
return JSON.stringify({
|
|
47
|
+
ok: false,
|
|
48
|
+
error: "could not set sequence in/out points with any known argument form",
|
|
49
|
+
attempts: rangeResult.attempts
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return JSON.stringify({
|
|
54
|
+
ok: true,
|
|
55
|
+
result: {
|
|
56
|
+
sequenceName: seq.name,
|
|
57
|
+
inSeconds: args.inSeconds,
|
|
58
|
+
outSeconds: args.outSeconds,
|
|
59
|
+
attempts: rangeResult.attempts
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// Command: set-sequence-settings → ppb_setSequenceSettings
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// getSequenceFps, TICKS_PER_SECOND, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// MERGES SEVEN reference tools into one command: leancoderkavy's
|
|
7
|
+
// sequence.ts set_sequence_settings (generic width/height) PLUS utility.ts's
|
|
8
|
+
// set_sequence_frame_rate, set_sequence_resolution, set_sequence_audio_settings
|
|
9
|
+
// (sample rate only — channel type is not exposed here), set_sequence_pixel_
|
|
10
|
+
// aspect_ratio (taken here as a numerator/denominator pair rather than a
|
|
11
|
+
// single ratio float, so callers don't have to pre-divide), set_sequence_
|
|
12
|
+
// field_type, and set_sequence_display_format (video format only). Any
|
|
13
|
+
// combination of frameRate/width/height/audioSampleRate/(parNumerator+
|
|
14
|
+
// parDenominator)/fieldType/displayFormat may be given; at least one is
|
|
15
|
+
// required.
|
|
16
|
+
//
|
|
17
|
+
// ⚠️ setSettings() UNRELIABILITY (PREMIERE_API_NOTES.md's "Settings write"
|
|
18
|
+
// line, and create-sequence.jsx's own comment): [leancoderkavy]/[ayushozha]
|
|
19
|
+
// claim getSettings()→mutate→setSettings() works, [hetpatel] says settings
|
|
20
|
+
// "cannot be changed after creation", and our own live create-sequence
|
|
21
|
+
// testing found non-default fps/resolution doesn't reliably apply. This
|
|
22
|
+
// command does NOT trust setSettings() not throwing as success — each
|
|
23
|
+
// requested field is individually verified by a FRESH getSettings() call
|
|
24
|
+
// after the write, exactly like create-sequence's settingsApplied/
|
|
25
|
+
// settingsFailed pattern, but per-field here (result.fields[name].applied).
|
|
26
|
+
function ppbSeqSettings_getFps(seq) {
|
|
27
|
+
try {
|
|
28
|
+
return getSequenceFps(seq);
|
|
29
|
+
} catch (e) {
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function ppb_setSequenceSettings(argsJson) {
|
|
35
|
+
try {
|
|
36
|
+
var args;
|
|
37
|
+
try {
|
|
38
|
+
args = JSON.parse(argsJson);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (!app.project) {
|
|
44
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
var seq;
|
|
48
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
49
|
+
seq = findSequenceByName(args.sequenceName);
|
|
50
|
+
if (!seq) {
|
|
51
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
52
|
+
}
|
|
53
|
+
} else {
|
|
54
|
+
seq = app.project.activeSequence;
|
|
55
|
+
if (!seq) {
|
|
56
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var hasFrameRate = typeof args.frameRate === "number";
|
|
61
|
+
var hasWidth = typeof args.width === "number";
|
|
62
|
+
var hasHeight = typeof args.height === "number";
|
|
63
|
+
var hasAudioSampleRate = typeof args.audioSampleRate === "number";
|
|
64
|
+
var hasParNum = typeof args.parNumerator === "number";
|
|
65
|
+
var hasParDen = typeof args.parDenominator === "number";
|
|
66
|
+
var hasFieldType = typeof args.fieldType === "number";
|
|
67
|
+
var hasDisplayFormat = typeof args.displayFormat === "number";
|
|
68
|
+
|
|
69
|
+
if (hasParNum !== hasParDen) {
|
|
70
|
+
return JSON.stringify({ ok: false, error: "parNumerator and parDenominator must be given together" });
|
|
71
|
+
}
|
|
72
|
+
var hasPar = hasParNum && hasParDen;
|
|
73
|
+
|
|
74
|
+
if (!hasFrameRate && !hasWidth && !hasHeight && !hasAudioSampleRate && !hasPar && !hasFieldType && !hasDisplayFormat) {
|
|
75
|
+
return JSON.stringify({
|
|
76
|
+
ok: false,
|
|
77
|
+
error: "at least one of frameRate, width, height, audioSampleRate, parNumerator+parDenominator, fieldType, displayFormat is required"
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var applied = [];
|
|
82
|
+
var failed = {};
|
|
83
|
+
var fields = {};
|
|
84
|
+
|
|
85
|
+
function applyOne(name, mutateFn, readFn, verifyFn) {
|
|
86
|
+
var previousValue = null;
|
|
87
|
+
try { previousValue = readFn(); } catch (e) { previousValue = null; }
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
var settings = seq.getSettings();
|
|
91
|
+
mutateFn(settings);
|
|
92
|
+
seq.setSettings(settings);
|
|
93
|
+
} catch (e) {
|
|
94
|
+
failed[name] = "setSettings() threw: " + e.toString();
|
|
95
|
+
fields[name] = { previousValue: previousValue, newValue: null, applied: false };
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var newValue = null;
|
|
100
|
+
try { newValue = readFn(); } catch (e) { newValue = null; }
|
|
101
|
+
|
|
102
|
+
var ok = false;
|
|
103
|
+
try { ok = verifyFn(newValue); } catch (e) { ok = false; }
|
|
104
|
+
|
|
105
|
+
fields[name] = { previousValue: previousValue, newValue: newValue, applied: ok };
|
|
106
|
+
if (ok) {
|
|
107
|
+
applied.push(name);
|
|
108
|
+
} else {
|
|
109
|
+
failed[name] = "setSettings() did not throw, but a fresh getSettings() read-back does not match the requested value — matches the documented setSettings() unreliability on this build";
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (hasFrameRate) {
|
|
114
|
+
applyOne(
|
|
115
|
+
"frameRate",
|
|
116
|
+
function (s) { s.videoFrameRate = TICKS_PER_SECOND / args.frameRate; },
|
|
117
|
+
function () { return ppbSeqSettings_getFps(seq); },
|
|
118
|
+
function (v) { return v !== null && Math.abs(v - args.frameRate) < 0.05; }
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
if (hasWidth) {
|
|
122
|
+
applyOne(
|
|
123
|
+
"width",
|
|
124
|
+
function (s) { s.videoFrameWidth = args.width; },
|
|
125
|
+
function () { return seq.getSettings().videoFrameWidth; },
|
|
126
|
+
function (v) { return v === args.width; }
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
if (hasHeight) {
|
|
130
|
+
applyOne(
|
|
131
|
+
"height",
|
|
132
|
+
function (s) { s.videoFrameHeight = args.height; },
|
|
133
|
+
function () { return seq.getSettings().videoFrameHeight; },
|
|
134
|
+
function (v) { return v === args.height; }
|
|
135
|
+
);
|
|
136
|
+
}
|
|
137
|
+
if (hasAudioSampleRate) {
|
|
138
|
+
applyOne(
|
|
139
|
+
"audioSampleRate",
|
|
140
|
+
function (s) { s.audioSampleRate = args.audioSampleRate; },
|
|
141
|
+
function () { return seq.getSettings().audioSampleRate; },
|
|
142
|
+
function (v) { return v === args.audioSampleRate; }
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
if (hasPar) {
|
|
146
|
+
var ratio = args.parNumerator / args.parDenominator;
|
|
147
|
+
applyOne(
|
|
148
|
+
"pixelAspectRatio",
|
|
149
|
+
function (s) { s.videoPixelAspectRatio = ratio; },
|
|
150
|
+
function () { return seq.getSettings().videoPixelAspectRatio; },
|
|
151
|
+
function (v) { return v !== null && Math.abs(v - ratio) < 0.001; }
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
if (hasFieldType) {
|
|
155
|
+
applyOne(
|
|
156
|
+
"fieldType",
|
|
157
|
+
function (s) { s.videoFieldType = args.fieldType; },
|
|
158
|
+
function () { return seq.getSettings().videoFieldType; },
|
|
159
|
+
function (v) { return v === args.fieldType; }
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
if (hasDisplayFormat) {
|
|
163
|
+
applyOne(
|
|
164
|
+
"displayFormat",
|
|
165
|
+
function (s) { s.videoDisplayFormat = args.displayFormat; },
|
|
166
|
+
function () { return seq.getSettings().videoDisplayFormat; },
|
|
167
|
+
function (v) { return v === args.displayFormat; }
|
|
168
|
+
);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return JSON.stringify({
|
|
172
|
+
ok: true,
|
|
173
|
+
result: {
|
|
174
|
+
sequenceName: seq.name,
|
|
175
|
+
applied: applied,
|
|
176
|
+
failed: failed,
|
|
177
|
+
fields: fields,
|
|
178
|
+
note: "merges 7 reference tools (set_sequence_settings + utility.ts's 6 individual setters) into one command — see the file header comment. Undo is non-functional on this build; previousValue per field is the only restoration path."
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
} catch (e) {
|
|
182
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
183
|
+
}
|
|
184
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
// Command: set-source-in-out → ppb_setSourceInOut
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — timeValueToSeconds is already
|
|
4
|
+
// defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ported from leancoderkavy's premiere-pro-mcp source-monitor.ts
|
|
7
|
+
// set_source_in_out. Sets in/out points on whatever project item is
|
|
8
|
+
// currently open in the Source Monitor via item.setInPoint()/
|
|
9
|
+
// setOutPoint(), mediaType 4 ("all") per the reference's own call —
|
|
10
|
+
// PREMIERE_API_NOTES.md documents mediaType as 1=video, 2=audio, 4=all.
|
|
11
|
+
//
|
|
12
|
+
// MUTATION RULE: previous in/out are read via item.getInPoint()/
|
|
13
|
+
// getOutPoint() before mutating (same accessor get-source-monitor-info
|
|
14
|
+
// uses), and the new values are read back afterward — verified is a
|
|
15
|
+
// tolerance-aware comparison against what was requested.
|
|
16
|
+
function ppb_setSourceInOut(argsJson) {
|
|
17
|
+
try {
|
|
18
|
+
var args;
|
|
19
|
+
try {
|
|
20
|
+
args = JSON.parse(argsJson);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var hasIn = typeof args.inSeconds === "number" && !isNaN(args.inSeconds);
|
|
26
|
+
var hasOut = typeof args.outSeconds === "number" && !isNaN(args.outSeconds);
|
|
27
|
+
if (!hasIn && !hasOut) {
|
|
28
|
+
return JSON.stringify({ ok: false, error: "at least one of inSeconds/outSeconds is required" });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
var item = null;
|
|
32
|
+
try {
|
|
33
|
+
item = app.sourceMonitor.getProjectItem();
|
|
34
|
+
} catch (e2) {
|
|
35
|
+
return JSON.stringify({ ok: false, error: "app.sourceMonitor.getProjectItem() failed: " + e2.toString() });
|
|
36
|
+
}
|
|
37
|
+
if (!item) {
|
|
38
|
+
return JSON.stringify({ ok: false, error: "no clip open in Source Monitor" });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var previousInSeconds = null;
|
|
42
|
+
var previousOutSeconds = null;
|
|
43
|
+
try { previousInSeconds = timeValueToSeconds(item.getInPoint()); } catch (e3) { previousInSeconds = null; }
|
|
44
|
+
try { previousOutSeconds = timeValueToSeconds(item.getOutPoint()); } catch (e4) { previousOutSeconds = null; }
|
|
45
|
+
|
|
46
|
+
var inSetError = null;
|
|
47
|
+
var outSetError = null;
|
|
48
|
+
|
|
49
|
+
if (hasIn) {
|
|
50
|
+
try {
|
|
51
|
+
var inTime = new Time();
|
|
52
|
+
inTime.seconds = args.inSeconds;
|
|
53
|
+
item.setInPoint(inTime.ticks, 4);
|
|
54
|
+
} catch (e5) {
|
|
55
|
+
inSetError = e5.toString();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (hasOut) {
|
|
60
|
+
try {
|
|
61
|
+
var outTime = new Time();
|
|
62
|
+
outTime.seconds = args.outSeconds;
|
|
63
|
+
item.setOutPoint(outTime.ticks, 4);
|
|
64
|
+
} catch (e6) {
|
|
65
|
+
outSetError = e6.toString();
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
var newInSeconds = null;
|
|
70
|
+
var newOutSeconds = null;
|
|
71
|
+
try { newInSeconds = timeValueToSeconds(item.getInPoint()); } catch (e7) { newInSeconds = null; }
|
|
72
|
+
try { newOutSeconds = timeValueToSeconds(item.getOutPoint()); } catch (e8) { newOutSeconds = null; }
|
|
73
|
+
|
|
74
|
+
var tolerance = 0.05;
|
|
75
|
+
var inVerified = !hasIn || (inSetError === null && newInSeconds !== null && Math.abs(newInSeconds - args.inSeconds) <= tolerance);
|
|
76
|
+
var outVerified = !hasOut || (outSetError === null && newOutSeconds !== null && Math.abs(newOutSeconds - args.outSeconds) <= tolerance);
|
|
77
|
+
|
|
78
|
+
return JSON.stringify({
|
|
79
|
+
ok: true,
|
|
80
|
+
result: {
|
|
81
|
+
item: (function () { try { return item.name; } catch (e) { return null; } })(),
|
|
82
|
+
inSet: hasIn,
|
|
83
|
+
outSet: hasOut,
|
|
84
|
+
previousInSeconds: previousInSeconds,
|
|
85
|
+
previousOutSeconds: previousOutSeconds,
|
|
86
|
+
requestedInSeconds: hasIn ? args.inSeconds : null,
|
|
87
|
+
requestedOutSeconds: hasOut ? args.outSeconds : null,
|
|
88
|
+
newInSeconds: newInSeconds,
|
|
89
|
+
newOutSeconds: newOutSeconds,
|
|
90
|
+
inSetError: inSetError,
|
|
91
|
+
outSetError: outSetError,
|
|
92
|
+
verified: inVerified && outVerified
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
} catch (e) {
|
|
96
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Command: set-target-track → ppb_setTargetTrack
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM mutation. Ported from leancoderkavy's premiere-pro-mcp
|
|
7
|
+
// `set_target_track` tool (track-targeting.ts): track.setTargeted(targeted,
|
|
8
|
+
// isVideoBool) — only one video and one audio track can be targeted at a
|
|
9
|
+
// time, per Premiere's own UI behavior (targeting one track un-targets any
|
|
10
|
+
// other track of the same type; this command does not do that itself, it
|
|
11
|
+
// relies on Premiere's own setTargeted() semantics). Verified by reading
|
|
12
|
+
// isTargeted() back.
|
|
13
|
+
function ppb_setTargetTrack(argsJson) {
|
|
14
|
+
try {
|
|
15
|
+
var args;
|
|
16
|
+
try {
|
|
17
|
+
args = JSON.parse(argsJson);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
23
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
24
|
+
}
|
|
25
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
26
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
27
|
+
}
|
|
28
|
+
if (typeof args.targeted !== "boolean") {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "targeted must be a boolean" });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!app.project) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var seq = null;
|
|
37
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
38
|
+
seq = findSequenceByName(args.sequenceName);
|
|
39
|
+
if (!seq) {
|
|
40
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
seq = app.project.activeSequence;
|
|
44
|
+
if (!seq) {
|
|
45
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
50
|
+
var numTracks = trackCollection.numTracks;
|
|
51
|
+
if (args.trackIndex >= numTracks) {
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
ok: false,
|
|
54
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var track = trackCollection[args.trackIndex];
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
track.setTargeted(args.targeted, args.trackType === "video");
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return JSON.stringify({ ok: false, error: "track.setTargeted() failed: " + e.toString() });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var isTargetedNow = null;
|
|
67
|
+
try {
|
|
68
|
+
isTargetedNow = track.isTargeted();
|
|
69
|
+
} catch (e) {
|
|
70
|
+
isTargetedNow = null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var result = {
|
|
74
|
+
sequenceName: seq.name,
|
|
75
|
+
trackType: args.trackType,
|
|
76
|
+
trackIndex: args.trackIndex,
|
|
77
|
+
trackName: null,
|
|
78
|
+
requestedTargeted: args.targeted,
|
|
79
|
+
isTargeted: isTargetedNow
|
|
80
|
+
};
|
|
81
|
+
try { result.trackName = track.name; } catch (e) { result.trackName = null; }
|
|
82
|
+
|
|
83
|
+
if (isTargetedNow !== null && isTargetedNow !== args.targeted) {
|
|
84
|
+
result.warning = "isTargeted() read back " + isTargetedNow + " after requesting " + args.targeted + " — mutation may not have taken effect";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return JSON.stringify({ ok: true, result: result });
|
|
88
|
+
} catch (e) {
|
|
89
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
90
|
+
}
|
|
91
|
+
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Command: set-time-interpolation → ppb_setTimeInterpolation
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// ensureQEEnabled, activateSequenceForQE, qeFindNthNonEmptyClip, ...) are
|
|
5
|
+
// already defined there.
|
|
6
|
+
//
|
|
7
|
+
// QE DOM mutation — `qeClip.setTimeInterpolationType(0|1|2)` per
|
|
8
|
+
// PREMIERE_API_NOTES.md ("Interp/blend" line: 0=sampling, 1=blending,
|
|
9
|
+
// 2=optical flow) and leancoderkavy's `set_time_interpolation` tool
|
|
10
|
+
// (advanced.ts). Same QE clip-addressing care as set-frame-blend: the
|
|
11
|
+
// resolved sequence is activated first, and the standard-DOM clipIndex is
|
|
12
|
+
// mapped to the Nth non-"Empty" QE item via qeFindNthNonEmptyClip (QE
|
|
13
|
+
// track item lists interleave gap items the standard DOM doesn't expose).
|
|
14
|
+
function ppb_setTimeInterpolation(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 (args.type !== 0 && args.type !== 1 && args.type !== 2) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "type must be 0 (sampling), 1 (blending), or 2 (optical flow)" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!app.project) {
|
|
37
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var seq = null;
|
|
41
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
42
|
+
seq = findSequenceByName(args.sequenceName);
|
|
43
|
+
if (!seq) {
|
|
44
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
seq = app.project.activeSequence;
|
|
48
|
+
if (!seq) {
|
|
49
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
54
|
+
var numTracks = trackCollection.numTracks;
|
|
55
|
+
if (args.trackIndex >= numTracks) {
|
|
56
|
+
return JSON.stringify({
|
|
57
|
+
ok: false,
|
|
58
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
var numClips = trackCollection[args.trackIndex].clips.numItems;
|
|
62
|
+
if (args.clipIndex >= numClips) {
|
|
63
|
+
return JSON.stringify({
|
|
64
|
+
ok: false,
|
|
65
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
var standardClipName = null;
|
|
69
|
+
try { standardClipName = trackCollection[args.trackIndex].clips[args.clipIndex].name; } catch (e) { standardClipName = null; }
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
ensureQEEnabled();
|
|
73
|
+
activateSequenceForQE(seq);
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return JSON.stringify({ ok: false, error: "app.enableQE()/sequence activation failed: " + e.toString() });
|
|
76
|
+
}
|
|
77
|
+
if (typeof qe === "undefined" || !qe.project) {
|
|
78
|
+
return JSON.stringify({ ok: false, error: "QE DOM not available after enableQE()" });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
var qeSeq;
|
|
82
|
+
try {
|
|
83
|
+
qeSeq = qe.project.getActiveSequence();
|
|
84
|
+
} catch (e) {
|
|
85
|
+
return JSON.stringify({ ok: false, error: "qe.project.getActiveSequence() failed: " + e.toString() });
|
|
86
|
+
}
|
|
87
|
+
var qeTrack;
|
|
88
|
+
try {
|
|
89
|
+
qeTrack = args.trackType === "video" ? qeSeq.getVideoTrackAt(args.trackIndex) : qeSeq.getAudioTrackAt(args.trackIndex);
|
|
90
|
+
} catch (e) {
|
|
91
|
+
return JSON.stringify({ ok: false, error: "QE track lookup failed: " + e.toString() });
|
|
92
|
+
}
|
|
93
|
+
if (!qeTrack) {
|
|
94
|
+
return JSON.stringify({ ok: false, error: "QE track not found at index " + args.trackIndex });
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
var qeClip;
|
|
98
|
+
try {
|
|
99
|
+
qeClip = qeFindNthNonEmptyClip(qeTrack, args.clipIndex);
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return JSON.stringify({ ok: false, error: "QE clip lookup failed: " + e.toString() });
|
|
102
|
+
}
|
|
103
|
+
if (!qeClip) {
|
|
104
|
+
return JSON.stringify({ ok: false, error: "could not locate the corresponding non-Empty QE clip at clipIndex " + args.clipIndex });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var typeNames = ["sampling", "blending", "optical-flow"];
|
|
108
|
+
|
|
109
|
+
var previousValue = null;
|
|
110
|
+
try { previousValue = qeClip.timeInterpolationType; } catch (e) { previousValue = null; }
|
|
111
|
+
|
|
112
|
+
try {
|
|
113
|
+
qeClip.setTimeInterpolationType(args.type);
|
|
114
|
+
} catch (e) {
|
|
115
|
+
return JSON.stringify({ ok: false, error: "qeClip.setTimeInterpolationType() failed: " + e.toString() });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
var newValue = null;
|
|
119
|
+
try { newValue = qeClip.timeInterpolationType; } catch (e) { newValue = null; }
|
|
120
|
+
|
|
121
|
+
var result = {
|
|
122
|
+
sequenceName: seq.name,
|
|
123
|
+
trackType: args.trackType,
|
|
124
|
+
trackIndex: args.trackIndex,
|
|
125
|
+
clipIndex: args.clipIndex,
|
|
126
|
+
clipName: standardClipName,
|
|
127
|
+
requestedValue: args.type,
|
|
128
|
+
requestedValueName: typeNames[args.type],
|
|
129
|
+
previousValue: previousValue,
|
|
130
|
+
newValue: newValue,
|
|
131
|
+
verified: newValue === args.type
|
|
132
|
+
};
|
|
133
|
+
if (newValue === null) {
|
|
134
|
+
result.note = "qeClip.timeInterpolationType was not readable on this build — setTimeInterpolationType() did not throw, but the result is unverified.";
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return JSON.stringify({ ok: true, result: result });
|
|
138
|
+
} catch (e) {
|
|
139
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
// Command: set-track-mute → ppb_setTrackMute
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ported from leancoderkavy's premiere-pro-mcp `mute_track` tool
|
|
7
|
+
// (audio.ts) — renamed here from a bare "mute" toggle to an explicit
|
|
8
|
+
// "set" (muted: bool) for idempotence. Generalized to accept trackType
|
|
9
|
+
// video|audio (the reference only muted audio tracks); track.setMute() is
|
|
10
|
+
// not audio-specific — see also set-track-visibility, which uses the same
|
|
11
|
+
// call on video tracks for a different semantic purpose. Verified by
|
|
12
|
+
// reading isMuted() back.
|
|
13
|
+
function ppb_setTrackMute(argsJson) {
|
|
14
|
+
try {
|
|
15
|
+
var args;
|
|
16
|
+
try {
|
|
17
|
+
args = JSON.parse(argsJson);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
23
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
24
|
+
}
|
|
25
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
26
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
27
|
+
}
|
|
28
|
+
if (typeof args.muted !== "boolean") {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "muted must be a boolean" });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (!app.project) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var seq = null;
|
|
37
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
38
|
+
seq = findSequenceByName(args.sequenceName);
|
|
39
|
+
if (!seq) {
|
|
40
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
41
|
+
}
|
|
42
|
+
} else {
|
|
43
|
+
seq = app.project.activeSequence;
|
|
44
|
+
if (!seq) {
|
|
45
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
50
|
+
var numTracks = trackCollection.numTracks;
|
|
51
|
+
if (args.trackIndex >= numTracks) {
|
|
52
|
+
return JSON.stringify({
|
|
53
|
+
ok: false,
|
|
54
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
var track = trackCollection[args.trackIndex];
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
track.setMute(args.muted ? 1 : 0);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return JSON.stringify({ ok: false, error: "track.setMute() failed: " + e.toString() });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var isMutedNow = null;
|
|
67
|
+
try {
|
|
68
|
+
isMutedNow = track.isMuted();
|
|
69
|
+
} catch (e) {
|
|
70
|
+
isMutedNow = null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var result = {
|
|
74
|
+
sequenceName: seq.name,
|
|
75
|
+
trackType: args.trackType,
|
|
76
|
+
trackIndex: args.trackIndex,
|
|
77
|
+
trackName: null,
|
|
78
|
+
requestedMuted: args.muted,
|
|
79
|
+
isMuted: isMutedNow
|
|
80
|
+
};
|
|
81
|
+
try { result.trackName = track.name; } catch (e) { result.trackName = null; }
|
|
82
|
+
|
|
83
|
+
if (isMutedNow !== null && isMutedNow !== args.muted) {
|
|
84
|
+
result.warning = "isMuted() read back " + isMutedNow + " after requesting " + args.muted + " — mutation may not have taken effect";
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return JSON.stringify({ ok: true, result: result });
|
|
88
|
+
} catch (e) {
|
|
89
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
90
|
+
}
|
|
91
|
+
}
|