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,164 @@
|
|
|
1
|
+
// Command: remove-transition → ppb_removeTransition
|
|
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
|
+
// NOT a port — no reference repo has a transition-removal tool. Added in
|
|
7
|
+
// wave 4 as cleanup for add-transition/batch-add-transitions, since undo
|
|
8
|
+
// is confirmed non-functional on this build (see README/undo command).
|
|
9
|
+
// Removal is standard-DOM only: track.transitions[i].remove(false, false)
|
|
10
|
+
// per PREMIERE_API_NOTES.md's "Transitions (QE only)" line, but the
|
|
11
|
+
// remove() ARITY is unconfirmed on this build (0, 1, or 2 args across the
|
|
12
|
+
// reference repos) — probed via an attempts array, verified the only
|
|
13
|
+
// reliable way available: a numItems drop on track.transitions (never the
|
|
14
|
+
// call's own return value). If transitionIndex is out of range, the
|
|
15
|
+
// result includes a transitions LISTING (index + best-effort name) so the
|
|
16
|
+
// caller can find the right index without a separate round trip.
|
|
17
|
+
function ppb_removeTransition(argsJson) {
|
|
18
|
+
try {
|
|
19
|
+
var args;
|
|
20
|
+
try {
|
|
21
|
+
args = JSON.parse(argsJson);
|
|
22
|
+
} catch (e) {
|
|
23
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
31
|
+
}
|
|
32
|
+
if (typeof args.transitionIndex !== "number" || args.transitionIndex < 0 || Math.floor(args.transitionIndex) !== args.transitionIndex) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "transitionIndex must be a non-negative integer" });
|
|
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;
|
|
55
|
+
try { numTracks = trackCollection.numTracks; } catch (eNt) { numTracks = 0; }
|
|
56
|
+
if (args.trackIndex >= numTracks) {
|
|
57
|
+
return JSON.stringify({ ok: false, error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)" });
|
|
58
|
+
}
|
|
59
|
+
var track = trackCollection[args.trackIndex];
|
|
60
|
+
|
|
61
|
+
var transitions;
|
|
62
|
+
try {
|
|
63
|
+
transitions = track.transitions;
|
|
64
|
+
} catch (eTr) {
|
|
65
|
+
return JSON.stringify({ ok: false, error: "track.transitions is not available: " + eTr.toString() });
|
|
66
|
+
}
|
|
67
|
+
var numTransitions;
|
|
68
|
+
try { numTransitions = transitions.numItems; } catch (eNi) { numTransitions = null; }
|
|
69
|
+
if (numTransitions === null) {
|
|
70
|
+
return JSON.stringify({ ok: false, error: "could not read track.transitions.numItems on this build" });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function listTransitions() {
|
|
74
|
+
var list = [];
|
|
75
|
+
for (var i = 0; i < numTransitions; i++) {
|
|
76
|
+
var name = null;
|
|
77
|
+
try { name = transitions[i].name; } catch (eName) {
|
|
78
|
+
try { name = transitions[i].displayName; } catch (eName2) { name = null; }
|
|
79
|
+
}
|
|
80
|
+
list.push({ index: i, name: name });
|
|
81
|
+
}
|
|
82
|
+
return list;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
if (args.transitionIndex >= numTransitions) {
|
|
86
|
+
return JSON.stringify({
|
|
87
|
+
ok: false,
|
|
88
|
+
error: "transitionIndex " + args.transitionIndex + " is out of range — track has " + numTransitions + " transition(s)",
|
|
89
|
+
transitions: listTransitions(),
|
|
90
|
+
count: numTransitions
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
var removedTransitionName = null;
|
|
95
|
+
try { removedTransitionName = transitions[args.transitionIndex].name; } catch (eRn) {
|
|
96
|
+
try { removedTransitionName = transitions[args.transitionIndex].displayName; } catch (eRn2) { removedTransitionName = null; }
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var previousCount = numTransitions;
|
|
100
|
+
var attempts = [];
|
|
101
|
+
var verified = false;
|
|
102
|
+
var newCount = null;
|
|
103
|
+
|
|
104
|
+
function attemptRemove(label, fn) {
|
|
105
|
+
if (verified) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
var entry = { form: label };
|
|
109
|
+
try {
|
|
110
|
+
fn();
|
|
111
|
+
entry.success = true;
|
|
112
|
+
} catch (eCall) {
|
|
113
|
+
entry.success = false;
|
|
114
|
+
entry.error = eCall.toString();
|
|
115
|
+
attempts.push(entry);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
var count = null;
|
|
119
|
+
try { count = track.transitions.numItems; } catch (eCount) { count = null; }
|
|
120
|
+
if (count !== null && count === previousCount - 1) {
|
|
121
|
+
entry.verifiedCount = count;
|
|
122
|
+
verified = true;
|
|
123
|
+
newCount = count;
|
|
124
|
+
} else {
|
|
125
|
+
entry.note = "call did not throw, but transitions count did not drop by exactly one — treating as unverified";
|
|
126
|
+
}
|
|
127
|
+
attempts.push(entry);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
attemptRemove("remove(false, false)", function () {
|
|
131
|
+
track.transitions[args.transitionIndex].remove(false, false);
|
|
132
|
+
});
|
|
133
|
+
attemptRemove("remove(false)", function () {
|
|
134
|
+
track.transitions[args.transitionIndex].remove(false);
|
|
135
|
+
});
|
|
136
|
+
attemptRemove("remove()", function () {
|
|
137
|
+
track.transitions[args.transitionIndex].remove();
|
|
138
|
+
});
|
|
139
|
+
attemptRemove("remove(true, false)", function () {
|
|
140
|
+
track.transitions[args.transitionIndex].remove(true, false);
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
var result = {
|
|
144
|
+
sequenceName: seq.name,
|
|
145
|
+
trackType: args.trackType,
|
|
146
|
+
trackIndex: args.trackIndex,
|
|
147
|
+
transitionIndex: args.transitionIndex,
|
|
148
|
+
removedTransitionName: removedTransitionName,
|
|
149
|
+
previousCount: previousCount,
|
|
150
|
+
newCount: newCount,
|
|
151
|
+
verified: verified,
|
|
152
|
+
attempts: attempts
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
if (!verified) {
|
|
156
|
+
result.transitions = listTransitions();
|
|
157
|
+
return JSON.stringify({ ok: false, error: "could not remove the transition with any known argument form — see attempts", result: result });
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return JSON.stringify({ ok: true, result: result });
|
|
161
|
+
} catch (e) {
|
|
162
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
163
|
+
}
|
|
164
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Command: rename-bin → ppb_renameBin
|
|
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
|
+
// are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ports the reference project's project.ts rename_bin tool. Resolves a
|
|
7
|
+
// '/'-separated bin path (same convention as create-sequence's bin arg and
|
|
8
|
+
// get-bin-contents' binPath — never auto-created here) and renames it via
|
|
9
|
+
// bin.renameBin(newName). Verified via a name read-back. Undo is
|
|
10
|
+
// non-functional on this build — there is no previousValue restoration
|
|
11
|
+
// beyond renaming back manually (oldName is reported).
|
|
12
|
+
|
|
13
|
+
function ppbRenameBin_resolveBinPath(binPath) {
|
|
14
|
+
var segments = binPath.split("/").filter(function (s) { return s.length > 0; });
|
|
15
|
+
if (segments.length === 0) {
|
|
16
|
+
return { error: "binPath must contain at least one non-empty segment" };
|
|
17
|
+
}
|
|
18
|
+
var current = app.project.rootItem;
|
|
19
|
+
for (var i = 0; i < segments.length; i++) {
|
|
20
|
+
var found = null;
|
|
21
|
+
for (var j = 0; j < current.children.numItems; j++) {
|
|
22
|
+
var child = current.children[j];
|
|
23
|
+
if (child.name === segments[i] && typeof ProjectItemType !== "undefined" && child.type === ProjectItemType.BIN) {
|
|
24
|
+
found = child;
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
if (!found) {
|
|
29
|
+
return { error: "bin path segment \"" + segments[i] + "\" not found in \"" + binPath + "\"" };
|
|
30
|
+
}
|
|
31
|
+
current = found;
|
|
32
|
+
}
|
|
33
|
+
return { bin: current };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function ppb_renameBin(argsJson) {
|
|
37
|
+
try {
|
|
38
|
+
var args;
|
|
39
|
+
try {
|
|
40
|
+
args = JSON.parse(argsJson);
|
|
41
|
+
} catch (e) {
|
|
42
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!args.binPath || typeof args.binPath !== "string") {
|
|
46
|
+
return JSON.stringify({ ok: false, error: "binPath is required" });
|
|
47
|
+
}
|
|
48
|
+
if (!args.newName || typeof args.newName !== "string") {
|
|
49
|
+
return JSON.stringify({ ok: false, error: "newName is required" });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if (!app.project) {
|
|
53
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
var resolved = ppbRenameBin_resolveBinPath(args.binPath);
|
|
57
|
+
if (resolved.error) {
|
|
58
|
+
return JSON.stringify({ ok: false, error: resolved.error });
|
|
59
|
+
}
|
|
60
|
+
var bin = resolved.bin;
|
|
61
|
+
|
|
62
|
+
var oldName = null;
|
|
63
|
+
try { oldName = bin.name; } catch (e) { oldName = null; }
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
bin.renameBin(args.newName);
|
|
67
|
+
} catch (e) {
|
|
68
|
+
return JSON.stringify({ ok: false, error: "renameBin() failed: " + e.toString() });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var newName = null;
|
|
72
|
+
try { newName = bin.name; } catch (e) { newName = null; }
|
|
73
|
+
|
|
74
|
+
return JSON.stringify({
|
|
75
|
+
ok: true,
|
|
76
|
+
result: {
|
|
77
|
+
binPath: args.binPath,
|
|
78
|
+
nodeId: bin.nodeId,
|
|
79
|
+
oldName: oldName,
|
|
80
|
+
requestedName: args.newName,
|
|
81
|
+
newName: newName,
|
|
82
|
+
verified: newName === args.newName
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
} catch (e) {
|
|
86
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// Command: rename-clip → ppb_renameClip
|
|
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, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ported from leancoderkavy's premiere-pro-mcp `rename_clip` tool
|
|
7
|
+
// (advanced.ts), which renames exclusively via the QE DOM (`qeClip.
|
|
8
|
+
// setName()`). PREMIERE_API_NOTES.md's Clips section says standard-DOM
|
|
9
|
+
// `clip.name = x` is also cited as working [hetpatel] — probed FIRST here
|
|
10
|
+
// since it needs no QE activation/tab-switch; falls back to the QE
|
|
11
|
+
// setName() path only if the standard-DOM assignment doesn't stick. Either
|
|
12
|
+
// way, the result is read back from clip.name afterward, never trusted
|
|
13
|
+
// from either mutation call's own success.
|
|
14
|
+
function ppb_renameClip(argsJson) {
|
|
15
|
+
try {
|
|
16
|
+
var args;
|
|
17
|
+
try {
|
|
18
|
+
args = JSON.parse(argsJson);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
25
|
+
}
|
|
26
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
28
|
+
}
|
|
29
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
30
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
31
|
+
}
|
|
32
|
+
if (typeof args.name !== "string" || args.name.length === 0) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: "name must be a non-empty string" });
|
|
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
|
+
|
|
62
|
+
var track = trackCollection[args.trackIndex];
|
|
63
|
+
var numClips = track.clips.numItems;
|
|
64
|
+
if (args.clipIndex >= numClips) {
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
ok: false,
|
|
67
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
var clip = track.clips[args.clipIndex];
|
|
72
|
+
var oldName = null;
|
|
73
|
+
try { oldName = clip.name; } catch (e) { oldName = null; }
|
|
74
|
+
|
|
75
|
+
var method = null;
|
|
76
|
+
var standardDomError = null;
|
|
77
|
+
try {
|
|
78
|
+
clip.name = args.name;
|
|
79
|
+
method = "standardDom";
|
|
80
|
+
} catch (e) {
|
|
81
|
+
standardDomError = e.toString();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var newName = null;
|
|
85
|
+
try { newName = clip.name; } catch (e) { newName = null; }
|
|
86
|
+
|
|
87
|
+
var qeError = null;
|
|
88
|
+
if (newName !== args.name) {
|
|
89
|
+
try {
|
|
90
|
+
ensureQEEnabled();
|
|
91
|
+
activateSequenceForQE(seq);
|
|
92
|
+
var qeSeq = qe.project.getActiveSequence();
|
|
93
|
+
var qeTrack = args.trackType === "video" ? qeSeq.getVideoTrackAt(args.trackIndex) : qeSeq.getAudioTrackAt(args.trackIndex);
|
|
94
|
+
var qeClip = qeFindNthNonEmptyClip(qeTrack, args.clipIndex);
|
|
95
|
+
if (!qeClip) {
|
|
96
|
+
qeError = "could not locate the corresponding QE clip";
|
|
97
|
+
} else {
|
|
98
|
+
qeClip.setName(args.name);
|
|
99
|
+
method = "qe";
|
|
100
|
+
}
|
|
101
|
+
} catch (e) {
|
|
102
|
+
qeError = e.toString();
|
|
103
|
+
}
|
|
104
|
+
try { newName = clip.name; } catch (e) { newName = newName; }
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
var verified = newName === args.name;
|
|
108
|
+
|
|
109
|
+
var result = {
|
|
110
|
+
sequenceName: seq.name,
|
|
111
|
+
trackType: args.trackType,
|
|
112
|
+
trackIndex: args.trackIndex,
|
|
113
|
+
clipIndex: args.clipIndex,
|
|
114
|
+
previousValue: oldName,
|
|
115
|
+
requestedValue: args.name,
|
|
116
|
+
newValue: newName,
|
|
117
|
+
verified: verified,
|
|
118
|
+
method: method,
|
|
119
|
+
standardDomError: standardDomError,
|
|
120
|
+
qeError: qeError
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
return JSON.stringify({ ok: true, result: result });
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Command: rename-project-item → ppb_renameProjectItem
|
|
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
|
+
// are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ports the reference project's utility.ts rename_project_item tool. Item
|
|
7
|
+
// resolution by nodeId/name uses children-presence recursion (NOT an
|
|
8
|
+
// isBin() gate), per get-project-item-info.jsx's live-debugged finding.
|
|
9
|
+
// Renames via the documented item.name = x assignment, verified via a
|
|
10
|
+
// name read-back. Undo is non-functional on this build — previousValue is
|
|
11
|
+
// the only restoration path.
|
|
12
|
+
|
|
13
|
+
function ppbRenameProjectItem_findByNodeId(item, nodeId, depth) {
|
|
14
|
+
if (depth > 32) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
try {
|
|
18
|
+
if (item.nodeId === nodeId) {
|
|
19
|
+
return item;
|
|
20
|
+
}
|
|
21
|
+
} catch (e) {
|
|
22
|
+
// fall through
|
|
23
|
+
}
|
|
24
|
+
if (item.children && item.children.numItems > 0) {
|
|
25
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
26
|
+
var found = ppbRenameProjectItem_findByNodeId(item.children[i], nodeId, depth + 1);
|
|
27
|
+
if (found) {
|
|
28
|
+
return found;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function ppbRenameProjectItem_findByName(item, name, depth) {
|
|
36
|
+
if (depth > 32) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
try {
|
|
40
|
+
if (item.name === name) {
|
|
41
|
+
return item;
|
|
42
|
+
}
|
|
43
|
+
} catch (e) {
|
|
44
|
+
// fall through
|
|
45
|
+
}
|
|
46
|
+
if (item.children && item.children.numItems > 0) {
|
|
47
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
48
|
+
var found = ppbRenameProjectItem_findByName(item.children[i], name, depth + 1);
|
|
49
|
+
if (found) {
|
|
50
|
+
return found;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function ppb_renameProjectItem(argsJson) {
|
|
58
|
+
try {
|
|
59
|
+
var args;
|
|
60
|
+
try {
|
|
61
|
+
args = JSON.parse(argsJson);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
|
|
67
|
+
var hasName = typeof args.name === "string" && args.name.length > 0;
|
|
68
|
+
if (!hasNodeId && !hasName) {
|
|
69
|
+
return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
|
|
70
|
+
}
|
|
71
|
+
if (!args.newName || typeof args.newName !== "string") {
|
|
72
|
+
return JSON.stringify({ ok: false, error: "newName is required" });
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!app.project) {
|
|
76
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
var item = hasNodeId
|
|
80
|
+
? ppbRenameProjectItem_findByNodeId(app.project.rootItem, args.nodeId, 0)
|
|
81
|
+
: ppbRenameProjectItem_findByName(app.project.rootItem, args.name, 0);
|
|
82
|
+
if (!item) {
|
|
83
|
+
return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
var previousValue = null;
|
|
87
|
+
try { previousValue = item.name; } catch (e) { previousValue = null; }
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
item.name = args.newName;
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return JSON.stringify({ ok: false, error: "setting item.name failed: " + e.toString() });
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
var newValue = null;
|
|
96
|
+
try { newValue = item.name; } catch (e) { newValue = null; }
|
|
97
|
+
|
|
98
|
+
return JSON.stringify({
|
|
99
|
+
ok: true,
|
|
100
|
+
result: {
|
|
101
|
+
nodeId: item.nodeId,
|
|
102
|
+
previousValue: previousValue,
|
|
103
|
+
requestedValue: args.newName,
|
|
104
|
+
newValue: newValue,
|
|
105
|
+
verified: newValue === args.newName
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} catch (e) {
|
|
109
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Command: rename-track → ppb_renameTrack
|
|
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
|
+
// `rename_track` tool (track-targeting.ts) — plain track.name assignment.
|
|
8
|
+
// Verified by reading track.name back afterward.
|
|
9
|
+
function ppb_renameTrack(argsJson) {
|
|
10
|
+
try {
|
|
11
|
+
var args;
|
|
12
|
+
try {
|
|
13
|
+
args = JSON.parse(argsJson);
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
19
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
20
|
+
}
|
|
21
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
22
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
23
|
+
}
|
|
24
|
+
if (typeof args.name !== "string" || args.name.length === 0) {
|
|
25
|
+
return JSON.stringify({ ok: false, error: "name must be a non-empty string" });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (!app.project) {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
var seq = null;
|
|
33
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
34
|
+
seq = findSequenceByName(args.sequenceName);
|
|
35
|
+
if (!seq) {
|
|
36
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
37
|
+
}
|
|
38
|
+
} else {
|
|
39
|
+
seq = app.project.activeSequence;
|
|
40
|
+
if (!seq) {
|
|
41
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
46
|
+
var numTracks = trackCollection.numTracks;
|
|
47
|
+
if (args.trackIndex >= numTracks) {
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
ok: false,
|
|
50
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
var track = trackCollection[args.trackIndex];
|
|
55
|
+
var oldName = null;
|
|
56
|
+
try { oldName = track.name; } catch (e) { oldName = null; }
|
|
57
|
+
|
|
58
|
+
try {
|
|
59
|
+
track.name = args.name;
|
|
60
|
+
} catch (e) {
|
|
61
|
+
return JSON.stringify({ ok: false, error: "track.name assignment failed: " + e.toString() });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var newName = null;
|
|
65
|
+
try { newName = track.name; } catch (e) { newName = null; }
|
|
66
|
+
|
|
67
|
+
var result = {
|
|
68
|
+
sequenceName: seq.name,
|
|
69
|
+
trackType: args.trackType,
|
|
70
|
+
trackIndex: args.trackIndex,
|
|
71
|
+
oldName: oldName,
|
|
72
|
+
requestedName: args.name,
|
|
73
|
+
newName: newName
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
if (newName !== null && newName !== args.name) {
|
|
77
|
+
result.warning = "track.name read back \"" + newName + "\" after requesting \"" + args.name + "\" — mutation may not have taken effect";
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return JSON.stringify({ ok: true, result: result });
|
|
81
|
+
} catch (e) {
|
|
82
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
83
|
+
}
|
|
84
|
+
}
|