automovie 0.3.4 → 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
package/src/reviewAutoMovie.ts
CHANGED
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import type * as Render from "@automovie/render";
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
|
+
import type * as Playwright from "playwright-core";
|
|
4
5
|
|
|
5
6
|
import { loadAutoMovieProductionModule } from "./loadAutoMovieProductionModule";
|
|
6
7
|
import { readAutoMovieReviewOptions } from "./readAutoMovieReviewOptions";
|
|
7
8
|
import { recordAutoMoviePlayback } from "./recordAutoMoviePlayback";
|
|
9
|
+
import { reviewAutoMovieFile } from "./reviewAutoMovieFile";
|
|
8
10
|
|
|
9
11
|
/**
|
|
10
|
-
* Run `automovie review` in a production
|
|
12
|
+
* Run `automovie review` in a production, recording Inspector playback or
|
|
13
|
+
* marking and reopening a file-bound observation.
|
|
11
14
|
*
|
|
12
|
-
* Options are read by `readAutoMovieCaptureArguments` and admitted by
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The browser is the recording's and closed by it.
|
|
15
|
+
* Options are read by `readAutoMovieCaptureArguments` and admitted by
|
|
16
|
+
* `readAutoMovieReviewOptions`. The recording is `recordAutoMoviePlayback` with
|
|
17
|
+
* the production's `playwright-core`; it and `playback.json`, holding the time
|
|
18
|
+
* readings and the page's script errors, go into `--out` or
|
|
19
|
+
* `media/automovie/review`. It prints the video and the number of errors and
|
|
20
|
+
* resolves to 1 when the page reported a script error. File mode delegates to
|
|
21
|
+
* the published-file review host and resolves to 0 after the mark or replay
|
|
22
|
+
* succeeds.
|
|
21
23
|
*/
|
|
22
24
|
export async function reviewAutoMovie(props: {
|
|
23
25
|
/** The tokens after `review`. */
|
|
@@ -30,24 +32,27 @@ export async function reviewAutoMovie(props: {
|
|
|
30
32
|
env: Readonly<Record<string, string | undefined>>;
|
|
31
33
|
}): Promise<number> {
|
|
32
34
|
const { root } = props;
|
|
33
|
-
const render: typeof Render = loadAutoMovieProductionModule(
|
|
35
|
+
const render: typeof Render = loadAutoMovieProductionModule<typeof Render>(
|
|
34
36
|
root,
|
|
35
37
|
"@automovie/render",
|
|
36
|
-
)
|
|
38
|
+
);
|
|
37
39
|
const options: ReturnType<typeof readAutoMovieReviewOptions> =
|
|
38
40
|
readAutoMovieReviewOptions(
|
|
39
41
|
render.readAutoMovieCaptureArguments(props.args),
|
|
40
42
|
);
|
|
43
|
+
if (!("url" in options)) {
|
|
44
|
+
await reviewAutoMovieFile({ options, root, env: props.env });
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
41
47
|
const out: string = path.resolve(
|
|
42
48
|
root,
|
|
43
49
|
options.out ?? path.join("media", "automovie", "review"),
|
|
44
50
|
);
|
|
45
51
|
const recorded: Awaited<ReturnType<typeof recordAutoMoviePlayback>> =
|
|
46
52
|
await recordAutoMoviePlayback({
|
|
47
|
-
chromium: (
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
53
|
+
chromium: loadAutoMovieProductionModule<typeof Playwright>(
|
|
54
|
+
root,
|
|
55
|
+
"playwright-core",
|
|
51
56
|
).chromium,
|
|
52
57
|
url: options.url,
|
|
53
58
|
seconds: options.seconds,
|
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
import type { IAutoMovieDeliveryContentAudit } from "@automovie/interface";
|
|
2
|
+
import type * as Render from "@automovie/render";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import * as fs from "node:fs/promises";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
|
|
7
|
+
import type { AutoMovieFfmpegStaticPath } from "./AutoMovieFfmpegStaticPath";
|
|
8
|
+
import type { IAutoMovieReviewObservation } from "./IAutoMovieReviewObservation";
|
|
9
|
+
import { hashAutoMovieFile } from "./hashAutoMovieFile";
|
|
10
|
+
import { loadAutoMovieProductionModule } from "./loadAutoMovieProductionModule";
|
|
11
|
+
import { readAutoMovieErrorCode } from "./readAutoMovieErrorCode";
|
|
12
|
+
import { readAutoMovieReviewObservation } from "./readAutoMovieReviewObservation";
|
|
13
|
+
import type { readAutoMovieReviewOptions } from "./readAutoMovieReviewOptions";
|
|
14
|
+
import { resolveAutoMovieFfmpeg } from "./resolveAutoMovieFfmpeg";
|
|
15
|
+
import { runAutoMovieFfmpeg } from "./runAutoMovieFfmpeg";
|
|
16
|
+
import { sameAutoMovieReviewFile } from "./sameAutoMovieReviewFile";
|
|
17
|
+
|
|
18
|
+
/** The admitted file form of the review command. */
|
|
19
|
+
type FileOptions = Exclude<
|
|
20
|
+
ReturnType<typeof readAutoMovieReviewOptions>,
|
|
21
|
+
{ url: string }
|
|
22
|
+
>;
|
|
23
|
+
|
|
24
|
+
/** Native clock terms verified by the successful delivery's continuous decode. */
|
|
25
|
+
interface IAutoMovieReviewClock {
|
|
26
|
+
frameCount: number;
|
|
27
|
+
timeBase: IAutoMovieDeliveryContentAudit.Ratio;
|
|
28
|
+
ticksPerFrame: number;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Create or explicitly rebind a review mark from a published film's verified
|
|
33
|
+
* native clock. Replay extracts the exact original frame indices as stills with
|
|
34
|
+
* adjacent context, after checking the current video bytes against the saved
|
|
35
|
+
* digest. Returns the receipt and writes an actionable address.
|
|
36
|
+
*/
|
|
37
|
+
export async function reviewAutoMovieFile(props: {
|
|
38
|
+
/** Admitted file review options. */
|
|
39
|
+
options: FileOptions;
|
|
40
|
+
/** The production root for user paths and project-installed packages. */
|
|
41
|
+
root: string;
|
|
42
|
+
/** Process environment used to resolve FFmpeg on replay. */
|
|
43
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
44
|
+
}): Promise<IAutoMovieReviewObservation> {
|
|
45
|
+
const { options, root } = props;
|
|
46
|
+
const previous: IAutoMovieReviewObservation | null =
|
|
47
|
+
options.mark === null
|
|
48
|
+
? null
|
|
49
|
+
: readAutoMovieReviewObservation(
|
|
50
|
+
await json(path.resolve(root, options.mark)),
|
|
51
|
+
);
|
|
52
|
+
const file: string = path.resolve(root, options.file ?? previous!.file);
|
|
53
|
+
const sha256: string = await hashAutoMovieFile(file).catch(
|
|
54
|
+
(cause: unknown) => {
|
|
55
|
+
if (previous === null || readAutoMovieErrorCode(cause) !== "ENOENT")
|
|
56
|
+
throw cause;
|
|
57
|
+
throw new Error(
|
|
58
|
+
`Original review file is unavailable at ${file}. ${originalAddress(previous, null)}\n` +
|
|
59
|
+
"Supply its archived copy with --file, or explicitly rebind using --file and --at or --from/--to.",
|
|
60
|
+
{ cause },
|
|
61
|
+
);
|
|
62
|
+
},
|
|
63
|
+
);
|
|
64
|
+
const out: string = path.resolve(
|
|
65
|
+
root,
|
|
66
|
+
options.out ?? path.join("media", "automovie", "review", randomUUID()),
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
if (options.requested === null) {
|
|
70
|
+
if (sha256 !== previous!.sha256) {
|
|
71
|
+
const replacement = await readPublishedReview(file, sha256).catch(
|
|
72
|
+
(): null => null,
|
|
73
|
+
);
|
|
74
|
+
throw new Error(
|
|
75
|
+
`Stale review file at ${file}. Expected SHA-256 ${previous!.sha256}. ` +
|
|
76
|
+
`${originalAddress(previous!, replacement)}\n` +
|
|
77
|
+
"Supply the original with --file, or explicitly rebind using --file and --at or --from/--to.",
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
await replay({ ...props, out, file, mark: previous! });
|
|
81
|
+
return previous!;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const report = await readPublishedReview(file, sha256);
|
|
85
|
+
if (previous !== null && previous.subject !== report.subject)
|
|
86
|
+
throw new Error(
|
|
87
|
+
`Review rebind needs the same subject, ${previous.subject}, but this delivery reports ${report.subject}`,
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
const clock: IAutoMovieReviewClock | null = readClock(
|
|
91
|
+
report.delivery,
|
|
92
|
+
sha256,
|
|
93
|
+
);
|
|
94
|
+
const observed: IAutoMovieReviewObservation["observed"] =
|
|
95
|
+
clock === null ? null : windowAt(clock, options.requested);
|
|
96
|
+
const mark: IAutoMovieReviewObservation = {
|
|
97
|
+
version: 1,
|
|
98
|
+
subject: report.subject,
|
|
99
|
+
file: relative(root, file),
|
|
100
|
+
sha256,
|
|
101
|
+
note: options.note ?? previous!.note,
|
|
102
|
+
reviewer: options.reviewer,
|
|
103
|
+
decision: options.decision,
|
|
104
|
+
viewed: options.viewed,
|
|
105
|
+
requested: options.requested,
|
|
106
|
+
observed,
|
|
107
|
+
unavailable:
|
|
108
|
+
observed === null
|
|
109
|
+
? "The published report does not establish a continuous native video grid"
|
|
110
|
+
: null,
|
|
111
|
+
cut: resolveCut(report.cut, clock, observed),
|
|
112
|
+
previous:
|
|
113
|
+
options.mark === null
|
|
114
|
+
? null
|
|
115
|
+
: relative(root, path.resolve(root, options.mark)),
|
|
116
|
+
};
|
|
117
|
+
readAutoMovieReviewObservation(mark);
|
|
118
|
+
await fs.mkdir(out, { recursive: true });
|
|
119
|
+
const receipt: string = path.join(out, "review.json");
|
|
120
|
+
const handle: fs.FileHandle = await fs.open(receipt, "wx");
|
|
121
|
+
try {
|
|
122
|
+
await handle.writeFile(JSON.stringify(mark, null, 2) + "\n", "utf8");
|
|
123
|
+
} catch (cause) {
|
|
124
|
+
await handle.close();
|
|
125
|
+
await fs.unlink(receipt);
|
|
126
|
+
throw cause;
|
|
127
|
+
}
|
|
128
|
+
await handle.close();
|
|
129
|
+
process.stdout.write(
|
|
130
|
+
`review mark: ${receipt}\n${address(mark)}\n` +
|
|
131
|
+
(mark.cut.state === "resolved"
|
|
132
|
+
? `cut: entry ${mark.cut.entry} (${mark.cut.shot})\n`
|
|
133
|
+
: `cut: ${mark.cut.reason}\n`) +
|
|
134
|
+
(previous === null ? "" : `${originalAddress(previous, report)}\n`),
|
|
135
|
+
);
|
|
136
|
+
return mark;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Verifies the render report corresponds to the current file. */
|
|
140
|
+
async function readPublishedReview(
|
|
141
|
+
file: string,
|
|
142
|
+
sha256: string,
|
|
143
|
+
): Promise<{ subject: string; delivery: unknown; cut: unknown }> {
|
|
144
|
+
const report: unknown = await json(
|
|
145
|
+
path.join(path.dirname(file), "render-report.json"),
|
|
146
|
+
);
|
|
147
|
+
if (
|
|
148
|
+
!record(report) ||
|
|
149
|
+
report.status !== "published" ||
|
|
150
|
+
typeof report.video !== "string" ||
|
|
151
|
+
path.basename(report.video) !== report.video ||
|
|
152
|
+
typeof report.subject !== "string" ||
|
|
153
|
+
report.subject.trim() === "" ||
|
|
154
|
+
!record(report.source) ||
|
|
155
|
+
report.source.sha256 !== sha256 ||
|
|
156
|
+
!(await sameAutoMovieReviewFile(
|
|
157
|
+
path.join(path.dirname(file), report.video),
|
|
158
|
+
file,
|
|
159
|
+
))
|
|
160
|
+
)
|
|
161
|
+
throw new Error(
|
|
162
|
+
`Review needs a published render-report.json matching the video name and SHA-256 beside ${file}`,
|
|
163
|
+
);
|
|
164
|
+
return {
|
|
165
|
+
subject: report.subject,
|
|
166
|
+
delivery: report.delivery,
|
|
167
|
+
cut: report.cut,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/** Reads the complete native grid already established on the same encoded bytes. */
|
|
172
|
+
function readClock(
|
|
173
|
+
delivery: unknown,
|
|
174
|
+
sha256: string,
|
|
175
|
+
): IAutoMovieReviewClock | null {
|
|
176
|
+
if (
|
|
177
|
+
!record(delivery) ||
|
|
178
|
+
!record(delivery.source) ||
|
|
179
|
+
delivery.source.sha256 !== sha256 ||
|
|
180
|
+
!record(delivery.expected) ||
|
|
181
|
+
!positiveInteger(delivery.expected.frameCount) ||
|
|
182
|
+
!ratio(delivery.expected.frameRate) ||
|
|
183
|
+
!record(delivery.streams) ||
|
|
184
|
+
!record(delivery.streams.video)
|
|
185
|
+
)
|
|
186
|
+
return null;
|
|
187
|
+
const video: Record<string, unknown> = delivery.streams.video;
|
|
188
|
+
if (
|
|
189
|
+
video.status !== "decoded" ||
|
|
190
|
+
video.continuous !== true ||
|
|
191
|
+
!record(video.start) ||
|
|
192
|
+
!record(video.end) ||
|
|
193
|
+
video.start.ticks !== 0 ||
|
|
194
|
+
!positiveInteger(video.end.ticks) ||
|
|
195
|
+
!ratio(video.start.timeBase) ||
|
|
196
|
+
!ratio(video.end.timeBase) ||
|
|
197
|
+
video.end.timeBase[0] !== video.start.timeBase[0] ||
|
|
198
|
+
video.end.timeBase[1] !== video.start.timeBase[1]
|
|
199
|
+
)
|
|
200
|
+
return null;
|
|
201
|
+
const count: number = delivery.expected.frameCount;
|
|
202
|
+
const timeBase: IAutoMovieDeliveryContentAudit.Ratio = video.start.timeBase;
|
|
203
|
+
const rate: IAutoMovieDeliveryContentAudit.Ratio =
|
|
204
|
+
delivery.expected.frameRate;
|
|
205
|
+
const ticksPerFrame: number = video.end.ticks / count;
|
|
206
|
+
if (
|
|
207
|
+
!Number.isSafeInteger(ticksPerFrame) ||
|
|
208
|
+
BigInt(ticksPerFrame) * BigInt(timeBase[0]) * BigInt(rate[0]) !==
|
|
209
|
+
BigInt(timeBase[1]) * BigInt(rate[1])
|
|
210
|
+
)
|
|
211
|
+
return null;
|
|
212
|
+
return { frameCount: count, timeBase, ticksPerFrame };
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/** Resolves a point or interval to the decoded frames intersecting its scope. */
|
|
216
|
+
function windowAt(
|
|
217
|
+
clock: IAutoMovieReviewClock,
|
|
218
|
+
requested: IAutoMovieReviewObservation["requested"],
|
|
219
|
+
): NonNullable<IAutoMovieReviewObservation["observed"]> {
|
|
220
|
+
const end: number = seconds(clock, clock.frameCount);
|
|
221
|
+
if (requested.from >= end || (requested.to !== null && requested.to > end))
|
|
222
|
+
throw new Error(
|
|
223
|
+
`Review position lies outside the published film's 0–${end} s`,
|
|
224
|
+
);
|
|
225
|
+
const firstBoundary: number = firstBoundaryAtOrAfter(clock, requested.from);
|
|
226
|
+
const firstFrame: number =
|
|
227
|
+
seconds(clock, firstBoundary) === requested.from
|
|
228
|
+
? firstBoundary
|
|
229
|
+
: firstBoundary - 1;
|
|
230
|
+
const endFrame: number =
|
|
231
|
+
requested.to === null
|
|
232
|
+
? firstFrame + 1
|
|
233
|
+
: firstBoundaryAtOrAfter(clock, requested.to);
|
|
234
|
+
return {
|
|
235
|
+
firstFrame,
|
|
236
|
+
endFrame,
|
|
237
|
+
frameCount: clock.frameCount,
|
|
238
|
+
start: {
|
|
239
|
+
ticks: firstFrame * clock.ticksPerFrame,
|
|
240
|
+
timeBase: clock.timeBase,
|
|
241
|
+
},
|
|
242
|
+
end: { ticks: endFrame * clock.ticksPerFrame, timeBase: clock.timeBase },
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/** Finds the first native clock boundary at or above a film second. */
|
|
247
|
+
function firstBoundaryAtOrAfter(
|
|
248
|
+
clock: IAutoMovieReviewClock,
|
|
249
|
+
time: number,
|
|
250
|
+
): number {
|
|
251
|
+
let first: number = 0;
|
|
252
|
+
let last: number = clock.frameCount;
|
|
253
|
+
while (first < last) {
|
|
254
|
+
const middle: number = first + Math.floor((last - first) / 2);
|
|
255
|
+
if (seconds(clock, middle) < time) first = middle + 1;
|
|
256
|
+
else last = middle;
|
|
257
|
+
}
|
|
258
|
+
return first;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Seconds relative to the published presentation zero, derived from native
|
|
263
|
+
* ticks.
|
|
264
|
+
*/
|
|
265
|
+
function seconds(clock: IAutoMovieReviewClock, frame: number): number {
|
|
266
|
+
return timestampSeconds({
|
|
267
|
+
ticks: frame * clock.ticksPerFrame,
|
|
268
|
+
timeBase: clock.timeBase,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Seconds represented by an exact timestamp, for display and request lookup. */
|
|
273
|
+
function timestampSeconds(
|
|
274
|
+
time: IAutoMovieDeliveryContentAudit.ITimestamp,
|
|
275
|
+
): number {
|
|
276
|
+
return (time.ticks * time.timeBase[0]) / time.timeBase[1];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/** Identifies the one authored occurrence or exposes a cut boundary or overlap. */
|
|
280
|
+
function resolveCut(
|
|
281
|
+
cut: unknown,
|
|
282
|
+
clock: IAutoMovieReviewClock | null,
|
|
283
|
+
observed: IAutoMovieReviewObservation["observed"],
|
|
284
|
+
): IAutoMovieReviewObservation["cut"] {
|
|
285
|
+
if (
|
|
286
|
+
!Array.isArray(cut) ||
|
|
287
|
+
cut.length === 0 ||
|
|
288
|
+
clock === null ||
|
|
289
|
+
observed === null
|
|
290
|
+
)
|
|
291
|
+
return {
|
|
292
|
+
state: "unavailable",
|
|
293
|
+
reason: "No verified cut for this review window",
|
|
294
|
+
};
|
|
295
|
+
const start: number = seconds(clock, observed.firstFrame);
|
|
296
|
+
const end: number = seconds(clock, observed.endFrame);
|
|
297
|
+
let selected: { entry: number; shot: string } | null = null;
|
|
298
|
+
let nextFrame: number = 0;
|
|
299
|
+
let touching: number = 0;
|
|
300
|
+
for (const entry of cut as unknown[]) {
|
|
301
|
+
if (
|
|
302
|
+
!record(entry) ||
|
|
303
|
+
!whole(entry.entry) ||
|
|
304
|
+
typeof entry.shot !== "string" ||
|
|
305
|
+
entry.shot.trim() === "" ||
|
|
306
|
+
!nonnegative(entry.start) ||
|
|
307
|
+
!nonnegative(entry.played) ||
|
|
308
|
+
!Array.isArray(entry.liveFrames) ||
|
|
309
|
+
entry.liveFrames.length !== 2 ||
|
|
310
|
+
!whole(entry.liveFrames[0]) ||
|
|
311
|
+
!whole(entry.liveFrames[1]) ||
|
|
312
|
+
entry.liveFrames[0] !== nextFrame ||
|
|
313
|
+
entry.liveFrames[1] < nextFrame
|
|
314
|
+
)
|
|
315
|
+
return {
|
|
316
|
+
state: "unavailable",
|
|
317
|
+
reason: "The published cut is incomplete",
|
|
318
|
+
};
|
|
319
|
+
nextFrame = entry.liveFrames[1];
|
|
320
|
+
if (entry.start < end && start < entry.start + entry.played) touching++;
|
|
321
|
+
if (
|
|
322
|
+
entry.liveFrames[0] <= observed.firstFrame &&
|
|
323
|
+
observed.endFrame <= entry.liveFrames[1]
|
|
324
|
+
)
|
|
325
|
+
selected = { entry: entry.entry, shot: entry.shot };
|
|
326
|
+
}
|
|
327
|
+
if (nextFrame !== clock.frameCount)
|
|
328
|
+
return {
|
|
329
|
+
state: "unavailable",
|
|
330
|
+
reason: "The published cut does not cover the decoded frames",
|
|
331
|
+
};
|
|
332
|
+
return selected === null || touching !== 1
|
|
333
|
+
? {
|
|
334
|
+
state: "ambiguous",
|
|
335
|
+
reason: "The marked window crosses an edit or transition",
|
|
336
|
+
}
|
|
337
|
+
: { state: "resolved", ...selected };
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Extracts a few adjacent stills from the verified original, using the file
|
|
342
|
+
* capture planner.
|
|
343
|
+
*/
|
|
344
|
+
async function replay(props: {
|
|
345
|
+
root: string;
|
|
346
|
+
env: Readonly<Record<string, string | undefined>>;
|
|
347
|
+
out: string;
|
|
348
|
+
file: string;
|
|
349
|
+
mark: IAutoMovieReviewObservation;
|
|
350
|
+
}): Promise<void> {
|
|
351
|
+
const { mark, root, out, file } = props;
|
|
352
|
+
process.stdout.write(`review source: ${file}\n${address(mark)}\n`);
|
|
353
|
+
if (mark.observed === null) return;
|
|
354
|
+
const { firstFrame, endFrame, frameCount } = mark.observed;
|
|
355
|
+
const frames: number[] = [
|
|
356
|
+
...new Set([
|
|
357
|
+
Math.max(0, firstFrame - 1),
|
|
358
|
+
firstFrame,
|
|
359
|
+
endFrame - 1,
|
|
360
|
+
Math.min(frameCount - 1, endFrame),
|
|
361
|
+
]),
|
|
362
|
+
];
|
|
363
|
+
const render: typeof Render = loadAutoMovieProductionModule<typeof Render>(
|
|
364
|
+
root,
|
|
365
|
+
"@automovie/render",
|
|
366
|
+
);
|
|
367
|
+
const ffmpeg: string = resolveAutoMovieFfmpeg({
|
|
368
|
+
env: props.env,
|
|
369
|
+
load: (id: "ffmpeg-static"): AutoMovieFfmpegStaticPath =>
|
|
370
|
+
loadAutoMovieProductionModule<AutoMovieFfmpegStaticPath>(root, id),
|
|
371
|
+
});
|
|
372
|
+
await fs.mkdir(out, { recursive: true });
|
|
373
|
+
const directory: string = await fs.mkdtemp(path.join(out, "frames-"));
|
|
374
|
+
try {
|
|
375
|
+
await runAutoMovieFfmpeg(
|
|
376
|
+
ffmpeg,
|
|
377
|
+
render.planAutoMovieVideoFrames({ file, frames, directory }),
|
|
378
|
+
);
|
|
379
|
+
if ((await hashAutoMovieFile(file)) !== mark.sha256)
|
|
380
|
+
throw new Error("The reviewed file changed during capture");
|
|
381
|
+
const paths: string[] = frames.map((_: number, index: number): string =>
|
|
382
|
+
path.join(directory, "s" + index.toString().padStart(5, "0") + ".png"),
|
|
383
|
+
);
|
|
384
|
+
for (const output of paths)
|
|
385
|
+
if (!(await fs.stat(output)).isFile())
|
|
386
|
+
throw new Error(`The decoder did not write ${output}`);
|
|
387
|
+
process.stdout.write(
|
|
388
|
+
paths
|
|
389
|
+
.map(
|
|
390
|
+
(output: string, index: number): string =>
|
|
391
|
+
`frame ${frames[index]}: ${output}\n`,
|
|
392
|
+
)
|
|
393
|
+
.join(""),
|
|
394
|
+
);
|
|
395
|
+
} catch (cause) {
|
|
396
|
+
await fs.rm(directory, { recursive: true });
|
|
397
|
+
throw cause;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* A short display address keeps the request distinct from native frame
|
|
403
|
+
* coverage.
|
|
404
|
+
*/
|
|
405
|
+
function address(mark: IAutoMovieReviewObservation): string {
|
|
406
|
+
const { requested, observed } = mark;
|
|
407
|
+
const position: string =
|
|
408
|
+
requested.to === null
|
|
409
|
+
? `requested ${requested.from} s`
|
|
410
|
+
: `requested ${requested.from}–${requested.to} s`;
|
|
411
|
+
return observed === null
|
|
412
|
+
? `${position}. ${mark.unavailable}`
|
|
413
|
+
: `${position}. Frames ${observed.firstFrame}–${observed.endFrame - 1}, PTS ${observed.start.ticks}–${observed.end.ticks} at ${observed.start.timeBase.join("/")} s per tick`;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/** Reports the old address and any verified absence from a replacement cut. */
|
|
417
|
+
function originalAddress(
|
|
418
|
+
old: IAutoMovieReviewObservation,
|
|
419
|
+
replacement: { subject: string; cut: unknown } | null,
|
|
420
|
+
): string {
|
|
421
|
+
const description = `Original ${old.file}. ${address(old)}.`;
|
|
422
|
+
if (old.cut.state !== "resolved")
|
|
423
|
+
return `${description} Cut: ${old.cut.reason}.`;
|
|
424
|
+
const { entry, shot } = old.cut;
|
|
425
|
+
const occurrence = `${description} Cut: entry ${entry} (${shot}).`;
|
|
426
|
+
return replacement?.subject === old.subject &&
|
|
427
|
+
Array.isArray(replacement.cut) &&
|
|
428
|
+
replacement.cut.length > 0 &&
|
|
429
|
+
replacement.cut.every(
|
|
430
|
+
(item: unknown): boolean =>
|
|
431
|
+
record(item) &&
|
|
432
|
+
typeof item.shot === "string" &&
|
|
433
|
+
item.shot.trim() !== "" &&
|
|
434
|
+
item.shot !== shot,
|
|
435
|
+
)
|
|
436
|
+
? `${occurrence} Shot ${shot} is absent from the replacement cut.`
|
|
437
|
+
: occurrence;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/** Reads JSON with a useful filename on a missing or malformed record. */
|
|
441
|
+
async function json(file: string): Promise<unknown> {
|
|
442
|
+
try {
|
|
443
|
+
return JSON.parse(await fs.readFile(file, "utf8"));
|
|
444
|
+
} catch (cause) {
|
|
445
|
+
throw new Error(`Could not read review evidence at ${file}`, { cause });
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** Production-relative when possible, with stable slash syntax on disk. */
|
|
450
|
+
function relative(root: string, file: string): string {
|
|
451
|
+
return path.relative(root, file).split(path.sep).join("/");
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** A decoded JSON object. */
|
|
455
|
+
function record(value: unknown): value is Record<string, unknown> {
|
|
456
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/** A positive safe integer clock term. */
|
|
460
|
+
function positiveInteger(value: unknown): value is number {
|
|
461
|
+
return whole(value) && value > 0;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/** A nonnegative safe integer frame or occurrence index. */
|
|
465
|
+
function whole(value: unknown): value is number {
|
|
466
|
+
return typeof value === "number" && Number.isSafeInteger(value) && value >= 0;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
/** A finite nonnegative film second. */
|
|
470
|
+
function nonnegative(value: unknown): value is number {
|
|
471
|
+
return typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/** Two positive whole terms of a native clock. */
|
|
475
|
+
function ratio(value: unknown): value is IAutoMovieDeliveryContentAudit.Ratio {
|
|
476
|
+
return (
|
|
477
|
+
Array.isArray(value) && value.length === 2 && value.every(positiveInteger)
|
|
478
|
+
);
|
|
479
|
+
}
|