@originator/playflow 1.3.0 → 1.4.0
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.
- package/dist/playflow.js +124 -2
- package/package.json +1 -1
package/dist/playflow.js
CHANGED
|
@@ -227,6 +227,54 @@ async function promptRunAgain() {
|
|
|
227
227
|
rl.close();
|
|
228
228
|
}
|
|
229
229
|
}
|
|
230
|
+
function tryWindowsFolderPicker() {
|
|
231
|
+
if (process.platform !== "win32")
|
|
232
|
+
return null;
|
|
233
|
+
try {
|
|
234
|
+
const tempScript = path_1.default.join((0, os_1.tmpdir)(), `playflow-folder-picker-${Date.now()}.ps1`);
|
|
235
|
+
const psScript = `Add-Type -AssemblyName System.Windows.Forms; $dialog = New-Object System.Windows.Forms.FolderBrowserDialog; $dialog.Description = "Select a folder to save the video"; if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { Write-Output $dialog.SelectedPath }`;
|
|
236
|
+
fs_1.default.writeFileSync(tempScript, psScript, "utf8");
|
|
237
|
+
try {
|
|
238
|
+
const result = (0, child_process_1.execSync)(`powershell -ExecutionPolicy Bypass -File "${tempScript}"`, { stdio: ["ignore", "pipe", "ignore"], encoding: "utf8" })
|
|
239
|
+
.trim();
|
|
240
|
+
return result || null;
|
|
241
|
+
}
|
|
242
|
+
finally {
|
|
243
|
+
try {
|
|
244
|
+
fs_1.default.unlinkSync(tempScript);
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
// Ignore cleanup errors
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return null;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
function tryLinuxFolderPicker() {
|
|
256
|
+
if (process.platform !== "linux")
|
|
257
|
+
return null;
|
|
258
|
+
// Try zenity first (GNOME)
|
|
259
|
+
try {
|
|
260
|
+
const result = (0, child_process_1.execSync)('zenity --file-selection --title="Select a folder to save the video" --directory', { stdio: ["ignore", "pipe", "ignore"] })
|
|
261
|
+
.toString("utf8")
|
|
262
|
+
.trim();
|
|
263
|
+
return result || null;
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
// Try kdialog (KDE)
|
|
267
|
+
try {
|
|
268
|
+
const result = (0, child_process_1.execSync)('kdialog --getexistingdirectory . --title "Select a folder to save the video"', { stdio: ["ignore", "pipe", "ignore"] })
|
|
269
|
+
.toString("utf8")
|
|
270
|
+
.trim();
|
|
271
|
+
return result || null;
|
|
272
|
+
}
|
|
273
|
+
catch {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
230
278
|
function tryMacFolderPicker() {
|
|
231
279
|
if (process.platform !== "darwin")
|
|
232
280
|
return null;
|
|
@@ -240,8 +288,21 @@ function tryMacFolderPicker() {
|
|
|
240
288
|
return null;
|
|
241
289
|
}
|
|
242
290
|
}
|
|
291
|
+
function tryFolderPicker() {
|
|
292
|
+
// Try platform-specific folder pickers
|
|
293
|
+
if (process.platform === "darwin") {
|
|
294
|
+
return tryMacFolderPicker();
|
|
295
|
+
}
|
|
296
|
+
if (process.platform === "win32") {
|
|
297
|
+
return tryWindowsFolderPicker();
|
|
298
|
+
}
|
|
299
|
+
if (process.platform === "linux") {
|
|
300
|
+
return tryLinuxFolderPicker();
|
|
301
|
+
}
|
|
302
|
+
return null;
|
|
303
|
+
}
|
|
243
304
|
async function promptForFolderPath(prompt) {
|
|
244
|
-
const picked =
|
|
305
|
+
const picked = tryFolderPicker();
|
|
245
306
|
if (picked)
|
|
246
307
|
return picked;
|
|
247
308
|
const rl = readline_1.default.createInterface({
|
|
@@ -343,6 +404,54 @@ function isUrl(value) {
|
|
|
343
404
|
function askQuestion(rl, prompt) {
|
|
344
405
|
return new Promise((resolve) => rl.question(prompt, resolve));
|
|
345
406
|
}
|
|
407
|
+
function tryWindowsFilePicker() {
|
|
408
|
+
if (process.platform !== "win32")
|
|
409
|
+
return null;
|
|
410
|
+
try {
|
|
411
|
+
const tempScript = path_1.default.join((0, os_1.tmpdir)(), `playflow-picker-${Date.now()}.ps1`);
|
|
412
|
+
const psScript = `Add-Type -AssemblyName System.Windows.Forms; $dialog = New-Object System.Windows.Forms.OpenFileDialog; $dialog.Filter = "JSON files (*.json)|*.json|All files (*.*)|*.*"; $dialog.Title = "Select a Playflow JSON file"; if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) { Write-Output $dialog.FileName }`;
|
|
413
|
+
fs_1.default.writeFileSync(tempScript, psScript, "utf8");
|
|
414
|
+
try {
|
|
415
|
+
const result = (0, child_process_1.execSync)(`powershell -ExecutionPolicy Bypass -File "${tempScript}"`, { stdio: ["ignore", "pipe", "ignore"], encoding: "utf8" })
|
|
416
|
+
.trim();
|
|
417
|
+
return result || null;
|
|
418
|
+
}
|
|
419
|
+
finally {
|
|
420
|
+
try {
|
|
421
|
+
fs_1.default.unlinkSync(tempScript);
|
|
422
|
+
}
|
|
423
|
+
catch {
|
|
424
|
+
// Ignore cleanup errors
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
catch {
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function tryLinuxFilePicker() {
|
|
433
|
+
if (process.platform !== "linux")
|
|
434
|
+
return null;
|
|
435
|
+
// Try zenity first (GNOME)
|
|
436
|
+
try {
|
|
437
|
+
const result = (0, child_process_1.execSync)('zenity --file-selection --title="Select a Playflow JSON file" --file-filter="*.json"', { stdio: ["ignore", "pipe", "ignore"] })
|
|
438
|
+
.toString("utf8")
|
|
439
|
+
.trim();
|
|
440
|
+
return result || null;
|
|
441
|
+
}
|
|
442
|
+
catch {
|
|
443
|
+
// Try kdialog (KDE)
|
|
444
|
+
try {
|
|
445
|
+
const result = (0, child_process_1.execSync)('kdialog --getopenfilename . "*.json|JSON files" --title "Select a Playflow JSON file"', { stdio: ["ignore", "pipe", "ignore"] })
|
|
446
|
+
.toString("utf8")
|
|
447
|
+
.trim();
|
|
448
|
+
return result || null;
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
return null;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
}
|
|
346
455
|
function tryMacFilePicker() {
|
|
347
456
|
if (process.platform !== "darwin")
|
|
348
457
|
return null;
|
|
@@ -356,8 +465,21 @@ function tryMacFilePicker() {
|
|
|
356
465
|
return null;
|
|
357
466
|
}
|
|
358
467
|
}
|
|
468
|
+
function tryFilePicker() {
|
|
469
|
+
// Try platform-specific file pickers
|
|
470
|
+
if (process.platform === "darwin") {
|
|
471
|
+
return tryMacFilePicker();
|
|
472
|
+
}
|
|
473
|
+
if (process.platform === "win32") {
|
|
474
|
+
return tryWindowsFilePicker();
|
|
475
|
+
}
|
|
476
|
+
if (process.platform === "linux") {
|
|
477
|
+
return tryLinuxFilePicker();
|
|
478
|
+
}
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
359
481
|
async function promptForFilePath(rl) {
|
|
360
|
-
const picked =
|
|
482
|
+
const picked = tryFilePicker();
|
|
361
483
|
if (picked)
|
|
362
484
|
return picked;
|
|
363
485
|
while (true) {
|