initial run of scan3 on sandwich

This commit is contained in:
chloe caruso 2025-07-07 09:42:04 -07:00
parent 502786b689
commit f1b1c650ce
7 changed files with 98 additions and 7 deletions

61
flake.lock Normal file
View file

@ -0,0 +1,61 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1751271578,
"narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"utils": "utils"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

25
flake.nix Normal file
View file

@ -0,0 +1,25 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
};
outputs =
{ nixpkgs, utils, ... }:
utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
buildInputs = [
pkgs.nodejs_24 # runtime
pkgs.deno # formatter
(pkgs.ffmpeg.override {
withSvtav1 = true;
})
];
};
}
);
}

View file

@ -40,7 +40,7 @@ export async function bundleClientJavaScript(
logLevel: "silent",
metafile: true,
minify: !dev,
outdir: "/out!",
outdir: "out!",
plugins: clientPlugins,
write: false,
define: {
@ -174,7 +174,7 @@ export async function bundleServerJavaScript(
platform: "node",
format: "esm",
minify: false,
outdir: "/out!",
outdir: "out!",
plugins: serverPlugins,
splitting: true,
logLevel: "silent",

View file

@ -96,7 +96,7 @@ Module._resolveFilename = (...args) => {
try {
return require.resolve(replacedPath, { paths: [projectSrc] });
} catch (err: any) {
if (err.code === "MODULE_NOT_FOUND" && err.requireStack.length <= 1) {
if (err.code === "MODULE_NOT_FOUND" && (err?.requireStack?.length ?? 0) <= 1) {
err.message.replace(replacedPath, args[0]);
}
}

View file

@ -67,6 +67,9 @@ node run watch
<!-- poor module support), CLIs can include a `main` function, which is executed -->
<!-- when the REPL runs it. -->
for unix systems, the provided `flake.nix` can be used with `nix develop` to
open a shell with all needed system dependencies.
## Contributions
No contributions to `src` accepted, only `framework`.

View file

@ -10,7 +10,7 @@
// This is the third iteration of the scanner, hence its name "scan3";
// Remember that any software you want to be maintainable and high
// quality cannot be written with AI.
const root = path.resolve("C:/media");
const root = path.resolve("/Volumes/clover/Published");
const workDir = path.resolve(".clover/file-assets");
export async function main() {
@ -118,7 +118,7 @@ export async function main() {
},
getItemText: (job) =>
job.publicPath.slice(1) + (job.stat ? "" : " (deleted)"),
maxJobs: 2,
maxJobs: 10,
});
using qProcess = new async.Queue({
name: "Process Contents",
@ -136,7 +136,7 @@ export async function main() {
},
getItemText: ({ mediaFile, processor }) =>
`${mediaFile.path.slice(1)} - ${processor.name}`,
maxJobs: 1,
maxJobs: 4,
});
function decodeProcessors(input: string) {
@ -442,6 +442,7 @@ const procVideos = transcodeRules.videoFormats.map<Process>((preset) => ({
include: rules.extsVideo,
enable: ffmpegBin != null,
async run({ absPath, mediaFile, spin }) {
if ((mediaFile.duration ?? 0) < 10) return;
await produceAsset(`${mediaFile.hash}/${preset.id}`, async (base) => {
base = path.dirname(base);
await fs.mkdir(base);

View file

@ -28,7 +28,7 @@ export interface SpawnOptions {
export async function spawn(options: SpawnOptions) {
const { ffmpeg = "ffmpeg", args, title, cwd } = options;
const proc = child_process.spawn(ffmpeg, args, {
const proc = child_process.spawn(ffmpeg, [...defaultExtraOptions, ...args], {
stdio: ["ignore", "inherit", "pipe"],
env: { ...process.env, SVT_LOG: "2" },
cwd,
@ -59,6 +59,7 @@ export async function spawn(options: SpawnOptions) {
} else result satisfies never;
});
const [code, signal] = await events.once(proc, "close");
running = false;
if (code !== 0) {
const fmt = code ? `code ${code}` : `signal ${signal}`;
const e: any = new Error(`ffmpeg failed with ${fmt}`);