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,129 @@
|
|
|
1
|
+
// Command: get-effect-properties → ppb_getEffectProperties
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findClipComponent, findComponentProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM only — no QE needed. Ported from leancoderkavy's
|
|
7
|
+
// premiere-pro-mcp `get_effect_properties` tool (keyframes.ts), addressed
|
|
8
|
+
// here by trackType/trackIndex/clipIndex + componentName (same convention
|
|
9
|
+
// as get-full-clip-info) instead of node_id/effect_name. Unlike
|
|
10
|
+
// get-full-clip-info's per-clip component summary (capped, values
|
|
11
|
+
// truncated), this reads ALL properties of ONE named component, uncapped.
|
|
12
|
+
// componentName is matched generically against BOTH matchName and
|
|
13
|
+
// displayName via the shared findClipComponent() helper — this is not
|
|
14
|
+
// hardcoded to Motion/Opacity like the wave-3 transform setters.
|
|
15
|
+
function ppb_getEffectProperties(argsJson) {
|
|
16
|
+
try {
|
|
17
|
+
var args;
|
|
18
|
+
try {
|
|
19
|
+
args = JSON.parse(argsJson);
|
|
20
|
+
} catch (e) {
|
|
21
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
25
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
26
|
+
}
|
|
27
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
28
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
29
|
+
}
|
|
30
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
31
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
32
|
+
}
|
|
33
|
+
if (typeof args.componentName !== "string" || !args.componentName) {
|
|
34
|
+
return JSON.stringify({ ok: false, error: "componentName is required" });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!app.project) {
|
|
38
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var seq = null;
|
|
42
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
43
|
+
seq = findSequenceByName(args.sequenceName);
|
|
44
|
+
if (!seq) {
|
|
45
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
seq = app.project.activeSequence;
|
|
49
|
+
if (!seq) {
|
|
50
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
55
|
+
var numTracks = trackCollection.numTracks;
|
|
56
|
+
if (args.trackIndex >= numTracks) {
|
|
57
|
+
return JSON.stringify({
|
|
58
|
+
ok: false,
|
|
59
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var track = trackCollection[args.trackIndex];
|
|
64
|
+
var numClips = track.clips.numItems;
|
|
65
|
+
if (args.clipIndex >= numClips) {
|
|
66
|
+
return JSON.stringify({
|
|
67
|
+
ok: false,
|
|
68
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var clip = track.clips[args.clipIndex];
|
|
73
|
+
var clipName = null;
|
|
74
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
75
|
+
|
|
76
|
+
var comp = findClipComponent(clip, [args.componentName], [args.componentName]);
|
|
77
|
+
if (!comp) {
|
|
78
|
+
return JSON.stringify({
|
|
79
|
+
ok: false,
|
|
80
|
+
error: "component \"" + args.componentName + "\" not found on clip (matched against matchName and displayName)"
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var compDisplayName = null;
|
|
85
|
+
var compMatchName = null;
|
|
86
|
+
try { compDisplayName = comp.displayName; } catch (e) { compDisplayName = null; }
|
|
87
|
+
try { compMatchName = comp.matchName; } catch (e) { compMatchName = null; }
|
|
88
|
+
|
|
89
|
+
var numProps = 0;
|
|
90
|
+
try { numProps = comp.properties.numItems; } catch (e) { numProps = 0; }
|
|
91
|
+
|
|
92
|
+
var properties = [];
|
|
93
|
+
for (var p = 0; p < numProps; p++) {
|
|
94
|
+
var prop = comp.properties[p];
|
|
95
|
+
var info = { displayName: null, value: null, isTimeVarying: null, keyCount: null };
|
|
96
|
+
try { info.displayName = prop.displayName; } catch (e1) { info.displayName = null; }
|
|
97
|
+
try { info.value = prop.getValue(); } catch (e2) { info.value = null; }
|
|
98
|
+
try { info.isTimeVarying = prop.isTimeVarying(); } catch (e3) { info.isTimeVarying = null; }
|
|
99
|
+
try {
|
|
100
|
+
if (info.isTimeVarying) {
|
|
101
|
+
var keys = prop.getKeys();
|
|
102
|
+
info.keyCount = keys ? keys.length : 0;
|
|
103
|
+
} else {
|
|
104
|
+
info.keyCount = 0;
|
|
105
|
+
}
|
|
106
|
+
} catch (e4) {
|
|
107
|
+
info.keyCount = null;
|
|
108
|
+
}
|
|
109
|
+
properties.push(info);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return JSON.stringify({
|
|
113
|
+
ok: true,
|
|
114
|
+
result: {
|
|
115
|
+
sequenceName: seq.name,
|
|
116
|
+
trackType: args.trackType,
|
|
117
|
+
trackIndex: args.trackIndex,
|
|
118
|
+
clipIndex: args.clipIndex,
|
|
119
|
+
clipName: clipName,
|
|
120
|
+
componentName: compDisplayName,
|
|
121
|
+
matchName: compMatchName,
|
|
122
|
+
properties: properties,
|
|
123
|
+
propertyCount: properties.length
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
// Command: get-encoder-presets → ppb_getEncoderPresets
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use.
|
|
3
|
+
//
|
|
4
|
+
// PREMIERE_API_NOTES.md flags `app.encoder.getExporters()` →
|
|
5
|
+
// `.getPresets()` as an unconfirmed API surface ([ayushozha] uses it, the
|
|
6
|
+
// other two repos scan .epr files on disk instead). We probe the live-API
|
|
7
|
+
// route only (no filesystem scanning) with a try/catch around every single
|
|
8
|
+
// field access, so an unsupported build reports an honest
|
|
9
|
+
// {"available": false} rather than throwing or guessing preset paths.
|
|
10
|
+
// Ported (loosely) from leancoderkavy's premiere-pro-mcp
|
|
11
|
+
// `get_encoder_presets` tool (track-targeting.ts), which instead walks
|
|
12
|
+
// .epr files on disk — not attempted here, see the note above.
|
|
13
|
+
|
|
14
|
+
function ppb_getEncoderPresets(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
|
+
var result = { available: false, presets: [], count: 0 };
|
|
24
|
+
|
|
25
|
+
var encoder = null;
|
|
26
|
+
try {
|
|
27
|
+
encoder = app.encoder;
|
|
28
|
+
} catch (e) {
|
|
29
|
+
encoder = null;
|
|
30
|
+
}
|
|
31
|
+
if (!encoder) {
|
|
32
|
+
result.error = "app.encoder is not available on this Premiere build";
|
|
33
|
+
return JSON.stringify({ ok: true, result: result });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
var exporters = null;
|
|
37
|
+
try {
|
|
38
|
+
exporters = encoder.getExporters();
|
|
39
|
+
} catch (e) {
|
|
40
|
+
result.error = "app.encoder.getExporters() failed: " + e.toString();
|
|
41
|
+
return JSON.stringify({ ok: true, result: result });
|
|
42
|
+
}
|
|
43
|
+
if (!exporters) {
|
|
44
|
+
result.error = "app.encoder.getExporters() returned nothing";
|
|
45
|
+
return JSON.stringify({ ok: true, result: result });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var numExporters = 0;
|
|
49
|
+
try {
|
|
50
|
+
numExporters = typeof exporters.numItems === "number" ? exporters.numItems : exporters.length;
|
|
51
|
+
} catch (e) {
|
|
52
|
+
numExporters = 0;
|
|
53
|
+
}
|
|
54
|
+
if (typeof numExporters !== "number" || isNaN(numExporters)) {
|
|
55
|
+
numExporters = 0;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
result.available = true;
|
|
59
|
+
result.exportersCount = numExporters;
|
|
60
|
+
|
|
61
|
+
for (var i = 0; i < numExporters; i++) {
|
|
62
|
+
var exporter = null;
|
|
63
|
+
try {
|
|
64
|
+
exporter = exporters[i];
|
|
65
|
+
} catch (e) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!exporter) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var exporterName = null;
|
|
73
|
+
try { exporterName = exporter.name; } catch (e) { exporterName = null; }
|
|
74
|
+
|
|
75
|
+
var presetsForExporter = null;
|
|
76
|
+
try {
|
|
77
|
+
presetsForExporter = exporter.getPresets();
|
|
78
|
+
} catch (e) {
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (!presetsForExporter) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
var numPresets = 0;
|
|
86
|
+
try {
|
|
87
|
+
numPresets = typeof presetsForExporter.numItems === "number" ? presetsForExporter.numItems : presetsForExporter.length;
|
|
88
|
+
} catch (e) {
|
|
89
|
+
numPresets = 0;
|
|
90
|
+
}
|
|
91
|
+
if (typeof numPresets !== "number" || isNaN(numPresets)) {
|
|
92
|
+
numPresets = 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
for (var p = 0; p < numPresets; p++) {
|
|
96
|
+
var preset = null;
|
|
97
|
+
try {
|
|
98
|
+
preset = presetsForExporter[p];
|
|
99
|
+
} catch (e) {
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (!preset) {
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
var entry = { exporterName: exporterName, name: null, path: null };
|
|
106
|
+
try { entry.name = preset.name; } catch (e) { entry.name = null; }
|
|
107
|
+
try { entry.path = preset.path; } catch (e) { entry.path = null; }
|
|
108
|
+
result.presets.push(entry);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (args.format && typeof args.format === "string") {
|
|
113
|
+
var needle = args.format.toLowerCase();
|
|
114
|
+
var filtered = [];
|
|
115
|
+
for (var f = 0; f < result.presets.length; f++) {
|
|
116
|
+
var entryName = (result.presets[f].name || "").toLowerCase();
|
|
117
|
+
var entryExporter = (result.presets[f].exporterName || "").toLowerCase();
|
|
118
|
+
if (entryName.indexOf(needle) !== -1 || entryExporter.indexOf(needle) !== -1) {
|
|
119
|
+
filtered.push(result.presets[f]);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
result.presets = filtered;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
result.count = result.presets.length;
|
|
126
|
+
|
|
127
|
+
return JSON.stringify({ ok: true, result: result });
|
|
128
|
+
} catch (e) {
|
|
129
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
130
|
+
}
|
|
131
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Command: get-export-file-extension → ppb_getExportFileExtension
|
|
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/premiere-pro-mcp's sequence.ts
|
|
7
|
+
// get_export_file_extension. Standard DOM only — no QE needed.
|
|
8
|
+
function ppb_getExportFileExtension(argsJson) {
|
|
9
|
+
try {
|
|
10
|
+
var args;
|
|
11
|
+
try {
|
|
12
|
+
args = JSON.parse(argsJson);
|
|
13
|
+
} catch (e) {
|
|
14
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (typeof args.presetPath !== "string" || args.presetPath.length === 0) {
|
|
18
|
+
return JSON.stringify({ ok: false, error: "presetPath (string) is required" });
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (!app.project) {
|
|
22
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var seq = null;
|
|
26
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
27
|
+
seq = findSequenceByName(args.sequenceName);
|
|
28
|
+
if (!seq) {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
seq = app.project.activeSequence;
|
|
33
|
+
if (!seq) {
|
|
34
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
var extension = null;
|
|
39
|
+
try {
|
|
40
|
+
extension = seq.getExportFileExtension(args.presetPath);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return JSON.stringify({ ok: false, error: "could not read export file extension: " + e.toString() });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return JSON.stringify({
|
|
46
|
+
ok: true,
|
|
47
|
+
result: {
|
|
48
|
+
sequenceName: seq.name,
|
|
49
|
+
presetPath: args.presetPath,
|
|
50
|
+
extension: extension
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
} catch (e) {
|
|
54
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
// Command: get-footage-interpretation → ppb_getFootageInterpretation
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context.
|
|
4
|
+
//
|
|
5
|
+
// Project-item addressing: at least one of nodeId/name is required (see
|
|
6
|
+
// get-item-metadata.jsx for the shared design note — the resolver is
|
|
7
|
+
// duplicated per-file since command files load independently).
|
|
8
|
+
|
|
9
|
+
function ppbFindItemGetFootageInterp_walk(item, args, depth) {
|
|
10
|
+
if (depth > 32) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
var isBin = false;
|
|
15
|
+
try {
|
|
16
|
+
isBin = typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
isBin = false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var matched = false;
|
|
22
|
+
if (args.nodeId !== null) {
|
|
23
|
+
try { matched = item.nodeId === args.nodeId; } catch (e) { matched = false; }
|
|
24
|
+
} else if (args.name !== null) {
|
|
25
|
+
try { matched = item.name === args.name; } catch (e) { matched = false; }
|
|
26
|
+
}
|
|
27
|
+
if (matched) {
|
|
28
|
+
return item;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (isBin && item.children) {
|
|
32
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
33
|
+
var found = ppbFindItemGetFootageInterp_walk(item.children[i], args, depth + 1);
|
|
34
|
+
if (found) {
|
|
35
|
+
return found;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
function ppbFindItemGetFootageInterp_resolve(args) {
|
|
43
|
+
var root = app.project.rootItem;
|
|
44
|
+
for (var i = 0; i < root.children.numItems; i++) {
|
|
45
|
+
var found = ppbFindItemGetFootageInterp_walk(root.children[i], args, 1);
|
|
46
|
+
if (found) {
|
|
47
|
+
return found;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function ppb_getFootageInterpretation(argsJson) {
|
|
54
|
+
try {
|
|
55
|
+
var args;
|
|
56
|
+
try {
|
|
57
|
+
args = JSON.parse(argsJson);
|
|
58
|
+
} catch (e) {
|
|
59
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
|
|
63
|
+
var hasName = typeof args.name === "string" && args.name.length > 0;
|
|
64
|
+
if (!hasNodeId && !hasName) {
|
|
65
|
+
return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (!app.project) {
|
|
69
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
var item = ppbFindItemGetFootageInterp_resolve({
|
|
73
|
+
nodeId: hasNodeId ? args.nodeId : null,
|
|
74
|
+
name: hasNodeId ? null : args.name
|
|
75
|
+
});
|
|
76
|
+
if (!item) {
|
|
77
|
+
return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
var interp = null;
|
|
81
|
+
try {
|
|
82
|
+
interp = item.getFootageInterpretation();
|
|
83
|
+
} catch (e) {
|
|
84
|
+
return JSON.stringify({ ok: false, error: "getFootageInterpretation() failed: " + e.toString() });
|
|
85
|
+
}
|
|
86
|
+
if (!interp) {
|
|
87
|
+
return JSON.stringify({ ok: false, error: "no footage interpretation available for this item" });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
var result = {
|
|
91
|
+
name: null,
|
|
92
|
+
nodeId: null,
|
|
93
|
+
alphaUsage: null,
|
|
94
|
+
fieldType: null,
|
|
95
|
+
frameRate: null,
|
|
96
|
+
ignoreAlpha: null,
|
|
97
|
+
invertAlpha: null,
|
|
98
|
+
pixelAspectRatio: null
|
|
99
|
+
};
|
|
100
|
+
try { result.name = item.name; } catch (e) { result.name = null; }
|
|
101
|
+
try { result.nodeId = item.nodeId; } catch (e) { result.nodeId = null; }
|
|
102
|
+
try { result.alphaUsage = interp.alphaUsage; } catch (e) { result.alphaUsage = null; }
|
|
103
|
+
try { result.fieldType = interp.fieldType; } catch (e) { result.fieldType = null; }
|
|
104
|
+
try { result.frameRate = interp.frameRate; } catch (e) { result.frameRate = null; }
|
|
105
|
+
try { result.ignoreAlpha = interp.ignoreAlpha; } catch (e) { result.ignoreAlpha = null; }
|
|
106
|
+
try { result.invertAlpha = interp.invertAlpha; } catch (e) { result.invertAlpha = null; }
|
|
107
|
+
try { result.pixelAspectRatio = interp.pixelAspectRatio; } catch (e) { result.pixelAspectRatio = null; }
|
|
108
|
+
|
|
109
|
+
return JSON.stringify({ ok: true, result: result });
|
|
110
|
+
} catch (e) {
|
|
111
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// Command: get-full-clip-info → ppb_getFullClipInfo
|
|
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, serializeTrackItem, timeValueToSeconds, ...) are
|
|
5
|
+
// already defined there.
|
|
6
|
+
//
|
|
7
|
+
// Standard-DOM read only (seq.videoTracks[i].clips[j]) — no QE DOM needed,
|
|
8
|
+
// no need to activate the sequence tab.
|
|
9
|
+
|
|
10
|
+
var GET_FULL_CLIP_INFO_MAX_COMPONENTS = 50;
|
|
11
|
+
var GET_FULL_CLIP_INFO_MAX_PROPERTIES = 100;
|
|
12
|
+
|
|
13
|
+
function ppb_serializePropertyForFullClipInfo(prop) {
|
|
14
|
+
var out = { displayName: null, value: null, isTimeVarying: null, keyCount: null };
|
|
15
|
+
|
|
16
|
+
try { out.displayName = prop.displayName; } catch (e) { out.displayName = null; }
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
var raw = prop.getValue();
|
|
20
|
+
var str = String(raw);
|
|
21
|
+
out.value = str.length > 200 ? str.substring(0, 200) : str;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
out.value = null;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
out.isTimeVarying = prop.isTimeVarying();
|
|
28
|
+
} catch (e) {
|
|
29
|
+
out.isTimeVarying = null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (out.isTimeVarying === true) {
|
|
33
|
+
try {
|
|
34
|
+
out.keyCount = prop.getKeys().length;
|
|
35
|
+
} catch (e) {
|
|
36
|
+
out.keyCount = null;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return out;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function ppb_serializeComponentForFullClipInfo(comp) {
|
|
44
|
+
var out = { displayName: null, matchName: null, enabled: null, properties: [] };
|
|
45
|
+
|
|
46
|
+
try { out.displayName = comp.displayName; } catch (e) { out.displayName = null; }
|
|
47
|
+
try { out.matchName = comp.matchName; } catch (e) { out.matchName = null; }
|
|
48
|
+
try { out.enabled = comp.enabled; } catch (e) { out.enabled = null; }
|
|
49
|
+
|
|
50
|
+
try {
|
|
51
|
+
var numProps = comp.properties.numItems;
|
|
52
|
+
var cap = numProps > GET_FULL_CLIP_INFO_MAX_PROPERTIES ? GET_FULL_CLIP_INFO_MAX_PROPERTIES : numProps;
|
|
53
|
+
for (var p = 0; p < cap; p++) {
|
|
54
|
+
out.properties.push(ppb_serializePropertyForFullClipInfo(comp.properties[p]));
|
|
55
|
+
}
|
|
56
|
+
if (numProps > GET_FULL_CLIP_INFO_MAX_PROPERTIES) {
|
|
57
|
+
out.truncated = true;
|
|
58
|
+
}
|
|
59
|
+
} catch (e) {
|
|
60
|
+
// leave properties as whatever was collected so far
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return out;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function ppb_serializeComponentsForFullClipInfo(clip) {
|
|
67
|
+
var components = [];
|
|
68
|
+
var truncated = false;
|
|
69
|
+
try {
|
|
70
|
+
var numComponents = clip.components.numItems;
|
|
71
|
+
var cap = numComponents > GET_FULL_CLIP_INFO_MAX_COMPONENTS ? GET_FULL_CLIP_INFO_MAX_COMPONENTS : numComponents;
|
|
72
|
+
for (var i = 0; i < cap; i++) {
|
|
73
|
+
components.push(ppb_serializeComponentForFullClipInfo(clip.components[i]));
|
|
74
|
+
}
|
|
75
|
+
if (numComponents > GET_FULL_CLIP_INFO_MAX_COMPONENTS) {
|
|
76
|
+
truncated = true;
|
|
77
|
+
}
|
|
78
|
+
} catch (e) {
|
|
79
|
+
// leave components as whatever was collected so far
|
|
80
|
+
}
|
|
81
|
+
return { components: components, truncated: truncated };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function ppb_getFullClipInfo(argsJson) {
|
|
85
|
+
try {
|
|
86
|
+
var args;
|
|
87
|
+
try {
|
|
88
|
+
args = JSON.parse(argsJson);
|
|
89
|
+
} catch (e) {
|
|
90
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
94
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
95
|
+
}
|
|
96
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
97
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
98
|
+
}
|
|
99
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
100
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (!app.project) {
|
|
104
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var seq = null;
|
|
108
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
109
|
+
seq = findSequenceByName(args.sequenceName);
|
|
110
|
+
if (!seq) {
|
|
111
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
seq = app.project.activeSequence;
|
|
115
|
+
if (!seq) {
|
|
116
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
121
|
+
var numTracks = trackCollection.numTracks;
|
|
122
|
+
if (args.trackIndex >= numTracks) {
|
|
123
|
+
return JSON.stringify({
|
|
124
|
+
ok: false,
|
|
125
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
var track = trackCollection[args.trackIndex];
|
|
130
|
+
var numClips = track.clips.numItems;
|
|
131
|
+
if (args.clipIndex >= numClips) {
|
|
132
|
+
return JSON.stringify({
|
|
133
|
+
ok: false,
|
|
134
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var clip = track.clips[args.clipIndex];
|
|
139
|
+
|
|
140
|
+
var result = serializeTrackItem(clip, args.trackIndex, args.clipIndex);
|
|
141
|
+
|
|
142
|
+
try { result.type = clip.type; } catch (e) { result.type = null; }
|
|
143
|
+
try { result.speed = clip.getSpeed(); } catch (e) { result.speed = null; }
|
|
144
|
+
try { result.isSpeedReversed = clip.isSpeedReversed(); } catch (e) { result.isSpeedReversed = null; }
|
|
145
|
+
try { result.linkedItemsCount = clip.getLinkedItems().numItems; } catch (e) { result.linkedItemsCount = null; }
|
|
146
|
+
|
|
147
|
+
result.projectItem = { name: null, treePath: null, nodeId: null };
|
|
148
|
+
try { result.projectItem.name = clip.projectItem.name; } catch (e) { result.projectItem.name = null; }
|
|
149
|
+
try { result.projectItem.treePath = clip.projectItem.treePath; } catch (e) { result.projectItem.treePath = null; }
|
|
150
|
+
try { result.projectItem.nodeId = clip.projectItem.nodeId; } catch (e) { result.projectItem.nodeId = null; }
|
|
151
|
+
|
|
152
|
+
var componentsResult = ppb_serializeComponentsForFullClipInfo(clip);
|
|
153
|
+
result.components = componentsResult.components;
|
|
154
|
+
if (componentsResult.truncated) {
|
|
155
|
+
result.truncated = true;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return JSON.stringify({ ok: true, result: result });
|
|
159
|
+
} catch (e) {
|
|
160
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
161
|
+
}
|
|
162
|
+
}
|