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,94 @@
|
|
|
1
|
+
// Command: set-track-visibility → ppb_setTrackVisibility
|
|
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
|
+
// Video-only. Ported from leancoderkavy's premiere-pro-mcp
|
|
7
|
+
// `toggle_track_visibility` tool (tracks.ts) — renamed here from "toggle"
|
|
8
|
+
// to an explicit "set" (visible: bool) for idempotence, matching this
|
|
9
|
+
// panel's other set-* commands.
|
|
10
|
+
//
|
|
11
|
+
// IMPORTANT API caveat: there is no standard-DOM API for a video track's
|
|
12
|
+
// "eye icon" visibility distinct from its mute flag — the reference
|
|
13
|
+
// project's toggle_track_visibility tool itself calls track.setMute() on a
|
|
14
|
+
// video track to implement "visibility" (visible=false -> setMute(1)).
|
|
15
|
+
// That is what this command does too: it is NOT a separate visibility
|
|
16
|
+
// property, it is track.setMute() applied to a video track, with the
|
|
17
|
+
// boolean sense inverted (visible = !muted). Read back via isMuted() as
|
|
18
|
+
// the verification proof, translated back to "visible" in the result.
|
|
19
|
+
function ppb_setTrackVisibility(argsJson) {
|
|
20
|
+
try {
|
|
21
|
+
var args;
|
|
22
|
+
try {
|
|
23
|
+
args = JSON.parse(argsJson);
|
|
24
|
+
} catch (e) {
|
|
25
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
30
|
+
}
|
|
31
|
+
if (typeof args.visible !== "boolean") {
|
|
32
|
+
return JSON.stringify({ ok: false, error: "visible must be a boolean" });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!app.project) {
|
|
36
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var seq = null;
|
|
40
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
41
|
+
seq = findSequenceByName(args.sequenceName);
|
|
42
|
+
if (!seq) {
|
|
43
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
44
|
+
}
|
|
45
|
+
} else {
|
|
46
|
+
seq = app.project.activeSequence;
|
|
47
|
+
if (!seq) {
|
|
48
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var numTracks = seq.videoTracks.numTracks;
|
|
53
|
+
if (args.trackIndex >= numTracks) {
|
|
54
|
+
return JSON.stringify({
|
|
55
|
+
ok: false,
|
|
56
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " video track(s)"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
var track = seq.videoTracks[args.trackIndex];
|
|
61
|
+
|
|
62
|
+
try {
|
|
63
|
+
track.setMute(args.visible ? 0 : 1);
|
|
64
|
+
} catch (e) {
|
|
65
|
+
return JSON.stringify({ ok: false, error: "track.setMute() failed: " + e.toString() });
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
var isMutedNow = null;
|
|
69
|
+
try {
|
|
70
|
+
isMutedNow = track.isMuted();
|
|
71
|
+
} catch (e) {
|
|
72
|
+
isMutedNow = null;
|
|
73
|
+
}
|
|
74
|
+
var isVisibleNow = isMutedNow === null ? null : !isMutedNow;
|
|
75
|
+
|
|
76
|
+
var result = {
|
|
77
|
+
sequenceName: seq.name,
|
|
78
|
+
trackType: "video",
|
|
79
|
+
trackIndex: args.trackIndex,
|
|
80
|
+
trackName: null,
|
|
81
|
+
requestedVisible: args.visible,
|
|
82
|
+
visible: isVisibleNow
|
|
83
|
+
};
|
|
84
|
+
try { result.trackName = track.name; } catch (e) { result.trackName = null; }
|
|
85
|
+
|
|
86
|
+
if (isVisibleNow !== null && isVisibleNow !== args.visible) {
|
|
87
|
+
result.warning = "read-back visibility (" + isVisibleNow + ") did not match requested (" + args.visible + ") — mutation may not have taken effect";
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return JSON.stringify({ ok: true, result: result });
|
|
91
|
+
} catch (e) {
|
|
92
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Command: set-transcode-on-ingest → ppb_setTranscodeOnIngest
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context.
|
|
4
|
+
//
|
|
5
|
+
// Ported from leancoderkavy/premiere-pro-mcp's project.ts
|
|
6
|
+
// set_transcode_on_ingest, which calls
|
|
7
|
+
// app.project.setEnableTranscodeOnIngest(0|1) — an API not mentioned
|
|
8
|
+
// anywhere in PREMIERE_API_NOTES.md (none of the three studied repos'
|
|
9
|
+
// other tools touch it either), so its presence on this Premiere build
|
|
10
|
+
// is genuinely unconfirmed. Probes for the method before calling and
|
|
11
|
+
// fails honestly if absent, rather than assuming it exists. No known
|
|
12
|
+
// getter exists to read the setting back (getEnableTranscodeOnIngest is
|
|
13
|
+
// not documented or referenced anywhere either) — probed defensively the
|
|
14
|
+
// same way, and if present is used for a best-effort read-back;
|
|
15
|
+
// otherwise verification is call-level only.
|
|
16
|
+
|
|
17
|
+
function ppb_setTranscodeOnIngest(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 (typeof args.enabled !== "boolean") {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "enabled (true or false) is required" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (!app.project) {
|
|
31
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
32
|
+
}
|
|
33
|
+
if (typeof app.project.setEnableTranscodeOnIngest !== "function") {
|
|
34
|
+
return JSON.stringify({
|
|
35
|
+
ok: false,
|
|
36
|
+
error: "setEnableTranscodeOnIngest is not available on this Premiere build — this API is unconfirmed outside the reference tool it was ported from"
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var hasGetter = typeof app.project.getEnableTranscodeOnIngest === "function";
|
|
41
|
+
var before = null;
|
|
42
|
+
if (hasGetter) {
|
|
43
|
+
try { before = app.project.getEnableTranscodeOnIngest(); } catch (e) { before = null; }
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
try {
|
|
47
|
+
app.project.setEnableTranscodeOnIngest(args.enabled ? 1 : 0);
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return JSON.stringify({ ok: false, error: "setEnableTranscodeOnIngest() failed: " + e.toString() });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
var after = null;
|
|
53
|
+
if (hasGetter) {
|
|
54
|
+
try { after = app.project.getEnableTranscodeOnIngest(); } catch (e) { after = null; }
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var verified = null;
|
|
58
|
+
var note = null;
|
|
59
|
+
if (hasGetter && after !== null) {
|
|
60
|
+
verified = !!after === args.enabled;
|
|
61
|
+
} else {
|
|
62
|
+
note = "no read-back getter is available/confirmed on this build — verification is call-level only (setEnableTranscodeOnIngest() did not throw)";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
ok: true,
|
|
67
|
+
result: {
|
|
68
|
+
set: true,
|
|
69
|
+
transcodeOnIngest: args.enabled,
|
|
70
|
+
previousValue: hasGetter ? before : null,
|
|
71
|
+
verified: verified,
|
|
72
|
+
note: note
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
} catch (e) {
|
|
76
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
// Command: set-uniform-scale → ppb_setUniformScale
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (findSequenceByName,
|
|
4
|
+
// findClipComponent, setComponentProperty, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Standard-DOM only — no QE needed. Ported from leancoderkavy's
|
|
7
|
+
// premiere-pro-mcp `set_uniform_scale` tool (track-targeting.ts), addressed
|
|
8
|
+
// here by trackType/trackIndex/clipIndex (same convention as
|
|
9
|
+
// get-full-clip-info) instead of node_id. Sets the Motion component's
|
|
10
|
+
// Uniform Scale property — a boolean-like 0/1 toggle that links (true) or
|
|
11
|
+
// unlinks (false) Scale Width/Scale Height; see set-scale-width-height,
|
|
12
|
+
// which requires this to be off. Mutating — undo is non-functional on this
|
|
13
|
+
// build, so previousValue in the result is the caller's only restoration
|
|
14
|
+
// path.
|
|
15
|
+
|
|
16
|
+
function ppb_setUniformScale(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
|
+
if (args.trackType !== "video" && args.trackType !== "audio") {
|
|
26
|
+
return JSON.stringify({ ok: false, error: "trackType must be \"video\" or \"audio\"" });
|
|
27
|
+
}
|
|
28
|
+
if (typeof args.trackIndex !== "number" || args.trackIndex < 0 || Math.floor(args.trackIndex) !== args.trackIndex) {
|
|
29
|
+
return JSON.stringify({ ok: false, error: "trackIndex must be a non-negative integer" });
|
|
30
|
+
}
|
|
31
|
+
if (typeof args.clipIndex !== "number" || args.clipIndex < 0 || Math.floor(args.clipIndex) !== args.clipIndex) {
|
|
32
|
+
return JSON.stringify({ ok: false, error: "clipIndex must be a non-negative integer" });
|
|
33
|
+
}
|
|
34
|
+
if (typeof args.uniform !== "boolean") {
|
|
35
|
+
return JSON.stringify({ ok: false, error: "uniform must be a boolean" });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!app.project) {
|
|
39
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
var seq = null;
|
|
43
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
44
|
+
seq = findSequenceByName(args.sequenceName);
|
|
45
|
+
if (!seq) {
|
|
46
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
47
|
+
}
|
|
48
|
+
} else {
|
|
49
|
+
seq = app.project.activeSequence;
|
|
50
|
+
if (!seq) {
|
|
51
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
var trackCollection = args.trackType === "video" ? seq.videoTracks : seq.audioTracks;
|
|
56
|
+
var numTracks = trackCollection.numTracks;
|
|
57
|
+
if (args.trackIndex >= numTracks) {
|
|
58
|
+
return JSON.stringify({
|
|
59
|
+
ok: false,
|
|
60
|
+
error: "trackIndex " + args.trackIndex + " is out of range — sequence has " + numTracks + " " + args.trackType + " track(s)"
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var track = trackCollection[args.trackIndex];
|
|
65
|
+
var numClips = track.clips.numItems;
|
|
66
|
+
if (args.clipIndex >= numClips) {
|
|
67
|
+
return JSON.stringify({
|
|
68
|
+
ok: false,
|
|
69
|
+
error: "clipIndex " + args.clipIndex + " is out of range — track " + args.trackIndex + " has " + numClips + " clip(s)"
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var clip = track.clips[args.clipIndex];
|
|
74
|
+
var clipName = null;
|
|
75
|
+
try { clipName = clip.name; } catch (e) { clipName = null; }
|
|
76
|
+
|
|
77
|
+
var motion = findClipComponent(clip, ["AE.ADBE Motion"], ["Motion"]);
|
|
78
|
+
if (!motion) {
|
|
79
|
+
return JSON.stringify({ ok: false, error: "Motion component not found on clip" });
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var setResult = setComponentProperty(motion, ["Uniform Scale"], args.uniform);
|
|
83
|
+
if (!setResult.found) {
|
|
84
|
+
return JSON.stringify({ ok: false, error: "Uniform Scale property not found on the Motion component" });
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
return JSON.stringify({
|
|
88
|
+
ok: true,
|
|
89
|
+
result: {
|
|
90
|
+
sequenceName: seq.name,
|
|
91
|
+
trackType: args.trackType,
|
|
92
|
+
trackIndex: args.trackIndex,
|
|
93
|
+
clipIndex: args.clipIndex,
|
|
94
|
+
clipName: clipName,
|
|
95
|
+
previousValue: setResult.previousValue,
|
|
96
|
+
requestedValue: setResult.requestedValue,
|
|
97
|
+
newValue: setResult.newValue,
|
|
98
|
+
verified: setResult.verified
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
} catch (e) {
|
|
102
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Command: set-work-area → ppb_setWorkArea
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context — shared helpers (TICKS_PER_SECOND,
|
|
4
|
+
// findSequenceByName, ...) are already defined there.
|
|
5
|
+
//
|
|
6
|
+
// Ported from leancoderkavy/premiere-pro-mcp's playhead.ts set_work_area.
|
|
7
|
+
// Sets the given (or active) sequence's work area bar bounds via
|
|
8
|
+
// seq.setWorkAreaInPoint()/setWorkAreaOutPoint(), each taking a ticks
|
|
9
|
+
// string per PREMIERE_API_NOTES.md's "Work area" row.
|
|
10
|
+
function ppb_setWorkArea(argsJson) {
|
|
11
|
+
try {
|
|
12
|
+
var args;
|
|
13
|
+
try {
|
|
14
|
+
args = JSON.parse(argsJson);
|
|
15
|
+
} catch (e) {
|
|
16
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (typeof args.startSeconds !== "number" || isNaN(args.startSeconds) ||
|
|
20
|
+
typeof args.endSeconds !== "number" || isNaN(args.endSeconds)) {
|
|
21
|
+
return JSON.stringify({ ok: false, error: "startSeconds and endSeconds (numbers) are both required" });
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!app.project) {
|
|
25
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var seq = null;
|
|
29
|
+
if (args.sequenceName && typeof args.sequenceName === "string") {
|
|
30
|
+
seq = findSequenceByName(args.sequenceName);
|
|
31
|
+
if (!seq) {
|
|
32
|
+
return JSON.stringify({ ok: false, error: "no sequence named \"" + args.sequenceName + "\" is open" });
|
|
33
|
+
}
|
|
34
|
+
} else {
|
|
35
|
+
seq = app.project.activeSequence;
|
|
36
|
+
if (!seq) {
|
|
37
|
+
return JSON.stringify({ ok: false, error: "no active sequence, and no sequenceName given" });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
var startTicks = String(Math.round(args.startSeconds * TICKS_PER_SECOND));
|
|
42
|
+
var endTicks = String(Math.round(args.endSeconds * TICKS_PER_SECOND));
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
seq.setWorkAreaInPoint(startTicks);
|
|
46
|
+
seq.setWorkAreaOutPoint(endTicks);
|
|
47
|
+
} catch (e) {
|
|
48
|
+
return JSON.stringify({ ok: false, error: "could not set work area: " + e.toString() });
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// Read the values back rather than echoing the inputs — live testing
|
|
52
|
+
// 2026-07-17 showed the setters "succeed" (no throw) on Premiere 2026
|
|
53
|
+
// while the work-area reads stay null (the work area bar appears to
|
|
54
|
+
// have been dropped on this build, consistent with
|
|
55
|
+
// isWorkAreaBarEnabled() not existing). readBack lets callers detect
|
|
56
|
+
// that the set didn't actually take effect.
|
|
57
|
+
var readBackIn = null;
|
|
58
|
+
var readBackOut = null;
|
|
59
|
+
try { readBackIn = timeValueToSeconds(seq.workInPoint); } catch (e) { readBackIn = null; }
|
|
60
|
+
try { readBackOut = timeValueToSeconds(seq.workOutPoint); } catch (e) { readBackOut = null; }
|
|
61
|
+
|
|
62
|
+
return JSON.stringify({
|
|
63
|
+
ok: true,
|
|
64
|
+
result: {
|
|
65
|
+
sequenceName: seq.name,
|
|
66
|
+
startSeconds: args.startSeconds,
|
|
67
|
+
endSeconds: args.endSeconds,
|
|
68
|
+
readBackInSeconds: readBackIn,
|
|
69
|
+
readBackOutSeconds: readBackOut,
|
|
70
|
+
applied: readBackIn !== null && readBackOut !== null
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
} catch (e) {
|
|
74
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Command: set-workspace → ppb_setWorkspace
|
|
2
|
+
// Loaded lazily by ppb_dispatch (host/index.jsx) on first use, into the
|
|
3
|
+
// same global ExtendScript context.
|
|
4
|
+
//
|
|
5
|
+
// Ported from leancoderkavy/premiere-pro-mcp's workspace.ts set_workspace.
|
|
6
|
+
// App-level — no project or sequence involved.
|
|
7
|
+
function ppb_setWorkspace(argsJson) {
|
|
8
|
+
try {
|
|
9
|
+
var args;
|
|
10
|
+
try {
|
|
11
|
+
args = JSON.parse(argsJson);
|
|
12
|
+
} catch (e) {
|
|
13
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (typeof args.name !== "string" || args.name.length === 0) {
|
|
17
|
+
return JSON.stringify({ ok: false, error: "name (string) is required" });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
var result = null;
|
|
21
|
+
try {
|
|
22
|
+
result = app.setWorkspace(args.name);
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return JSON.stringify({ ok: false, error: "failed to set workspace \"" + args.name + "\": " + e.toString() });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (!result) {
|
|
28
|
+
return JSON.stringify({ ok: false, error: "failed to set workspace: " + args.name });
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
return JSON.stringify({ ok: true, result: { set: true, workspace: args.name } });
|
|
32
|
+
} catch (e) {
|
|
33
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
// Command: set-xmp-metadata → ppb_setXmpMetadata
|
|
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
|
+
// WRITE command — write-side counterpart of get-xmp-metadata.
|
|
10
|
+
// setXMPMetadata(xml) REPLACES THE ITEM'S ENTIRE XMP BLOCK — it is not a
|
|
11
|
+
// merge/patch. Callers should run get-xmp-metadata first, modify the
|
|
12
|
+
// returned XML, and pass the full result back here. XMP blobs are too
|
|
13
|
+
// large for a command line, so this command's `xmp` wire arg is expected
|
|
14
|
+
// to already be file contents — the CLI's --xmp-file flag reads a local
|
|
15
|
+
// file and sends it, all in Python; this file never touches the
|
|
16
|
+
// filesystem. Undo is NON-FUNCTIONAL on this build — `previousValue`
|
|
17
|
+
// (truncated to 100KB, same as get-xmp-metadata) is the only restoration
|
|
18
|
+
// path.
|
|
19
|
+
|
|
20
|
+
var PPB_SET_XMP_METADATA_MAX_CHARS = 102400;
|
|
21
|
+
|
|
22
|
+
function ppbFindItemSetXmpMetadata_walk(item, args, depth) {
|
|
23
|
+
if (depth > 32) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var isBin = false;
|
|
28
|
+
try {
|
|
29
|
+
isBin = typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
|
|
30
|
+
} catch (e) {
|
|
31
|
+
isBin = false;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
var matched = false;
|
|
35
|
+
if (args.nodeId !== null) {
|
|
36
|
+
try { matched = item.nodeId === args.nodeId; } catch (e) { matched = false; }
|
|
37
|
+
} else if (args.name !== null) {
|
|
38
|
+
try { matched = item.name === args.name; } catch (e) { matched = false; }
|
|
39
|
+
}
|
|
40
|
+
if (matched) {
|
|
41
|
+
return item;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
if (isBin && item.children) {
|
|
45
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
46
|
+
var found = ppbFindItemSetXmpMetadata_walk(item.children[i], args, depth + 1);
|
|
47
|
+
if (found) {
|
|
48
|
+
return found;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function ppbFindItemSetXmpMetadata_resolve(args) {
|
|
56
|
+
var root = app.project.rootItem;
|
|
57
|
+
for (var i = 0; i < root.children.numItems; i++) {
|
|
58
|
+
var found = ppbFindItemSetXmpMetadata_walk(root.children[i], args, 1);
|
|
59
|
+
if (found) {
|
|
60
|
+
return found;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function ppbSetXmpMetadata_truncate(xmp) {
|
|
67
|
+
var truncated = false;
|
|
68
|
+
if (typeof xmp === "string" && xmp.length > PPB_SET_XMP_METADATA_MAX_CHARS) {
|
|
69
|
+
xmp = xmp.substring(0, PPB_SET_XMP_METADATA_MAX_CHARS);
|
|
70
|
+
truncated = true;
|
|
71
|
+
}
|
|
72
|
+
return { value: xmp, truncated: truncated };
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function ppb_setXmpMetadata(argsJson) {
|
|
76
|
+
try {
|
|
77
|
+
var args;
|
|
78
|
+
try {
|
|
79
|
+
args = JSON.parse(argsJson);
|
|
80
|
+
} catch (e) {
|
|
81
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
var hasNodeId = typeof args.nodeId === "string" && args.nodeId.length > 0;
|
|
85
|
+
var hasName = typeof args.name === "string" && args.name.length > 0;
|
|
86
|
+
if (!hasNodeId && !hasName) {
|
|
87
|
+
return JSON.stringify({ ok: false, error: "either nodeId or name is required" });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (typeof args.xmp !== "string" || args.xmp.length === 0) {
|
|
91
|
+
return JSON.stringify({ ok: false, error: "xmp (non-empty string) is required" });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!app.project) {
|
|
95
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var item = ppbFindItemSetXmpMetadata_resolve({
|
|
99
|
+
nodeId: hasNodeId ? args.nodeId : null,
|
|
100
|
+
name: hasNodeId ? null : args.name
|
|
101
|
+
});
|
|
102
|
+
if (!item) {
|
|
103
|
+
return JSON.stringify({ ok: false, error: "no project item found matching the given nodeId/name" });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (typeof item.setXMPMetadata !== "function") {
|
|
107
|
+
return JSON.stringify({ ok: false, error: "setXMPMetadata is not available on this Premiere build" });
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
var previousRaw = null;
|
|
111
|
+
try { previousRaw = item.getXMPMetadata(); } catch (e) { previousRaw = null; }
|
|
112
|
+
var previousTruncation = ppbSetXmpMetadata_truncate(previousRaw);
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
item.setXMPMetadata(args.xmp);
|
|
116
|
+
} catch (e) {
|
|
117
|
+
return JSON.stringify({ ok: false, error: "setXMPMetadata() failed: " + e.toString() });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
var newRaw = null;
|
|
121
|
+
try { newRaw = item.getXMPMetadata(); } catch (e) { newRaw = null; }
|
|
122
|
+
var newTruncation = ppbSetXmpMetadata_truncate(newRaw);
|
|
123
|
+
|
|
124
|
+
var verified = false;
|
|
125
|
+
var note = null;
|
|
126
|
+
if (typeof newRaw === "string") {
|
|
127
|
+
if (!newTruncation.truncated && !(args.xmp.length > PPB_SET_XMP_METADATA_MAX_CHARS)) {
|
|
128
|
+
verified = newRaw === args.xmp;
|
|
129
|
+
} else {
|
|
130
|
+
// Either the requested XMP or the read-back was too large to
|
|
131
|
+
// compare in full — only the truncated prefixes can be checked.
|
|
132
|
+
verified = newTruncation.value === args.xmp.substring(0, PPB_SET_XMP_METADATA_MAX_CHARS);
|
|
133
|
+
note = "requested value and/or read-back exceeded 100KB — verified against truncated prefixes only";
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
var result = {
|
|
138
|
+
name: null,
|
|
139
|
+
nodeId: null,
|
|
140
|
+
requestedValue: args.xmp,
|
|
141
|
+
previousValue: previousTruncation.value,
|
|
142
|
+
previousTruncated: previousTruncation.truncated,
|
|
143
|
+
newValue: newTruncation.value,
|
|
144
|
+
truncated: newTruncation.truncated,
|
|
145
|
+
verified: verified
|
|
146
|
+
};
|
|
147
|
+
if (note) {
|
|
148
|
+
result.note = note;
|
|
149
|
+
}
|
|
150
|
+
try { result.name = item.name; } catch (e) { result.name = null; }
|
|
151
|
+
try { result.nodeId = item.nodeId; } catch (e) { result.nodeId = null; }
|
|
152
|
+
|
|
153
|
+
return JSON.stringify({ ok: true, result: result });
|
|
154
|
+
} catch (e) {
|
|
155
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
156
|
+
}
|
|
157
|
+
}
|