automovie 0.3.3 → 0.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/README.md +40 -139
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js +6 -2
- package/lib/AUTOMOVIE_CAPTURE_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.d.ts +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js +3 -1
- package/lib/AUTOMOVIE_DEFAULT_PROJECT_NAME.js.map +1 -1
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.d.ts +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js +5 -2
- package/lib/AUTOMOVIE_INSPECT_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_RENDER_OPTIONS.d.ts +6 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js +8 -2
- package/lib/AUTOMOVIE_RENDER_OPTIONS.js.map +1 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.d.ts +3 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js +12 -1
- package/lib/AUTOMOVIE_REVIEW_OPTIONS.js.map +1 -1
- package/lib/AutoMovieCaptureBackend.d.ts +4 -6
- package/lib/AutoMovieCaptureHost.d.ts +73 -53
- package/lib/AutoMovieCaptureHost.js +89 -56
- package/lib/AutoMovieCaptureHost.js.map +1 -1
- package/lib/AutoMovieCommand.d.ts +69 -20
- package/lib/AutoMovieFfmpegStaticPath.d.ts +6 -0
- package/lib/AutoMovieFfmpegStaticPath.js +3 -0
- package/lib/AutoMovieFfmpegStaticPath.js.map +1 -0
- package/lib/AutoMovieMp4Boxes.d.ts +78 -0
- package/lib/AutoMovieMp4Boxes.js +227 -0
- package/lib/AutoMovieMp4Boxes.js.map +1 -0
- package/lib/AutoMovieRenderOutputReservation.d.ts +18 -0
- package/lib/AutoMovieRenderOutputReservation.js +118 -0
- package/lib/AutoMovieRenderOutputReservation.js.map +1 -0
- package/lib/IAutoMovieChromium.d.ts +13 -57
- package/lib/IAutoMovieDeliveryAudioTrack.d.ts +17 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js +3 -0
- package/lib/IAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/IAutoMovieDeliveryProfileFinding.d.ts +21 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js +3 -0
- package/lib/IAutoMovieDeliveryProfileFinding.js.map +1 -0
- package/lib/IAutoMovieFfmpegSources.d.ts +11 -0
- package/lib/IAutoMovieFfmpegSources.js +3 -0
- package/lib/IAutoMovieFfmpegSources.js.map +1 -0
- package/lib/IAutoMovieReviewObservation.d.ts +66 -0
- package/lib/IAutoMovieReviewObservation.js +3 -0
- package/lib/IAutoMovieReviewObservation.js.map +1 -0
- package/lib/IAutoMovieVerification.d.ts +163 -0
- package/lib/IAutoMovieVerification.js +3 -0
- package/lib/IAutoMovieVerification.js.map +1 -0
- package/lib/auditAutoMovieAlphaSamples.d.ts +23 -0
- package/lib/auditAutoMovieAlphaSamples.js +183 -0
- package/lib/auditAutoMovieAlphaSamples.js.map +1 -0
- package/lib/auditAutoMovieDeliveryProfile.d.ts +33 -0
- package/lib/auditAutoMovieDeliveryProfile.js +93 -0
- package/lib/auditAutoMovieDeliveryProfile.js.map +1 -0
- package/lib/captureAutoMovie.d.ts +23 -11
- package/lib/captureAutoMovie.js +102 -18
- package/lib/captureAutoMovie.js.map +1 -1
- package/lib/createAutoMovieDeliveryAudioLog.d.ts +31 -0
- package/lib/createAutoMovieDeliveryAudioLog.js +110 -0
- package/lib/createAutoMovieDeliveryAudioLog.js.map +1 -0
- package/lib/createAutoMovieDeliveryAudioScan.d.ts +39 -0
- package/lib/createAutoMovieDeliveryAudioScan.js +125 -0
- package/lib/createAutoMovieDeliveryAudioScan.js.map +1 -0
- package/lib/createAutoMovieVerificationInputScope.d.ts +19 -0
- package/lib/createAutoMovieVerificationInputScope.js +147 -0
- package/lib/createAutoMovieVerificationInputScope.js.map +1 -0
- package/lib/createAutoMovieVerificationMediaHash.d.ts +5 -0
- package/lib/createAutoMovieVerificationMediaHash.js +61 -0
- package/lib/createAutoMovieVerificationMediaHash.js.map +1 -0
- package/lib/decodeAutoMovieDeliveryAudio.d.ts +24 -0
- package/lib/decodeAutoMovieDeliveryAudio.js +77 -0
- package/lib/decodeAutoMovieDeliveryAudio.js.map +1 -0
- package/lib/deriveAutoMovieProjectName.d.ts +14 -11
- package/lib/deriveAutoMovieProjectName.js +14 -11
- package/lib/deriveAutoMovieProjectName.js.map +1 -1
- package/lib/findAutoMovieFreePort.d.ts +5 -10
- package/lib/findAutoMovieFreePort.js +5 -10
- package/lib/findAutoMovieFreePort.js.map +1 -1
- package/lib/formatAutoMovieInspectUrl.d.ts +6 -10
- package/lib/formatAutoMovieInspectUrl.js +6 -10
- package/lib/formatAutoMovieInspectUrl.js.map +1 -1
- package/lib/hashAutoMovieFile.d.ts +5 -0
- package/lib/hashAutoMovieFile.js +16 -0
- package/lib/hashAutoMovieFile.js.map +1 -0
- package/lib/importAutoMovieVerificationEntry.d.mts +2 -0
- package/lib/importAutoMovieVerificationEntry.mjs +6 -0
- package/lib/importAutoMovieVerificationEntry.mjs.map +1 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/index.js.map +1 -1
- package/lib/inspectAutoMovie.d.ts +15 -9
- package/lib/inspectAutoMovie.js +25 -9
- package/lib/inspectAutoMovie.js.map +1 -1
- package/lib/inspectAutoMovieVerificationCapture.d.ts +15 -0
- package/lib/inspectAutoMovieVerificationCapture.js +221 -0
- package/lib/inspectAutoMovieVerificationCapture.js.map +1 -0
- package/lib/inspectAutoMovieVerificationDelivery.d.ts +13 -0
- package/lib/inspectAutoMovieVerificationDelivery.js +247 -0
- package/lib/inspectAutoMovieVerificationDelivery.js.map +1 -0
- package/lib/inspectAutoMovieVerificationReview.d.ts +11 -0
- package/lib/inspectAutoMovieVerificationReview.js +141 -0
- package/lib/inspectAutoMovieVerificationReview.js.map +1 -0
- package/lib/launchAutoMovieChromium.d.ts +9 -11
- package/lib/launchAutoMovieChromium.js +10 -11
- package/lib/launchAutoMovieChromium.js.map +1 -1
- package/lib/listAutoMovieReleaseFindings.d.ts +9 -0
- package/lib/listAutoMovieReleaseFindings.js +58 -0
- package/lib/listAutoMovieReleaseFindings.js.map +1 -0
- package/lib/loadAutoMovieProductionModule.d.ts +11 -10
- package/lib/loadAutoMovieProductionModule.js +18 -10
- package/lib/loadAutoMovieProductionModule.js.map +1 -1
- package/lib/loadAutoMovieVerificationModule.d.ts +6 -0
- package/lib/loadAutoMovieVerificationModule.js +246 -0
- package/lib/loadAutoMovieVerificationModule.js.map +1 -0
- package/lib/planAutoMovieChromiumLaunch.d.ts +7 -13
- package/lib/planAutoMovieChromiumLaunch.js +7 -13
- package/lib/planAutoMovieChromiumLaunch.js.map +1 -1
- package/lib/planAutoMovieDeliveryAudioDecode.d.ts +10 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js +29 -0
- package/lib/planAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/planAutoMovieDeliveryDecode.js +57 -0
- package/lib/planAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/planAutoMovieDeliveryInput.d.ts +11 -0
- package/lib/planAutoMovieDeliveryInput.js +26 -0
- package/lib/planAutoMovieDeliveryInput.js.map +1 -0
- package/lib/planAutoMovieModulePageViteConfig.d.ts +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js +13 -10
- package/lib/planAutoMovieModulePageViteConfig.js.map +1 -1
- package/lib/promptAutoMovieProjectName.d.ts +6 -10
- package/lib/promptAutoMovieProjectName.js +6 -10
- package/lib/promptAutoMovieProjectName.js.map +1 -1
- package/lib/publishAutoMovieRenderAttempt.d.ts +32 -0
- package/lib/publishAutoMovieRenderAttempt.js +91 -0
- package/lib/publishAutoMovieRenderAttempt.js.map +1 -0
- package/lib/readAutoMovieAddArguments.d.ts +10 -11
- package/lib/readAutoMovieAddArguments.js +10 -11
- package/lib/readAutoMovieAddArguments.js.map +1 -1
- package/lib/readAutoMovieCaptureHostOptions.d.ts +19 -17
- package/lib/readAutoMovieCaptureHostOptions.js +16 -17
- package/lib/readAutoMovieCaptureHostOptions.js.map +1 -1
- package/lib/readAutoMovieCommandArguments.d.ts +6 -9
- package/lib/readAutoMovieCommandArguments.js +9 -10
- package/lib/readAutoMovieCommandArguments.js.map +1 -1
- package/lib/readAutoMovieCreateArguments.d.ts +7 -11
- package/lib/readAutoMovieCreateArguments.js +7 -11
- package/lib/readAutoMovieCreateArguments.js.map +1 -1
- package/lib/readAutoMovieDeliveryAudioTrack.d.ts +21 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js +104 -0
- package/lib/readAutoMovieDeliveryAudioTrack.js.map +1 -0
- package/lib/readAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/readAutoMovieDeliveryDecode.js +209 -0
- package/lib/readAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/readAutoMovieDeliveryProbe.d.ts +35 -0
- package/lib/readAutoMovieDeliveryProbe.js +363 -0
- package/lib/readAutoMovieDeliveryProbe.js.map +1 -0
- package/lib/readAutoMovieErrorCode.d.ts +9 -0
- package/lib/readAutoMovieErrorCode.js +18 -0
- package/lib/readAutoMovieErrorCode.js.map +1 -0
- package/lib/readAutoMovieInspectHostOptions.d.ts +15 -16
- package/lib/readAutoMovieInspectHostOptions.js +11 -15
- package/lib/readAutoMovieInspectHostOptions.js.map +1 -1
- package/lib/readAutoMovieNameOption.d.ts +4 -10
- package/lib/readAutoMovieNameOption.js +4 -10
- package/lib/readAutoMovieNameOption.js.map +1 -1
- package/lib/readAutoMoviePageTimeout.d.ts +13 -0
- package/lib/readAutoMoviePageTimeout.js +21 -0
- package/lib/readAutoMoviePageTimeout.js.map +1 -0
- package/lib/readAutoMovieRenderOptions.d.ts +24 -16
- package/lib/readAutoMovieRenderOptions.js +23 -16
- package/lib/readAutoMovieRenderOptions.js.map +1 -1
- package/lib/readAutoMovieReviewObservation.d.ts +6 -0
- package/lib/readAutoMovieReviewObservation.js +108 -0
- package/lib/readAutoMovieReviewObservation.js.map +1 -0
- package/lib/readAutoMovieReviewOptions.d.ts +32 -24
- package/lib/readAutoMovieReviewOptions.js +82 -18
- package/lib/readAutoMovieReviewOptions.js.map +1 -1
- package/lib/readAutoMovieRevision.d.ts +3 -9
- package/lib/readAutoMovieRevision.js +3 -9
- package/lib/readAutoMovieRevision.js.map +1 -1
- package/lib/readAutoMovieVerifyOptions.d.ts +17 -0
- package/lib/readAutoMovieVerifyOptions.js +45 -0
- package/lib/readAutoMovieVerifyOptions.js.map +1 -0
- package/lib/readAutoMovieVideoProbe.d.ts +6 -10
- package/lib/readAutoMovieVideoProbe.js +20 -13
- package/lib/readAutoMovieVideoProbe.js.map +1 -1
- package/lib/recordAutoMoviePlayback.d.ts +18 -11
- package/lib/recordAutoMoviePlayback.js +26 -13
- package/lib/recordAutoMoviePlayback.js.map +1 -1
- package/lib/renderAutoMovie.d.ts +16 -10
- package/lib/renderAutoMovie.js +31 -14
- package/lib/renderAutoMovie.js.map +1 -1
- package/lib/renderAutoMovieScaffoldNextSteps.d.ts +10 -10
- package/lib/renderAutoMovieScaffoldNextSteps.js +10 -10
- package/lib/renderAutoMovieVideo.d.ts +53 -15
- package/lib/renderAutoMovieVideo.js +290 -45
- package/lib/renderAutoMovieVideo.js.map +1 -1
- package/lib/resolveAutoMovieFfmpeg.d.ts +12 -15
- package/lib/resolveAutoMovieFfmpeg.js +12 -17
- package/lib/resolveAutoMovieFfmpeg.js.map +1 -1
- package/lib/reviewAutoMovie.d.ts +10 -10
- package/lib/reviewAutoMovie.js +15 -10
- package/lib/reviewAutoMovie.js.map +1 -1
- package/lib/reviewAutoMovieFile.d.ts +21 -0
- package/lib/reviewAutoMovieFile.js +378 -0
- package/lib/reviewAutoMovieFile.js.map +1 -0
- package/lib/run.d.ts +32 -18
- package/lib/run.js +67 -23
- package/lib/run.js.map +1 -1
- package/lib/runAutoMovieDeliveryAudioDecode.d.ts +18 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js +28 -0
- package/lib/runAutoMovieDeliveryAudioDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryDecode.d.ts +19 -0
- package/lib/runAutoMovieDeliveryDecode.js +42 -0
- package/lib/runAutoMovieDeliveryDecode.js.map +1 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.d.ts +28 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js +77 -0
- package/lib/runAutoMovieDeliveryReferenceDecode.js.map +1 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.d.ts +20 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js +56 -0
- package/lib/runAutoMovieDeliverySourceAudioDecode.js.map +1 -0
- package/lib/runAutoMovieFfmpeg.d.ts +15 -10
- package/lib/runAutoMovieFfmpeg.js +36 -13
- package/lib/runAutoMovieFfmpeg.js.map +1 -1
- package/lib/runAutoMovieVerification.d.ts +28 -0
- package/lib/runAutoMovieVerification.js +393 -0
- package/lib/runAutoMovieVerification.js.map +1 -0
- package/lib/sameAutoMovieReviewFile.d.ts +2 -0
- package/lib/sameAutoMovieReviewFile.js +57 -0
- package/lib/sameAutoMovieReviewFile.js.map +1 -0
- package/lib/selectAutoMovieProjectName.d.ts +8 -11
- package/lib/selectAutoMovieProjectName.js +8 -11
- package/lib/selectAutoMovieProjectName.js.map +1 -1
- package/lib/serveAutoMovieDrawPage.d.ts +14 -11
- package/lib/serveAutoMovieDrawPage.js +14 -11
- package/lib/serveAutoMovieDrawPage.js.map +1 -1
- package/lib/serveAutoMovieInspectorPage.d.ts +4 -8
- package/lib/serveAutoMovieInspectorPage.js +3 -9
- package/lib/serveAutoMovieInspectorPage.js.map +1 -1
- package/lib/verifyAutoMovie.d.ts +19 -0
- package/lib/verifyAutoMovie.js +44 -0
- package/lib/verifyAutoMovie.js.map +1 -0
- package/lib/writeAutoMovieModulePage.d.ts +17 -12
- package/lib/writeAutoMovieModulePage.js +13 -11
- package/lib/writeAutoMovieModulePage.js.map +1 -1
- package/lib/writeAutoMovieVerificationReceipt.d.ts +2 -0
- package/lib/writeAutoMovieVerificationReceipt.js +75 -0
- package/lib/writeAutoMovieVerificationReceipt.js.map +1 -0
- package/package.json +8 -8
- package/src/AUTOMOVIE_CAPTURE_OPTIONS.ts +6 -2
- package/src/AUTOMOVIE_DEFAULT_PROJECT_NAME.ts +3 -1
- package/src/AUTOMOVIE_INSPECT_OPTIONS.ts +5 -2
- package/src/AUTOMOVIE_RENDER_OPTIONS.ts +8 -2
- package/src/AUTOMOVIE_REVIEW_OPTIONS.ts +12 -1
- package/src/AutoMovieCaptureBackend.ts +4 -6
- package/src/AutoMovieCaptureHost.ts +122 -68
- package/src/AutoMovieCommand.ts +71 -20
- package/src/AutoMovieFfmpegStaticPath.ts +7 -0
- package/src/AutoMovieMp4Boxes.ts +263 -0
- package/src/AutoMovieRenderOutputReservation.ts +97 -0
- package/src/IAutoMovieChromium.ts +13 -57
- package/src/IAutoMovieDeliveryAudioTrack.ts +19 -0
- package/src/IAutoMovieDeliveryProfileFinding.ts +24 -0
- package/src/IAutoMovieFfmpegSources.ts +13 -0
- package/src/IAutoMovieReviewObservation.ts +59 -0
- package/src/IAutoMovieVerification.ts +207 -0
- package/src/auditAutoMovieAlphaSamples.ts +201 -0
- package/src/auditAutoMovieDeliveryProfile.ts +125 -0
- package/src/captureAutoMovie.ts +137 -28
- package/src/createAutoMovieDeliveryAudioLog.ts +141 -0
- package/src/createAutoMovieDeliveryAudioScan.ts +150 -0
- package/src/createAutoMovieVerificationInputScope.ts +156 -0
- package/src/createAutoMovieVerificationMediaHash.ts +32 -0
- package/src/decodeAutoMovieDeliveryAudio.ts +95 -0
- package/src/deriveAutoMovieProjectName.ts +14 -11
- package/src/findAutoMovieFreePort.ts +5 -10
- package/src/formatAutoMovieInspectUrl.ts +6 -10
- package/src/hashAutoMovieFile.ts +12 -0
- package/src/importAutoMovieVerificationEntry.mts +6 -0
- package/src/index.ts +9 -0
- package/src/inspectAutoMovie.ts +28 -11
- package/src/inspectAutoMovieVerificationCapture.ts +292 -0
- package/src/inspectAutoMovieVerificationDelivery.ts +301 -0
- package/src/inspectAutoMovieVerificationReview.ts +130 -0
- package/src/launchAutoMovieChromium.ts +14 -12
- package/src/listAutoMovieReleaseFindings.ts +87 -0
- package/src/loadAutoMovieProductionModule.ts +22 -15
- package/src/loadAutoMovieVerificationModule.ts +278 -0
- package/src/planAutoMovieChromiumLaunch.ts +7 -13
- package/src/planAutoMovieDeliveryAudioDecode.ts +26 -0
- package/src/planAutoMovieDeliveryDecode.ts +66 -0
- package/src/planAutoMovieDeliveryInput.ts +25 -0
- package/src/planAutoMovieModulePageViteConfig.ts +13 -10
- package/src/promptAutoMovieProjectName.ts +6 -10
- package/src/publishAutoMovieRenderAttempt.ts +89 -0
- package/src/readAutoMovieAddArguments.ts +10 -11
- package/src/readAutoMovieCaptureHostOptions.ts +22 -17
- package/src/readAutoMovieCommandArguments.ts +8 -10
- package/src/readAutoMovieCreateArguments.ts +7 -11
- package/src/readAutoMovieDeliveryAudioTrack.ts +137 -0
- package/src/readAutoMovieDeliveryDecode.ts +269 -0
- package/src/readAutoMovieDeliveryProbe.ts +499 -0
- package/src/readAutoMovieErrorCode.ts +13 -0
- package/src/readAutoMovieInspectHostOptions.ts +15 -16
- package/src/readAutoMovieNameOption.ts +4 -10
- package/src/readAutoMoviePageTimeout.ts +19 -0
- package/src/readAutoMovieRenderOptions.ts +34 -16
- package/src/readAutoMovieReviewObservation.ts +146 -0
- package/src/readAutoMovieReviewOptions.ts +133 -28
- package/src/readAutoMovieRevision.ts +3 -9
- package/src/readAutoMovieVerifyOptions.ts +50 -0
- package/src/readAutoMovieVideoProbe.ts +24 -13
- package/src/recordAutoMoviePlayback.ts +26 -13
- package/src/renderAutoMovie.ts +38 -17
- package/src/renderAutoMovieScaffoldNextSteps.ts +10 -10
- package/src/renderAutoMovieVideo.ts +474 -85
- package/src/resolveAutoMovieFfmpeg.ts +17 -24
- package/src/reviewAutoMovie.ts +21 -16
- package/src/reviewAutoMovieFile.ts +479 -0
- package/src/run.ts +75 -25
- package/src/runAutoMovieDeliveryAudioDecode.ts +45 -0
- package/src/runAutoMovieDeliveryDecode.ts +63 -0
- package/src/runAutoMovieDeliveryReferenceDecode.ts +107 -0
- package/src/runAutoMovieDeliverySourceAudioDecode.ts +71 -0
- package/src/runAutoMovieFfmpeg.ts +48 -14
- package/src/runAutoMovieVerification.ts +487 -0
- package/src/sameAutoMovieReviewFile.ts +23 -0
- package/src/selectAutoMovieProjectName.ts +8 -11
- package/src/serveAutoMovieDrawPage.ts +16 -12
- package/src/serveAutoMovieInspectorPage.ts +6 -9
- package/src/verifyAutoMovie.ts +67 -0
- package/src/writeAutoMovieModulePage.ts +17 -12
- package/src/writeAutoMovieVerificationReceipt.ts +51 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { BigIntStats } from "node:fs";
|
|
2
|
+
import * as fs from "node:fs/promises";
|
|
3
|
+
|
|
4
|
+
import { hashAutoMovieFile } from "./hashAutoMovieFile";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Reuse a media digest within one verification while the file identity is
|
|
8
|
+
* unchanged.
|
|
9
|
+
*/
|
|
10
|
+
export function createAutoMovieVerificationMediaHash(): (
|
|
11
|
+
file: string,
|
|
12
|
+
) => Promise<string> {
|
|
13
|
+
const cache: Map<string, { stamp: string; digest: string }> = new Map();
|
|
14
|
+
return async (file: string): Promise<string> => {
|
|
15
|
+
const before: string = await fingerprint(file);
|
|
16
|
+
const retained: { stamp: string; digest: string } | undefined =
|
|
17
|
+
cache.get(file);
|
|
18
|
+
if (retained?.stamp === before) return retained.digest;
|
|
19
|
+
const digest: string = await hashAutoMovieFile(file);
|
|
20
|
+
if ((await fingerprint(file)) !== before)
|
|
21
|
+
throw new Error(
|
|
22
|
+
`The media file changed while verifying its bytes: ${file}. Run verify again.`,
|
|
23
|
+
);
|
|
24
|
+
cache.set(file, { stamp: before, digest });
|
|
25
|
+
return digest;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function fingerprint(file: string): Promise<string> {
|
|
30
|
+
const info: BigIntStats = await fs.stat(file, { bigint: true });
|
|
31
|
+
return `${info.dev}:${info.ino}:${info.size}:${info.mtimeNs}:${info.ctimeNs}`;
|
|
32
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieDeliveryContentAudit,
|
|
3
|
+
IAutoMovieLoudnessMeter,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
|
|
6
|
+
import { createAutoMovieDeliveryAudioLog } from "./createAutoMovieDeliveryAudioLog";
|
|
7
|
+
import { createAutoMovieDeliveryAudioScan } from "./createAutoMovieDeliveryAudioScan";
|
|
8
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
9
|
+
|
|
10
|
+
/** Caps PCM received before the first matching frame log reaches the other pipe. */
|
|
11
|
+
const MAXIMUM_PENDING_PCM = 1024 * 1024;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Runs one FFmpeg audio decode that writes f32le PCM to stdout and an
|
|
15
|
+
* `ashowinfo` frame log to stderr, and feeds both to the frame log and the
|
|
16
|
+
* silence scan, which also feeds the presented PCM to the loudness meter.
|
|
17
|
+
*
|
|
18
|
+
* @param binary The FFmpeg executable already resolved by the delivery host.
|
|
19
|
+
* @param args Decode arguments whose PCM and frame log describe the same
|
|
20
|
+
* samples.
|
|
21
|
+
* @param streamIndex The stream index reported with the evidence.
|
|
22
|
+
* @param thresholds The audio silence threshold and minimum duration.
|
|
23
|
+
* @param run The established FFmpeg process owner with separate output
|
|
24
|
+
* consumers.
|
|
25
|
+
* @param presented The container's presented span, or undefined when every
|
|
26
|
+
* decoded sample is presented.
|
|
27
|
+
* @param meter Creates the render's loudness meter, when the presented PCM's
|
|
28
|
+
* loudness and true peak are measured.
|
|
29
|
+
* @returns Audio evidence or a reason decoded content is uncovered.
|
|
30
|
+
*/
|
|
31
|
+
export async function decodeAutoMovieDeliveryAudio(
|
|
32
|
+
binary: string,
|
|
33
|
+
args: string[],
|
|
34
|
+
streamIndex: number,
|
|
35
|
+
thresholds: IAutoMovieDeliveryContentAudit.IThresholds["silence"],
|
|
36
|
+
run: typeof runAutoMovieFfmpeg,
|
|
37
|
+
presented: { timescale: number; duration: number } | undefined,
|
|
38
|
+
meter?: (channels: 1 | 2) => IAutoMovieLoudnessMeter,
|
|
39
|
+
): Promise<IAutoMovieDeliveryContentAudit.Stream> {
|
|
40
|
+
const audioLog = createAutoMovieDeliveryAudioLog();
|
|
41
|
+
let partialLine = "";
|
|
42
|
+
let pendingBytes = 0;
|
|
43
|
+
const pending: Buffer[] = [];
|
|
44
|
+
const state: { scan?: ReturnType<typeof createAutoMovieDeliveryAudioScan> } =
|
|
45
|
+
{};
|
|
46
|
+
|
|
47
|
+
const consumeLine = (line: string): void => {
|
|
48
|
+
audioLog.push(line);
|
|
49
|
+
const format = audioLog.format();
|
|
50
|
+
if (state.scan !== undefined || format === undefined) return;
|
|
51
|
+
state.scan = createAutoMovieDeliveryAudioScan(
|
|
52
|
+
format,
|
|
53
|
+
thresholds,
|
|
54
|
+
presented?.duration ?? Number.MAX_SAFE_INTEGER,
|
|
55
|
+
meter,
|
|
56
|
+
);
|
|
57
|
+
for (const chunk of pending) state.scan.push(chunk);
|
|
58
|
+
pending.length = 0;
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
try {
|
|
62
|
+
await run(binary, args, undefined, {
|
|
63
|
+
stdout(chunk): void {
|
|
64
|
+
if (state.scan !== undefined) {
|
|
65
|
+
state.scan.push(chunk);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
pendingBytes += chunk.length;
|
|
69
|
+
if (pendingBytes > MAXIMUM_PENDING_PCM)
|
|
70
|
+
throw new Error(
|
|
71
|
+
"The decoded audio sample format was not established",
|
|
72
|
+
);
|
|
73
|
+
pending.push(chunk);
|
|
74
|
+
},
|
|
75
|
+
stderr(chunk): void {
|
|
76
|
+
const lines = (partialLine + chunk).split(/\r?\n/u);
|
|
77
|
+
partialLine = lines.pop() ?? "";
|
|
78
|
+
for (const line of lines) consumeLine(line);
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
if (partialLine.length > 0) consumeLine(partialLine);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
return {
|
|
84
|
+
status: "uncovered",
|
|
85
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
if (state.scan === undefined)
|
|
90
|
+
return {
|
|
91
|
+
status: "uncovered",
|
|
92
|
+
reason: "No decoded audio sample format was established",
|
|
93
|
+
};
|
|
94
|
+
return audioLog.finish(streamIndex, state.scan.finish(), presented);
|
|
95
|
+
}
|
|
@@ -6,19 +6,22 @@ import { AUTOMOVIE_DEFAULT_PROJECT_NAME } from "./AUTOMOVIE_DEFAULT_PROJECT_NAME
|
|
|
6
6
|
const NPM_NAME_LIMIT: number = 214;
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* Derive a lowercase project-name candidate from the target directory's
|
|
9
|
+
* Derive a lowercase project-name candidate from the target directory's
|
|
10
|
+
* basename.
|
|
10
11
|
*
|
|
11
|
-
* The basename is lowercased, each run of characters other than `a-z`, `0-9`,
|
|
12
|
+
* The basename is lowercased, each run of characters other than `a-z`, `0-9`,
|
|
13
|
+
* `.`, `_` and `-` becomes one `-`, the result is cut to npm's 214-character
|
|
14
|
+
* limit, and leading `-`, `.` or `_` and trailing `-` or `.` are removed. A
|
|
15
|
+
* basename with nothing left, such as a filesystem root, yields
|
|
16
|
+
* `AUTOMOVIE_DEFAULT_PROJECT_NAME`. `selectAutoMovieProjectName` passes a
|
|
17
|
+
* `create` request's absolute target, `run` passes an `add` request's directory
|
|
18
|
+
* segment, and `run` hands the result to the template renderer as the project
|
|
19
|
+
* name.
|
|
12
20
|
*
|
|
13
|
-
* This transformation does not validate npm's reserved names; `node_modules`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No directory name is special-cased; the fallback applies whenever normalization leaves an empty candidate, including an all-underscore basename whose characters are removed by leading trim.
|
|
18
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment states each transformation in order, the limit, the fallback, the caller and consumer, and the difference between an unchanged npm reserved name and a device name refused by the renderer.
|
|
19
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Time and space are linear in the basename's length: one lowercase pass, one replacement and one slice; the final trim's trailing alternative can rescan a run of `-` and `.` that does not end the string, which is quadratic only within that run and bounded by the 214-character cut.
|
|
20
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work `run` derives one name per scaffold request, so no equivalent derivation is requested twice.
|
|
21
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function returns a new string and keeps no state, handle, or task.
|
|
21
|
+
* This transformation does not validate npm's reserved names; `node_modules`
|
|
22
|
+
* and `favicon.ico` remain unchanged. Windows device names such as `con` also
|
|
23
|
+
* remain unchanged and are refused by `createAutoMovieScaffold` before any file
|
|
24
|
+
* is written.
|
|
22
25
|
*/
|
|
23
26
|
export function deriveAutoMovieProjectName(targetDir: string): string {
|
|
24
27
|
const name: string = path
|
|
@@ -1,17 +1,12 @@
|
|
|
1
1
|
import * as net from "node:net";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* A TCP port the operating system reports free on 127.0.0.1 at the moment of
|
|
4
|
+
* A TCP port the operating system reports free on 127.0.0.1 at the moment of
|
|
5
|
+
* asking, for a page server that must not take another server's port.
|
|
5
6
|
*
|
|
6
|
-
* The port is free only at that moment; the server that takes it listens with
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @evidence contracts/development/implementation.md#principled-implementation Listening on port 0 asks the operating system for an unused ephemeral port, which the address then reports.
|
|
10
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Listen, read the address, close.
|
|
11
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No fixed port is guessed.
|
|
12
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One listen and one close.
|
|
13
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each server asks once.
|
|
14
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The probing server is closed before the promise resolves.
|
|
7
|
+
* The port is free only at that moment; the server that takes it listens with
|
|
8
|
+
* `strictPort`, so a port taken meanwhile fails the start instead of moving
|
|
9
|
+
* elsewhere.
|
|
15
10
|
*/
|
|
16
11
|
export function findAutoMovieFreePort(): Promise<number> {
|
|
17
12
|
return new Promise<number>(
|
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The address of a served inspector page that opens on a request: the page's
|
|
2
|
+
* The address of a served inspector page that opens on a request: the page's
|
|
3
|
+
* base address with the request's named text values as its query.
|
|
3
4
|
*
|
|
4
|
-
* `values` are the pairs `formatAutoMovieCapturePlanRequest` writes, in its
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One encoding and one join.
|
|
9
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No key is written here; the grammar's writer chose them.
|
|
10
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in the pairs' length.
|
|
11
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A pure conversion.
|
|
12
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources Returns a fresh string and keeps nothing.
|
|
5
|
+
* `values` are the pairs `formatAutoMovieCapturePlanRequest` writes, in its
|
|
6
|
+
* order; they are joined by `URLSearchParams`, which the page reads back with
|
|
7
|
+
* the same decoder. The request that asks for nothing is the base address
|
|
8
|
+
* alone.
|
|
13
9
|
*/
|
|
14
10
|
export function formatAutoMovieInspectUrl(
|
|
15
11
|
base: string,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createReadStream } from "node:fs";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Streams the file's bytes into a lowercase SHA-256 digest and rejects a failed
|
|
6
|
+
* read.
|
|
7
|
+
*/
|
|
8
|
+
export async function hashAutoMovieFile(file: string): Promise<string> {
|
|
9
|
+
const hash = createHash("sha256");
|
|
10
|
+
for await (const chunk of createReadStream(file)) hash.update(chunk);
|
|
11
|
+
return hash.digest("hex");
|
|
12
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from "./AutoMovieCommand";
|
|
2
|
+
export * from "./IAutoMovieVerification";
|
|
3
|
+
export * from "./runAutoMovieVerification";
|
|
2
4
|
export * from "./readAutoMovieCommandArguments";
|
|
3
5
|
export * from "./deriveAutoMovieProjectName";
|
|
4
6
|
export * from "./AUTOMOVIE_DEFAULT_PROJECT_NAME";
|
|
@@ -17,9 +19,12 @@ export * from "./launchAutoMovieChromium";
|
|
|
17
19
|
export * from "./loadAutoMovieProductionModule";
|
|
18
20
|
export * from "./planAutoMovieChromiumLaunch";
|
|
19
21
|
export * from "./readAutoMovieCaptureHostOptions";
|
|
22
|
+
export * from "./readAutoMovieDeliveryProbe";
|
|
20
23
|
export * from "./readAutoMovieRevision";
|
|
21
24
|
export * from "./readAutoMovieVideoProbe";
|
|
22
25
|
export * from "./resolveAutoMovieFfmpeg";
|
|
26
|
+
export * from "./runAutoMovieDeliveryDecode";
|
|
27
|
+
export * from "./runAutoMovieDeliveryReferenceDecode";
|
|
23
28
|
export * from "./runAutoMovieFfmpeg";
|
|
24
29
|
export * from "./serveAutoMovieDrawPage";
|
|
25
30
|
export * from "./AUTOMOVIE_INSPECT_OPTIONS";
|
|
@@ -39,3 +44,7 @@ export * from "./recordAutoMoviePlayback";
|
|
|
39
44
|
export * from "./renderAutoMovie";
|
|
40
45
|
export * from "./renderAutoMovieVideo";
|
|
41
46
|
export * from "./reviewAutoMovie";
|
|
47
|
+
export * from "./IAutoMovieReviewObservation";
|
|
48
|
+
export * from "./hashAutoMovieFile";
|
|
49
|
+
export * from "./readAutoMovieReviewObservation";
|
|
50
|
+
export * from "./reviewAutoMovieFile";
|
package/src/inspectAutoMovie.ts
CHANGED
|
@@ -9,17 +9,23 @@ import { readAutoMovieInspectHostOptions } from "./readAutoMovieInspectHostOptio
|
|
|
9
9
|
import { serveAutoMovieInspectorPage } from "./serveAutoMovieInspectorPage";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Run `automovie inspect` in a production or package: serve the inspector page
|
|
12
|
+
* Run `automovie inspect` in a production or package: serve the inspector page
|
|
13
|
+
* over a subject module, print its address with the request as the query, and
|
|
14
|
+
* keep serving until the process is interrupted.
|
|
13
15
|
*
|
|
14
|
-
* Options are read by the production's `readAutoMovieCaptureArguments` and
|
|
16
|
+
* Options are read by the production's `readAutoMovieCaptureArguments` and
|
|
17
|
+
* split by `readAutoMovieInspectHostOptions`; the rest is read by
|
|
18
|
+
* `parseAutoMovieCapturePlanRequest`, so a request the capture command would
|
|
19
|
+
* refuse is refused here before anything is served, as is a `--props` file that
|
|
20
|
+
* is not JSON, and an accepted one is written back by
|
|
21
|
+
* `formatAutoMovieCapturePlanRequest` as the address's query.
|
|
22
|
+
* `@automovie/render`, `vite`, and through the page `@automovie/viewer`,
|
|
23
|
+
* `react` and `react-dom`, come from the production. On SIGINT or SIGTERM the
|
|
24
|
+
* server stops, the page is deleted, and the status is 0; a refusal throws to
|
|
25
|
+
* `run`, which prints it.
|
|
15
26
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Read, serve, print, wait, close.
|
|
19
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A request is read before the server starts, so a mistyped key never opens a page that silently ignores it.
|
|
20
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms One server for the command's life.
|
|
21
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work One page per command.
|
|
22
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The server and its page are closed when the process is interrupted; the signal listeners are removed with them.
|
|
27
|
+
* The copied capture command uses the same module and optional props paths from
|
|
28
|
+
* the production's working directory.
|
|
23
29
|
*/
|
|
24
30
|
export async function inspectAutoMovie(props: {
|
|
25
31
|
/** The tokens after `inspect`. */
|
|
@@ -29,10 +35,10 @@ export async function inspectAutoMovie(props: {
|
|
|
29
35
|
root: string;
|
|
30
36
|
}): Promise<number> {
|
|
31
37
|
const { root } = props;
|
|
32
|
-
const render: typeof Render = loadAutoMovieProductionModule(
|
|
38
|
+
const render: typeof Render = loadAutoMovieProductionModule<typeof Render>(
|
|
33
39
|
root,
|
|
34
40
|
"@automovie/render",
|
|
35
|
-
)
|
|
41
|
+
);
|
|
36
42
|
const options: ReturnType<typeof readAutoMovieInspectHostOptions> =
|
|
37
43
|
readAutoMovieInspectHostOptions(
|
|
38
44
|
render.readAutoMovieCaptureArguments(props.args),
|
|
@@ -53,6 +59,11 @@ export async function inspectAutoMovie(props: {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
|
|
62
|
+
const executable: string = path.join(__dirname, "..", "lib", "bin.js");
|
|
63
|
+
const launcher: readonly [string, ...string[]] = fs.existsSync(executable)
|
|
64
|
+
? [process.execPath, executable]
|
|
65
|
+
: ["automovie"];
|
|
66
|
+
|
|
56
67
|
// Vite's CommonJS entry warns once per load; the command loads it on purpose.
|
|
57
68
|
process.env.VITE_CJS_IGNORE_WARNING = "true";
|
|
58
69
|
const page: Awaited<ReturnType<typeof serveAutoMovieInspectorPage>> =
|
|
@@ -62,6 +73,12 @@ export async function inspectAutoMovie(props: {
|
|
|
62
73
|
vite: loadAutoMovieProductionModule(root, "vite"),
|
|
63
74
|
port: options.port,
|
|
64
75
|
props: data,
|
|
76
|
+
captureCommand: [
|
|
77
|
+
...launcher,
|
|
78
|
+
"capture",
|
|
79
|
+
`--module=${options.module}`,
|
|
80
|
+
...(options.props === null ? [] : [`--props=${options.props}`]),
|
|
81
|
+
],
|
|
65
82
|
});
|
|
66
83
|
process.stdout.write(
|
|
67
84
|
`inspect ${options.module}: ${formatAutoMovieInspectUrl(page.url, render.formatAutoMovieCapturePlanRequest(request))}\nPress Ctrl+C to stop.\n`,
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieCaptureCellRecord,
|
|
3
|
+
IAutoMovieCaptureFindingDiff,
|
|
4
|
+
IAutoMovieCaptureRecord,
|
|
5
|
+
IAutoMovieInspectionDiagnostics,
|
|
6
|
+
} from "@automovie/interface";
|
|
7
|
+
import * as fs from "node:fs/promises";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
|
|
10
|
+
import type { IAutoMovieVerification } from "./IAutoMovieVerification";
|
|
11
|
+
import { hashAutoMovieFile } from "./hashAutoMovieFile";
|
|
12
|
+
import { loadAutoMovieProductionModule } from "./loadAutoMovieProductionModule";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Read one source-owned diagnostic from a capture's selected camera and pass. A
|
|
16
|
+
* still covers one second. A frame interval needs a drawn cell and checked
|
|
17
|
+
* diagnostic coverage for each consecutive frame in its half-open range. The
|
|
18
|
+
* aggregate capture audit carries no cell address, so a record mixing views or
|
|
19
|
+
* passes at one of the chosen times cannot establish this particular
|
|
20
|
+
* observation.
|
|
21
|
+
*
|
|
22
|
+
* @param check The authored capture criterion.
|
|
23
|
+
* @param record The capture writer's persisted JSON.
|
|
24
|
+
* @param root The production directory resolving the record and its stills.
|
|
25
|
+
* @returns The supported verdict with the exact record to reopen.
|
|
26
|
+
*/
|
|
27
|
+
export async function inspectAutoMovieVerificationCapture(
|
|
28
|
+
check: IAutoMovieVerification.ICapture,
|
|
29
|
+
record: unknown,
|
|
30
|
+
root: string,
|
|
31
|
+
hashFile: (file: string) => Promise<string> = hashAutoMovieFile,
|
|
32
|
+
): Promise<
|
|
33
|
+
Pick<IAutoMovieVerification.IResult, "state" | "message" | "evidence">
|
|
34
|
+
> {
|
|
35
|
+
const evidence: string = check.record;
|
|
36
|
+
const absent = (message: string) => ({
|
|
37
|
+
state: "unobserved" as const,
|
|
38
|
+
message,
|
|
39
|
+
evidence,
|
|
40
|
+
});
|
|
41
|
+
if (record === null || typeof record !== "object" || !("state" in record))
|
|
42
|
+
return absent("Run the scoped capture to write its record.");
|
|
43
|
+
if (record.state !== "complete")
|
|
44
|
+
return absent("The capture has not finished.");
|
|
45
|
+
const capture: Extract<IAutoMovieCaptureRecord, { state: "complete" }> =
|
|
46
|
+
record as Extract<IAutoMovieCaptureRecord, { state: "complete" }>;
|
|
47
|
+
if (
|
|
48
|
+
capture.subject?.name !== check.subject ||
|
|
49
|
+
!Array.isArray(capture.rows) ||
|
|
50
|
+
!Array.isArray(capture.diagnostics?.episodes) ||
|
|
51
|
+
!Array.isArray(capture.diagnostics?.coverage)
|
|
52
|
+
)
|
|
53
|
+
return absent("Capture the selected subject with its diagnostic enabled.");
|
|
54
|
+
|
|
55
|
+
const at: IAutoMovieVerification.ICapture["at"] = check.at;
|
|
56
|
+
if (!validSelection(at))
|
|
57
|
+
throw new Error(
|
|
58
|
+
"A capture check needs a finite second or a nonempty frame interval.",
|
|
59
|
+
);
|
|
60
|
+
const atTime = (time: IAutoMovieInspectionDiagnostics.ITime): boolean =>
|
|
61
|
+
"second" in at
|
|
62
|
+
? time.filmSeconds === at.second
|
|
63
|
+
: time.outputFrame !== undefined &&
|
|
64
|
+
at.fromFrame <= time.outputFrame &&
|
|
65
|
+
time.outputFrame < at.endFrame;
|
|
66
|
+
const rows: IAutoMovieCaptureCellRecord[] = capture.rows.filter(
|
|
67
|
+
(row: IAutoMovieCaptureCellRecord): boolean =>
|
|
68
|
+
atTime({
|
|
69
|
+
filmSeconds: row.time.seconds,
|
|
70
|
+
...(row.time.frame === null ? {} : { outputFrame: row.time.frame }),
|
|
71
|
+
}),
|
|
72
|
+
);
|
|
73
|
+
if (
|
|
74
|
+
rows.some(
|
|
75
|
+
(row: IAutoMovieCaptureCellRecord): boolean =>
|
|
76
|
+
row.view !== check.view || row.pass !== check.pass,
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
return absent(
|
|
80
|
+
`Capture the selected interval through only ${check.view} / ${check.pass}; this audit combines other views or passes.`,
|
|
81
|
+
);
|
|
82
|
+
if (rows.length === 0)
|
|
83
|
+
return absent("The requested samples were not captured.");
|
|
84
|
+
if (
|
|
85
|
+
rows.some(
|
|
86
|
+
(row: IAutoMovieCaptureCellRecord): boolean => row.state === "failed",
|
|
87
|
+
)
|
|
88
|
+
)
|
|
89
|
+
return {
|
|
90
|
+
state: "failed",
|
|
91
|
+
message: "A selected capture cell failed to draw.",
|
|
92
|
+
evidence,
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
const coverage: readonly IAutoMovieInspectionDiagnostics.ICoverageRange[] =
|
|
96
|
+
capture.diagnostics.coverage.filter(
|
|
97
|
+
(range: IAutoMovieInspectionDiagnostics.ICoverageRange): boolean =>
|
|
98
|
+
range.scope === check.occurrence &&
|
|
99
|
+
range.coverage.check === check.diagnostic.check &&
|
|
100
|
+
range.coverage.key === check.diagnostic.key,
|
|
101
|
+
);
|
|
102
|
+
const expected: number = "second" in at ? 1 : at.endFrame - at.fromFrame;
|
|
103
|
+
const observed: Set<number> = new Set();
|
|
104
|
+
const directory: string = path.resolve(root, path.dirname(check.record));
|
|
105
|
+
let from: number = Infinity;
|
|
106
|
+
let to: number = -Infinity;
|
|
107
|
+
for (const row of rows) {
|
|
108
|
+
if (row.state !== "drawn") continue;
|
|
109
|
+
const { frame, seconds }: IAutoMovieCaptureCellRecord["time"] = row.time;
|
|
110
|
+
const matching: readonly IAutoMovieInspectionDiagnostics.ICoverageRange[] =
|
|
111
|
+
coverage.filter(
|
|
112
|
+
(range: IAutoMovieInspectionDiagnostics.ICoverageRange): boolean =>
|
|
113
|
+
frame !== null &&
|
|
114
|
+
range.first.outputFrame !== undefined &&
|
|
115
|
+
range.last.outputFrame !== undefined
|
|
116
|
+
? range.first.outputFrame <= frame &&
|
|
117
|
+
frame <= range.last.outputFrame &&
|
|
118
|
+
range.samples ===
|
|
119
|
+
range.last.outputFrame - range.first.outputFrame + 1
|
|
120
|
+
: range.first.filmSeconds === seconds &&
|
|
121
|
+
range.last.filmSeconds === seconds,
|
|
122
|
+
);
|
|
123
|
+
if (
|
|
124
|
+
matching.length !== 0 &&
|
|
125
|
+
matching.every(
|
|
126
|
+
(range: IAutoMovieInspectionDiagnostics.ICoverageRange): boolean =>
|
|
127
|
+
range.coverage.status === "checked",
|
|
128
|
+
) &&
|
|
129
|
+
(await retainsStill(row, directory, root, hashFile))
|
|
130
|
+
) {
|
|
131
|
+
observed.add(frame ?? seconds);
|
|
132
|
+
from = Math.min(from, seconds);
|
|
133
|
+
to = Math.max(to, seconds);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
if (observed.size !== expected)
|
|
137
|
+
return absent(
|
|
138
|
+
`Only ${observed.size}/${expected} requested samples have checked coverage and matching stills. Recapture the requested samples.`,
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const episodes: readonly IAutoMovieInspectionDiagnostics.IEpisode[] =
|
|
142
|
+
capture.diagnostics.episodes.filter(
|
|
143
|
+
(episode: IAutoMovieInspectionDiagnostics.IEpisode): boolean =>
|
|
144
|
+
episode.scope === check.occurrence &&
|
|
145
|
+
episode.worst.finding.check === check.diagnostic.check &&
|
|
146
|
+
episode.worst.finding.key === check.diagnostic.key &&
|
|
147
|
+
overlaps(episode, from, to),
|
|
148
|
+
);
|
|
149
|
+
const failure: IAutoMovieInspectionDiagnostics.IEpisode | undefined =
|
|
150
|
+
episodes.find(
|
|
151
|
+
(episode: IAutoMovieInspectionDiagnostics.IEpisode): boolean =>
|
|
152
|
+
episode.worst.finding.category === "error" &&
|
|
153
|
+
episode.worst.finding.confidence === "confirmed" &&
|
|
154
|
+
atTime(episode.worst.time),
|
|
155
|
+
);
|
|
156
|
+
if (failure !== undefined)
|
|
157
|
+
return {
|
|
158
|
+
state: "failed",
|
|
159
|
+
message: failure.worst.finding.message,
|
|
160
|
+
evidence,
|
|
161
|
+
};
|
|
162
|
+
if (episodes.length !== 0)
|
|
163
|
+
return absent(
|
|
164
|
+
"Retake the finding's interval to separate possible or neighboring defects.",
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
const difference: IAutoMovieCaptureFindingDiff | undefined =
|
|
168
|
+
capture.comparison?.findings;
|
|
169
|
+
if (
|
|
170
|
+
difference?.state === "compared" &&
|
|
171
|
+
difference.entries.some(
|
|
172
|
+
(entry): boolean =>
|
|
173
|
+
entry.category === "error" &&
|
|
174
|
+
entry.scope === check.occurrence &&
|
|
175
|
+
entry.check === check.diagnostic.check &&
|
|
176
|
+
entry.key === check.diagnostic.key &&
|
|
177
|
+
entry.state === "unmatched" &&
|
|
178
|
+
touchesUncovered(entry.uncovered, from, to),
|
|
179
|
+
)
|
|
180
|
+
)
|
|
181
|
+
return absent(
|
|
182
|
+
"The comparison lacks coverage of an error affecting this selection. Capture both affected intervals.",
|
|
183
|
+
);
|
|
184
|
+
return {
|
|
185
|
+
state: "passed",
|
|
186
|
+
message: `${observed.size} requested samples checked.`,
|
|
187
|
+
evidence,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** Admit a nonnegative subject second or an ordered zero-based frame range. */
|
|
192
|
+
function validSelection(at: IAutoMovieVerification.ICapture["at"]): boolean {
|
|
193
|
+
return "second" in at
|
|
194
|
+
? Number.isFinite(at.second) && at.second >= 0
|
|
195
|
+
: Number.isSafeInteger(at.fromFrame) &&
|
|
196
|
+
Number.isSafeInteger(at.endFrame) &&
|
|
197
|
+
0 <= at.fromFrame &&
|
|
198
|
+
at.fromFrame < at.endFrame;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Relate a finding's observed extent to a requested time. Unknown frame
|
|
203
|
+
* identity stays unresolved.
|
|
204
|
+
*/
|
|
205
|
+
function overlaps(
|
|
206
|
+
episode: IAutoMovieInspectionDiagnostics.IEpisode,
|
|
207
|
+
from: number,
|
|
208
|
+
to: number,
|
|
209
|
+
): boolean {
|
|
210
|
+
const first: number = episode.first.time.filmSeconds;
|
|
211
|
+
const last: number = episode.last.filmSeconds;
|
|
212
|
+
const worst: number = episode.worst.time.filmSeconds;
|
|
213
|
+
return (
|
|
214
|
+
Math.min(first, last, worst) <= to && from <= Math.max(first, last, worst)
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function touchesUncovered(
|
|
219
|
+
ranges: readonly IAutoMovieInspectionDiagnostics.IInterval[] | undefined,
|
|
220
|
+
from: number,
|
|
221
|
+
to: number,
|
|
222
|
+
): boolean {
|
|
223
|
+
return (
|
|
224
|
+
!Array.isArray(ranges) ||
|
|
225
|
+
ranges.length === 0 ||
|
|
226
|
+
ranges.some(
|
|
227
|
+
(range: IAutoMovieInspectionDiagnostics.IInterval): boolean =>
|
|
228
|
+
!Number.isFinite(range?.from) ||
|
|
229
|
+
!Number.isFinite(range?.to) ||
|
|
230
|
+
range.from > range.to ||
|
|
231
|
+
(range.from <= to && from <= range.to),
|
|
232
|
+
)
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Availability of an existing still. Keep permission and other read failures
|
|
238
|
+
* visible.
|
|
239
|
+
*/
|
|
240
|
+
async function retainsStill(
|
|
241
|
+
row: Extract<IAutoMovieCaptureCellRecord, { state: "drawn" }>,
|
|
242
|
+
directory: string,
|
|
243
|
+
root: string,
|
|
244
|
+
hashFile: (file: string) => Promise<string>,
|
|
245
|
+
): Promise<boolean> {
|
|
246
|
+
if (
|
|
247
|
+
typeof row.file !== "string" ||
|
|
248
|
+
!row.file.endsWith(".png") ||
|
|
249
|
+
row.file !== path.basename(row.file)
|
|
250
|
+
)
|
|
251
|
+
return false;
|
|
252
|
+
const file: string = path.join(directory, row.file);
|
|
253
|
+
let bytes: Buffer;
|
|
254
|
+
try {
|
|
255
|
+
if (!(await fs.stat(file)).isFile()) return false;
|
|
256
|
+
if (row.fileSha256 !== undefined)
|
|
257
|
+
return (
|
|
258
|
+
/^[a-f\d]{64}$/u.test(row.fileSha256) &&
|
|
259
|
+
(await hashFile(file)) === row.fileSha256
|
|
260
|
+
);
|
|
261
|
+
if (typeof row.hash !== "string" || !/^sha256:[a-f\d]{64}$/u.test(row.hash))
|
|
262
|
+
return false;
|
|
263
|
+
bytes = await fs.readFile(file);
|
|
264
|
+
} catch (error) {
|
|
265
|
+
const code: string | undefined = (error as NodeJS.ErrnoException).code;
|
|
266
|
+
if (code === "ENOENT" || code === "ENOTDIR" || code === "EISDIR")
|
|
267
|
+
return false;
|
|
268
|
+
throw error;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
const render: typeof import("@automovie/render") =
|
|
272
|
+
await import("@automovie/render").catch(
|
|
273
|
+
(error: unknown): typeof import("@automovie/render") => {
|
|
274
|
+
const code: string | undefined = (error as NodeJS.ErrnoException).code;
|
|
275
|
+
if (code !== "ERR_MODULE_NOT_FOUND" && code !== "MODULE_NOT_FOUND")
|
|
276
|
+
throw error;
|
|
277
|
+
return loadAutoMovieProductionModule(
|
|
278
|
+
root,
|
|
279
|
+
"@automovie/render",
|
|
280
|
+
) as typeof import("@automovie/render");
|
|
281
|
+
},
|
|
282
|
+
);
|
|
283
|
+
try {
|
|
284
|
+
return (
|
|
285
|
+
render.hashAutoMovieRasterImage(
|
|
286
|
+
await render.decodeAutoMovieRasterPng(bytes),
|
|
287
|
+
) === row.hash
|
|
288
|
+
);
|
|
289
|
+
} catch {
|
|
290
|
+
return false;
|
|
291
|
+
}
|
|
292
|
+
}
|