miriad-viz 0.13.13 → 0.13.14
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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/cli/guided/resolve-audio-dir.ts
|
|
2
|
+
import { existsSync, readdirSync } from "fs";
|
|
3
|
+
import { resolve } from "path";
|
|
4
|
+
var AUDIO_EXTENSIONS = /\.(mp3|wav|ogg|m4a)$/i;
|
|
5
|
+
function hasAudioFiles(dir) {
|
|
6
|
+
if (!existsSync(dir)) return false;
|
|
7
|
+
try {
|
|
8
|
+
return readdirSync(dir).some((f) => AUDIO_EXTENSIONS.test(f));
|
|
9
|
+
} catch {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function resolveAudioDir(projectDir) {
|
|
14
|
+
const primary = resolve(projectDir, "audio");
|
|
15
|
+
const fallback = resolve(projectDir, "data", "audio");
|
|
16
|
+
if (hasAudioFiles(primary)) return primary;
|
|
17
|
+
if (existsSync(fallback)) return fallback;
|
|
18
|
+
return primary;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
resolveAudioDir
|
|
23
|
+
};
|
package/dist-cli/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveAudioDir
|
|
3
|
+
} from "./chunk-KP27GWEA.js";
|
|
1
4
|
import {
|
|
2
5
|
canSync,
|
|
3
6
|
getBoardSyncConfig,
|
|
@@ -979,6 +982,7 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
|
|
|
979
982
|
}
|
|
980
983
|
if (step === "voices") {
|
|
981
984
|
const VOICE_AUDIO_PREFIX = "audio/";
|
|
985
|
+
const VOICE_AUDIO_PREFIX_ALT = "data/audio/";
|
|
982
986
|
if (flags["skip-audio"]) {
|
|
983
987
|
progress.steps.voices = {
|
|
984
988
|
status: "complete",
|
|
@@ -995,7 +999,7 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
|
|
|
995
999
|
}
|
|
996
1000
|
if (flags["voices-approved"]) {
|
|
997
1001
|
const audioFiles = existingFiles.filter(
|
|
998
|
-
(f) => f.startsWith(VOICE_AUDIO_PREFIX) && f.endsWith(".mp3")
|
|
1002
|
+
(f) => (f.startsWith(VOICE_AUDIO_PREFIX) || f.startsWith(VOICE_AUDIO_PREFIX_ALT)) && f.endsWith(".mp3")
|
|
999
1003
|
);
|
|
1000
1004
|
if (audioFiles.length === 0) {
|
|
1001
1005
|
output.push(
|
|
@@ -1025,7 +1029,7 @@ function computeNext(progress, existingFiles, logTails, flags = {}, dataSummary,
|
|
|
1025
1029
|
}
|
|
1026
1030
|
if (state.status === "in_progress") {
|
|
1027
1031
|
const audioFiles = existingFiles.filter(
|
|
1028
|
-
(f) => f.startsWith(VOICE_AUDIO_PREFIX) && f.endsWith(".mp3")
|
|
1032
|
+
(f) => (f.startsWith(VOICE_AUDIO_PREFIX) || f.startsWith(VOICE_AUDIO_PREFIX_ALT)) && f.endsWith(".mp3")
|
|
1029
1033
|
);
|
|
1030
1034
|
if (audioFiles.length > 0) {
|
|
1031
1035
|
output.push("", `\u{1F3B5} Voice clips found (${audioFiles.length}):`);
|
|
@@ -1629,6 +1633,7 @@ function gatherAudioFiles(projectDir) {
|
|
|
1629
1633
|
}
|
|
1630
1634
|
};
|
|
1631
1635
|
scanDir("audio/", "audio/");
|
|
1636
|
+
scanDir("data/audio/", "data/audio/");
|
|
1632
1637
|
scanDir(AUDIO_DIR_PREFIX, AUDIO_DIR_PREFIX);
|
|
1633
1638
|
return files;
|
|
1634
1639
|
}
|
|
@@ -1982,7 +1987,7 @@ async function main() {
|
|
|
1982
1987
|
}
|
|
1983
1988
|
const { runTransform } = await import("./transform-J2AY7XRX.js");
|
|
1984
1989
|
await runTransform({ projectDir, progress });
|
|
1985
|
-
const { runPreview: runPreview2 } = await import("./preview-
|
|
1990
|
+
const { runPreview: runPreview2 } = await import("./preview-A6V36JCT.js");
|
|
1986
1991
|
await runPreview2({ projectDir, progress, port, noOpen: flags["no-open"] === true });
|
|
1987
1992
|
break;
|
|
1988
1993
|
}
|
|
@@ -2002,17 +2007,17 @@ async function main() {
|
|
|
2002
2007
|
}
|
|
2003
2008
|
const { runTransform } = await import("./transform-J2AY7XRX.js");
|
|
2004
2009
|
await runTransform({ projectDir, progress });
|
|
2005
|
-
const { runPreview: runPreview2 } = await import("./preview-
|
|
2010
|
+
const { runPreview: runPreview2 } = await import("./preview-A6V36JCT.js");
|
|
2006
2011
|
await runPreview2({ projectDir, progress, port, noOpen: flags["no-open"] === true });
|
|
2007
2012
|
break;
|
|
2008
2013
|
}
|
|
2009
|
-
const { runPreview } = await import("./preview-
|
|
2014
|
+
const { runPreview } = await import("./preview-A6V36JCT.js");
|
|
2010
2015
|
await runPreview({ projectDir, progress, port, noOpen: flags["no-open"] === true });
|
|
2011
2016
|
break;
|
|
2012
2017
|
}
|
|
2013
2018
|
case "render": {
|
|
2014
2019
|
const { projectDir, progress } = requireProject();
|
|
2015
|
-
const { runRender } = await import("./render-
|
|
2020
|
+
const { runRender } = await import("./render-V5VHED4H.js");
|
|
2016
2021
|
await runRender({ projectDir, progress, draft: flags.draft === true });
|
|
2017
2022
|
break;
|
|
2018
2023
|
}
|
|
@@ -2049,7 +2054,7 @@ async function main() {
|
|
|
2049
2054
|
\u2717 Invalid script.json: ${message}`);
|
|
2050
2055
|
process.exit(1);
|
|
2051
2056
|
}
|
|
2052
|
-
const audioDir =
|
|
2057
|
+
const audioDir = resolveAudioDir(projectDir);
|
|
2053
2058
|
let clipDurations;
|
|
2054
2059
|
try {
|
|
2055
2060
|
clipDurations = readAudioDurations(audioDir);
|
|
@@ -2113,7 +2118,7 @@ async function main() {
|
|
|
2113
2118
|
\u2717 Invalid script.json: ${message}`);
|
|
2114
2119
|
process.exit(1);
|
|
2115
2120
|
}
|
|
2116
|
-
const audioDir =
|
|
2121
|
+
const audioDir = resolveAudioDir(projectDir);
|
|
2117
2122
|
let clipDurations;
|
|
2118
2123
|
try {
|
|
2119
2124
|
clipDurations = readAudioDurations(audioDir);
|
|
@@ -2240,5 +2245,6 @@ main().catch((err) => {
|
|
|
2240
2245
|
process.exit(1);
|
|
2241
2246
|
});
|
|
2242
2247
|
export {
|
|
2248
|
+
gatherAudioFiles,
|
|
2243
2249
|
gatherDensityData
|
|
2244
2250
|
};
|
|
@@ -2,6 +2,9 @@ import {
|
|
|
2
2
|
resolvePackageRoot,
|
|
3
3
|
scaffoldTemplate
|
|
4
4
|
} from "./chunk-XI2U2ON3.js";
|
|
5
|
+
import {
|
|
6
|
+
resolveAudioDir
|
|
7
|
+
} from "./chunk-KP27GWEA.js";
|
|
5
8
|
import {
|
|
6
9
|
markComplete,
|
|
7
10
|
writeProgress
|
|
@@ -74,7 +77,7 @@ async function runPreview(options) {
|
|
|
74
77
|
return;
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
|
-
const audioDir =
|
|
80
|
+
const audioDir = resolveAudioDir(projectDir);
|
|
78
81
|
const dataDir = resolve(projectDir, progress.project.dataDir);
|
|
79
82
|
const copyResult = copyPreviewAssets({ outputDir: outDir, dataDir, audioDir, viewerDir });
|
|
80
83
|
if (copyResult.copiedVizData) {
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import {
|
|
2
|
+
resolveAudioDir
|
|
3
|
+
} from "./chunk-KP27GWEA.js";
|
|
1
4
|
import {
|
|
2
5
|
canSync,
|
|
3
6
|
getBoardSyncConfig,
|
|
@@ -267,7 +270,7 @@ async function runRender(options) {
|
|
|
267
270
|
mkdirSync(remotionDataDir, { recursive: true });
|
|
268
271
|
copyFileSync(vizDataPath, resolve(remotionDataDir, "viz-data.json"));
|
|
269
272
|
console.log(" \u2713 Copied viz-data.json to remotion/public/data/");
|
|
270
|
-
const sourceAudioDir =
|
|
273
|
+
const sourceAudioDir = resolveAudioDir(projectDir);
|
|
271
274
|
const remotionAudioDir = resolve(remotionDir, "public", "audio");
|
|
272
275
|
const sourceAudioFiles = getAudioFiles(sourceAudioDir);
|
|
273
276
|
if (sourceAudioFiles.length > 0) {
|