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: import-ae-comps → ppb_importAeComps
|
|
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 import_ae_comps.
|
|
6
|
+
// Calls app.project.importAEComps(aep, [names], bin) if compNames is
|
|
7
|
+
// given, else app.project.importAllAEComps(aep, bin) — both per
|
|
8
|
+
// PREMIERE_API_NOTES.md's Project/bins/import section. targetBinPath
|
|
9
|
+
// resolves via the same '/'-separated-path bin walk as get-bin-contents.
|
|
10
|
+
// jsx (never auto-created — must already exist); omitted defaults to
|
|
11
|
+
// app.project.rootItem. Verified by a target-bin children-count increase
|
|
12
|
+
// (never trusting the call's own return value).
|
|
13
|
+
//
|
|
14
|
+
// Helper names prefixed ppbImportAeComps_ to avoid colliding with
|
|
15
|
+
// same-purpose helpers in other lazily-loaded command files evaluated
|
|
16
|
+
// into this same global context.
|
|
17
|
+
|
|
18
|
+
function ppbImportAeComps_isBin(item) {
|
|
19
|
+
try {
|
|
20
|
+
return typeof ProjectItemType !== "undefined" && item.type === ProjectItemType.BIN;
|
|
21
|
+
} catch (e) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function ppbImportAeComps_findBin(binPath) {
|
|
27
|
+
var segments = binPath.split("/").filter(function (s) { return s.length > 0; });
|
|
28
|
+
var current = app.project.rootItem;
|
|
29
|
+
|
|
30
|
+
for (var i = 0; i < segments.length; i++) {
|
|
31
|
+
var segment = segments[i];
|
|
32
|
+
var found = null;
|
|
33
|
+
|
|
34
|
+
for (var j = 0; j < current.children.numItems; j++) {
|
|
35
|
+
var child = current.children[j];
|
|
36
|
+
if (child.name === segment && ppbImportAeComps_isBin(child)) {
|
|
37
|
+
found = child;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!found) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
current = found;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return current;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function ppb_importAeComps(argsJson) {
|
|
52
|
+
try {
|
|
53
|
+
var args;
|
|
54
|
+
try {
|
|
55
|
+
args = JSON.parse(argsJson);
|
|
56
|
+
} catch (e) {
|
|
57
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!args.aepPath || typeof args.aepPath !== "string") {
|
|
61
|
+
return JSON.stringify({ ok: false, error: "aepPath is required" });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var file = new File(args.aepPath);
|
|
65
|
+
if (!file.exists) {
|
|
66
|
+
return JSON.stringify({ ok: false, error: "no file exists at aepPath: " + args.aepPath });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (!app.project) {
|
|
70
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var targetBin = app.project.rootItem;
|
|
74
|
+
if (args.targetBinPath && typeof args.targetBinPath === "string") {
|
|
75
|
+
var found = ppbImportAeComps_findBin(args.targetBinPath);
|
|
76
|
+
if (!found) {
|
|
77
|
+
return JSON.stringify({ ok: false, error: "no bin found at targetBinPath \"" + args.targetBinPath + "\"" });
|
|
78
|
+
}
|
|
79
|
+
targetBin = found;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
var hasNames = Object.prototype.toString.call(args.compNames) === "[object Array]" && args.compNames.length > 0;
|
|
83
|
+
|
|
84
|
+
var countBefore = targetBin.children.numItems;
|
|
85
|
+
|
|
86
|
+
try {
|
|
87
|
+
if (hasNames) {
|
|
88
|
+
if (typeof app.project.importAEComps !== "function") {
|
|
89
|
+
return JSON.stringify({ ok: false, error: "importAEComps is not available on this Premiere build" });
|
|
90
|
+
}
|
|
91
|
+
app.project.importAEComps(args.aepPath, args.compNames, targetBin);
|
|
92
|
+
} else {
|
|
93
|
+
if (typeof app.project.importAllAEComps !== "function") {
|
|
94
|
+
return JSON.stringify({ ok: false, error: "importAllAEComps is not available on this Premiere build" });
|
|
95
|
+
}
|
|
96
|
+
app.project.importAllAEComps(args.aepPath, targetBin);
|
|
97
|
+
}
|
|
98
|
+
} catch (e) {
|
|
99
|
+
return JSON.stringify({ ok: false, error: "AE comp import failed: " + e.toString() });
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
var countAfter = targetBin.children.numItems;
|
|
103
|
+
var imported = countAfter > countBefore;
|
|
104
|
+
|
|
105
|
+
if (!imported) {
|
|
106
|
+
return JSON.stringify({
|
|
107
|
+
ok: false,
|
|
108
|
+
error: "the import call did not throw, but the target bin's item count did not increase",
|
|
109
|
+
countBefore: countBefore,
|
|
110
|
+
countAfter: countAfter
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return JSON.stringify({
|
|
115
|
+
ok: true,
|
|
116
|
+
result: {
|
|
117
|
+
imported: true,
|
|
118
|
+
aepPath: args.aepPath,
|
|
119
|
+
compNames: hasNames ? args.compNames : null,
|
|
120
|
+
allComps: !hasNames,
|
|
121
|
+
targetBinPath: args.targetBinPath || null,
|
|
122
|
+
countBefore: countBefore,
|
|
123
|
+
countAfter: countAfter
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
} catch (e) {
|
|
127
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// Command: import-fcp-xml → ppb_importFcpXml
|
|
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 import_fcp_xml,
|
|
6
|
+
// which uses the legacy app.openFCPXML(path). PREMIERE_API_NOTES.md's
|
|
7
|
+
// Sequences table flags this as legacy and recommends
|
|
8
|
+
// app.project.importFiles([xmlPath], false, rootItem, false) instead
|
|
9
|
+
// [hetpatel] — so this command tries importFiles first (verified by a
|
|
10
|
+
// root-bin children-count increase, same pattern as create-smart-bin.jsx),
|
|
11
|
+
// falling back to app.openFCPXML() if importFiles isn't available or
|
|
12
|
+
// doesn't visibly add anything. DIALOG RISK: both paths can pop blocking
|
|
13
|
+
// dialogs on malformed/unsupported XML (same caveat as open-project.jsx
|
|
14
|
+
// and PREMIERE_API_NOTES.md's Import section) — a hang here likely means
|
|
15
|
+
// a dialog needs dismissing in Premiere itself.
|
|
16
|
+
|
|
17
|
+
function ppb_importFcpXml(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.xmlPath || typeof args.xmlPath !== "string") {
|
|
27
|
+
return JSON.stringify({ ok: false, error: "xmlPath is required" });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
var file = new File(args.xmlPath);
|
|
31
|
+
if (!file.exists) {
|
|
32
|
+
return JSON.stringify({ ok: false, error: "no file exists at xmlPath: " + args.xmlPath });
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (!app.project) {
|
|
36
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var countBefore = app.project.rootItem.children.numItems;
|
|
40
|
+
var attempts = [];
|
|
41
|
+
var method = null;
|
|
42
|
+
|
|
43
|
+
if (typeof app.project.importFiles === "function") {
|
|
44
|
+
try {
|
|
45
|
+
app.project.importFiles([args.xmlPath], false, app.project.rootItem, false);
|
|
46
|
+
var countAfterImportFiles = app.project.rootItem.children.numItems;
|
|
47
|
+
var success1 = countAfterImportFiles > countBefore;
|
|
48
|
+
attempts.push({ method: "importFiles", success: success1 });
|
|
49
|
+
if (success1) {
|
|
50
|
+
method = "importFiles";
|
|
51
|
+
}
|
|
52
|
+
} catch (e) {
|
|
53
|
+
attempts.push({ method: "importFiles", success: false, error: e.toString() });
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
attempts.push({ method: "importFiles", success: false, error: "app.project.importFiles is not a function on this Premiere build" });
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (method === null) {
|
|
60
|
+
if (typeof app.openFCPXML === "function") {
|
|
61
|
+
try {
|
|
62
|
+
app.openFCPXML(args.xmlPath);
|
|
63
|
+
var countAfterOpenFCPXML = app.project.rootItem.children.numItems;
|
|
64
|
+
var success2 = countAfterOpenFCPXML > countBefore;
|
|
65
|
+
attempts.push({ method: "openFCPXML", success: success2 });
|
|
66
|
+
if (success2) {
|
|
67
|
+
method = "openFCPXML";
|
|
68
|
+
}
|
|
69
|
+
} catch (e) {
|
|
70
|
+
attempts.push({ method: "openFCPXML", success: false, error: e.toString() });
|
|
71
|
+
}
|
|
72
|
+
} else {
|
|
73
|
+
attempts.push({ method: "openFCPXML", success: false, error: "app.openFCPXML is not a function on this Premiere build" });
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
var countAfter = app.project.rootItem.children.numItems;
|
|
78
|
+
|
|
79
|
+
if (method === null) {
|
|
80
|
+
return JSON.stringify({
|
|
81
|
+
ok: false,
|
|
82
|
+
error: "could not import the FCP XML with any known method — see attempts",
|
|
83
|
+
attempts: attempts,
|
|
84
|
+
countBefore: countBefore,
|
|
85
|
+
countAfter: countAfter
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return JSON.stringify({
|
|
90
|
+
ok: true,
|
|
91
|
+
result: {
|
|
92
|
+
imported: true,
|
|
93
|
+
xmlPath: args.xmlPath,
|
|
94
|
+
method: method,
|
|
95
|
+
countBefore: countBefore,
|
|
96
|
+
countAfter: countAfter,
|
|
97
|
+
attempts: attempts
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
// Command: import-folder → ppb_importFolder
|
|
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 media.ts import_folder tool. Same
|
|
7
|
+
// extension-allowlist/nodeId-diff verification approach as import-media.jsx
|
|
8
|
+
// (see that file's header for the dialog-freeze rationale) — duplicated
|
|
9
|
+
// here under its own prefix since each lazily-loaded command file cannot
|
|
10
|
+
// rely on helpers defined only in another command file.
|
|
11
|
+
|
|
12
|
+
var PPB_IMPORT_FOLDER_ALLOWED_EXTENSIONS = [
|
|
13
|
+
"mp4", "mov", "avi", "mkv", "webm", "mxf", "m4v", "wmv", "mpg", "mpeg",
|
|
14
|
+
"wav", "mp3", "aac", "m4a", "aif", "aiff", "flac", "ogg",
|
|
15
|
+
"png", "jpg", "jpeg", "gif", "tiff", "tif", "bmp", "psd", "tga", "exr", "dpx", "webp",
|
|
16
|
+
"prproj"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function ppbImportFolder_extensionOf(path) {
|
|
20
|
+
var lastDot = path.lastIndexOf(".");
|
|
21
|
+
if (lastDot === -1 || lastDot === path.length - 1) {
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
return path.substring(lastDot + 1).toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ppbImportFolder_isAllowedExtension(path) {
|
|
28
|
+
var ext = ppbImportFolder_extensionOf(path);
|
|
29
|
+
for (var i = 0; i < PPB_IMPORT_FOLDER_ALLOWED_EXTENSIONS.length; i++) {
|
|
30
|
+
if (ext === PPB_IMPORT_FOLDER_ALLOWED_EXTENSIONS[i]) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ppbImportFolder_snapshotNodeIds(item, depth, seen) {
|
|
38
|
+
if (depth > 32) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
if (item.nodeId) {
|
|
43
|
+
seen[item.nodeId] = true;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// ignore
|
|
47
|
+
}
|
|
48
|
+
if (item.children && item.children.numItems > 0) {
|
|
49
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
50
|
+
ppbImportFolder_snapshotNodeIds(item.children[i], depth + 1, seen);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function ppbImportFolder_takeSnapshot() {
|
|
56
|
+
var seen = {};
|
|
57
|
+
ppbImportFolder_snapshotNodeIds(app.project.rootItem, 0, seen);
|
|
58
|
+
return seen;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ppbImportFolder_collectNew(item, depth, beforeSnapshot, out) {
|
|
62
|
+
if (depth > 32) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
if (item.nodeId && !beforeSnapshot[item.nodeId]) {
|
|
67
|
+
var entry = { name: null, nodeId: null, treePath: null, mediaPath: null };
|
|
68
|
+
try { entry.name = item.name; } catch (e) { entry.name = null; }
|
|
69
|
+
try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
|
|
70
|
+
try { entry.treePath = item.treePath; } catch (e) { entry.treePath = null; }
|
|
71
|
+
try { entry.mediaPath = item.getMediaPath(); } catch (e) { entry.mediaPath = null; }
|
|
72
|
+
out.push(entry);
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
// ignore
|
|
76
|
+
}
|
|
77
|
+
if (item.children && item.children.numItems > 0) {
|
|
78
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
79
|
+
ppbImportFolder_collectNew(item.children[i], depth + 1, beforeSnapshot, out);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function ppbImportFolder_resolveBinPath(binPath) {
|
|
85
|
+
var segments = binPath.split("/").filter(function (s) { return s.length > 0; });
|
|
86
|
+
var current = app.project.rootItem;
|
|
87
|
+
for (var i = 0; i < segments.length; i++) {
|
|
88
|
+
var found = null;
|
|
89
|
+
for (var j = 0; j < current.children.numItems; j++) {
|
|
90
|
+
var child = current.children[j];
|
|
91
|
+
if (child.name === segments[i] && typeof ProjectItemType !== "undefined" && child.type === ProjectItemType.BIN) {
|
|
92
|
+
found = child;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!found) {
|
|
97
|
+
return { error: "bin path segment \"" + segments[i] + "\" not found in \"" + binPath + "\" (target bin must already exist)" };
|
|
98
|
+
}
|
|
99
|
+
current = found;
|
|
100
|
+
}
|
|
101
|
+
return { bin: current };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function ppb_importFolder(argsJson) {
|
|
105
|
+
try {
|
|
106
|
+
var args;
|
|
107
|
+
try {
|
|
108
|
+
args = JSON.parse(argsJson);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!args.folderPath || typeof args.folderPath !== "string") {
|
|
114
|
+
return JSON.stringify({ ok: false, error: "folderPath is required" });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (!app.project) {
|
|
118
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
var folder = new Folder(args.folderPath);
|
|
122
|
+
if (!folder.exists) {
|
|
123
|
+
return JSON.stringify({ ok: false, error: "folder not found: " + args.folderPath });
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
var files = folder.getFiles();
|
|
127
|
+
var candidatePaths = [];
|
|
128
|
+
for (var i = 0; i < files.length; i++) {
|
|
129
|
+
if (files[i] instanceof File) {
|
|
130
|
+
candidatePaths.push(files[i].fsName);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (candidatePaths.length === 0) {
|
|
135
|
+
return JSON.stringify({ ok: false, error: "no files found in folder: " + args.folderPath });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
var allowed = [];
|
|
139
|
+
var refused = [];
|
|
140
|
+
for (var p = 0; p < candidatePaths.length; p++) {
|
|
141
|
+
if (ppbImportFolder_isAllowedExtension(candidatePaths[p])) {
|
|
142
|
+
allowed.push(candidatePaths[p]);
|
|
143
|
+
} else {
|
|
144
|
+
refused.push(candidatePaths[p]);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (allowed.length === 0) {
|
|
149
|
+
return JSON.stringify({
|
|
150
|
+
ok: false,
|
|
151
|
+
error: "refusing to import — none of the folder's files have a recognized extension (an unsupported " +
|
|
152
|
+
"format can pop a BLOCKING dialog that freezes the Premiere Bridge panel)",
|
|
153
|
+
refused: refused,
|
|
154
|
+
allowedExtensions: PPB_IMPORT_FOLDER_ALLOWED_EXTENSIONS
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var targetBin = app.project.rootItem;
|
|
159
|
+
if (typeof args.targetBinPath === "string" && args.targetBinPath.length > 0) {
|
|
160
|
+
var resolved = ppbImportFolder_resolveBinPath(args.targetBinPath);
|
|
161
|
+
if (resolved.error) {
|
|
162
|
+
return JSON.stringify({ ok: false, error: resolved.error });
|
|
163
|
+
}
|
|
164
|
+
targetBin = resolved.bin;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
var before = ppbImportFolder_takeSnapshot();
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
app.project.importFiles(allowed, true, targetBin, false);
|
|
171
|
+
} catch (e) {
|
|
172
|
+
return JSON.stringify({ ok: false, error: "app.project.importFiles() threw: " + e.toString() });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
var imported = [];
|
|
176
|
+
ppbImportFolder_collectNew(app.project.rootItem, 0, before, imported);
|
|
177
|
+
|
|
178
|
+
return JSON.stringify({
|
|
179
|
+
ok: true,
|
|
180
|
+
result: {
|
|
181
|
+
folderPath: args.folderPath,
|
|
182
|
+
targetBinPath: args.targetBinPath || null,
|
|
183
|
+
candidateCount: candidatePaths.length,
|
|
184
|
+
refusedCount: refused.length,
|
|
185
|
+
refused: refused,
|
|
186
|
+
importedCount: imported.length,
|
|
187
|
+
imported: imported
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
} catch (e) {
|
|
191
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
192
|
+
}
|
|
193
|
+
}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
// Command: import-image-sequence → ppb_importImageSequence
|
|
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 track-targeting.ts import_image_sequence
|
|
7
|
+
// tool. Imports a numbered image sequence as ONE clip via importFiles'
|
|
8
|
+
// 4th argument (asNumberedStills=true) per PREMIERE_API_NOTES.md. Same
|
|
9
|
+
// extension-allowlist/nodeId-diff verification approach as import-media.jsx
|
|
10
|
+
// (see that file's header) — duplicated under its own prefix since each
|
|
11
|
+
// lazily-loaded command file cannot rely on helpers defined only in
|
|
12
|
+
// another command file. Only the first frame's path is passed to
|
|
13
|
+
// importFiles(); Premiere itself detects the numbered sibling frames.
|
|
14
|
+
|
|
15
|
+
var PPB_IMPORT_IMAGE_SEQUENCE_ALLOWED_EXTENSIONS = [
|
|
16
|
+
"png", "jpg", "jpeg", "gif", "tiff", "tif", "bmp", "psd", "tga", "exr", "dpx", "webp"
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
function ppbImportImageSequence_extensionOf(path) {
|
|
20
|
+
var lastDot = path.lastIndexOf(".");
|
|
21
|
+
if (lastDot === -1 || lastDot === path.length - 1) {
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
return path.substring(lastDot + 1).toLowerCase();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function ppbImportImageSequence_isAllowedExtension(path) {
|
|
28
|
+
var ext = ppbImportImageSequence_extensionOf(path);
|
|
29
|
+
for (var i = 0; i < PPB_IMPORT_IMAGE_SEQUENCE_ALLOWED_EXTENSIONS.length; i++) {
|
|
30
|
+
if (ext === PPB_IMPORT_IMAGE_SEQUENCE_ALLOWED_EXTENSIONS[i]) {
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ppbImportImageSequence_snapshotNodeIds(item, depth, seen) {
|
|
38
|
+
if (depth > 32) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
try {
|
|
42
|
+
if (item.nodeId) {
|
|
43
|
+
seen[item.nodeId] = true;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
// ignore
|
|
47
|
+
}
|
|
48
|
+
if (item.children && item.children.numItems > 0) {
|
|
49
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
50
|
+
ppbImportImageSequence_snapshotNodeIds(item.children[i], depth + 1, seen);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function ppbImportImageSequence_takeSnapshot() {
|
|
56
|
+
var seen = {};
|
|
57
|
+
ppbImportImageSequence_snapshotNodeIds(app.project.rootItem, 0, seen);
|
|
58
|
+
return seen;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function ppbImportImageSequence_collectNew(item, depth, beforeSnapshot, out) {
|
|
62
|
+
if (depth > 32) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
if (item.nodeId && !beforeSnapshot[item.nodeId]) {
|
|
67
|
+
var entry = { name: null, nodeId: null, treePath: null, mediaPath: null };
|
|
68
|
+
try { entry.name = item.name; } catch (e) { entry.name = null; }
|
|
69
|
+
try { entry.nodeId = item.nodeId; } catch (e) { entry.nodeId = null; }
|
|
70
|
+
try { entry.treePath = item.treePath; } catch (e) { entry.treePath = null; }
|
|
71
|
+
try { entry.mediaPath = item.getMediaPath(); } catch (e) { entry.mediaPath = null; }
|
|
72
|
+
out.push(entry);
|
|
73
|
+
}
|
|
74
|
+
} catch (e) {
|
|
75
|
+
// ignore
|
|
76
|
+
}
|
|
77
|
+
if (item.children && item.children.numItems > 0) {
|
|
78
|
+
for (var i = 0; i < item.children.numItems; i++) {
|
|
79
|
+
ppbImportImageSequence_collectNew(item.children[i], depth + 1, beforeSnapshot, out);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function ppbImportImageSequence_resolveBinPath(binPath) {
|
|
85
|
+
var segments = binPath.split("/").filter(function (s) { return s.length > 0; });
|
|
86
|
+
var current = app.project.rootItem;
|
|
87
|
+
for (var i = 0; i < segments.length; i++) {
|
|
88
|
+
var found = null;
|
|
89
|
+
for (var j = 0; j < current.children.numItems; j++) {
|
|
90
|
+
var child = current.children[j];
|
|
91
|
+
if (child.name === segments[i] && typeof ProjectItemType !== "undefined" && child.type === ProjectItemType.BIN) {
|
|
92
|
+
found = child;
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (!found) {
|
|
97
|
+
return { error: "bin path segment \"" + segments[i] + "\" not found in \"" + binPath + "\" (target bin must already exist)" };
|
|
98
|
+
}
|
|
99
|
+
current = found;
|
|
100
|
+
}
|
|
101
|
+
return { bin: current };
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function ppb_importImageSequence(argsJson) {
|
|
105
|
+
try {
|
|
106
|
+
var args;
|
|
107
|
+
try {
|
|
108
|
+
args = JSON.parse(argsJson);
|
|
109
|
+
} catch (e) {
|
|
110
|
+
return JSON.stringify({ ok: false, error: "invalid args JSON: " + e.toString() });
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (!args.firstFramePath || typeof args.firstFramePath !== "string") {
|
|
114
|
+
return JSON.stringify({ ok: false, error: "firstFramePath is required" });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
if (!app.project) {
|
|
118
|
+
return JSON.stringify({ ok: false, error: "no project open" });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (!ppbImportImageSequence_isAllowedExtension(args.firstFramePath)) {
|
|
122
|
+
return JSON.stringify({
|
|
123
|
+
ok: false,
|
|
124
|
+
error: "refusing to import — firstFramePath does not have a recognized image extension (an unsupported " +
|
|
125
|
+
"format can pop a BLOCKING dialog that freezes the Premiere Bridge panel): " + args.firstFramePath,
|
|
126
|
+
allowedExtensions: PPB_IMPORT_IMAGE_SEQUENCE_ALLOWED_EXTENSIONS
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
var targetBin = app.project.rootItem;
|
|
131
|
+
if (typeof args.targetBinPath === "string" && args.targetBinPath.length > 0) {
|
|
132
|
+
var resolved = ppbImportImageSequence_resolveBinPath(args.targetBinPath);
|
|
133
|
+
if (resolved.error) {
|
|
134
|
+
return JSON.stringify({ ok: false, error: resolved.error });
|
|
135
|
+
}
|
|
136
|
+
targetBin = resolved.bin;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
var before = ppbImportImageSequence_takeSnapshot();
|
|
140
|
+
|
|
141
|
+
try {
|
|
142
|
+
app.project.importFiles([args.firstFramePath], true, targetBin, true);
|
|
143
|
+
} catch (e) {
|
|
144
|
+
return JSON.stringify({ ok: false, error: "app.project.importFiles() threw: " + e.toString() });
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
var imported = [];
|
|
148
|
+
ppbImportImageSequence_collectNew(app.project.rootItem, 0, before, imported);
|
|
149
|
+
|
|
150
|
+
if (imported.length === 0) {
|
|
151
|
+
return JSON.stringify({
|
|
152
|
+
ok: false,
|
|
153
|
+
error: "importFiles() did not throw, but no new project item appeared (nodeId-diff found nothing)",
|
|
154
|
+
firstFramePath: args.firstFramePath
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
return JSON.stringify({
|
|
159
|
+
ok: true,
|
|
160
|
+
result: {
|
|
161
|
+
firstFramePath: args.firstFramePath,
|
|
162
|
+
targetBinPath: args.targetBinPath || null,
|
|
163
|
+
asNumberedStills: true,
|
|
164
|
+
importedCount: imported.length,
|
|
165
|
+
imported: imported
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
} catch (e) {
|
|
169
|
+
return JSON.stringify({ ok: false, error: e.toString() });
|
|
170
|
+
}
|
|
171
|
+
}
|