| author | |
| committer | |
| log | 43c83a513c406ddfbf3d46079672a0576f5d7cd3 |
| tree | 965c7cfa8c8aea60d9d6819bfcca339cadfcba3d |
| parent | 5e2a792bb470e4c9f1d4a97391400b4c0b711b14 |
| signature | Commit is signed but in an unrecognized format. |
7 files changed, 98 insertions(+), 7 deletions(-)
flake.lock created+61| ... | @@ -0,0 +1,61 @@ | ||
| 1 | { | ||
| 2 | "nodes": { | ||
| 3 | "nixpkgs": { | ||
| 4 | "locked": { | ||
| 5 | "lastModified": 1751271578, | ||
| 6 | "narHash": "sha256-P/SQmKDu06x8yv7i0s8bvnnuJYkxVGBWLWHaU+tt4YY=", | ||
| 7 | "owner": "NixOS", | ||
| 8 | "repo": "nixpkgs", | ||
| 9 | "rev": "3016b4b15d13f3089db8a41ef937b13a9e33a8df", | ||
| 10 | "type": "github" | ||
| 11 | }, | ||
| 12 | "original": { | ||
| 13 | "owner": "NixOS", | ||
| 14 | "ref": "nixos-unstable", | ||
| 15 | "repo": "nixpkgs", | ||
| 16 | "type": "github" | ||
| 17 | } | ||
| 18 | }, | ||
| 19 | "root": { | ||
| 20 | "inputs": { | ||
| 21 | "nixpkgs": "nixpkgs", | ||
| 22 | "utils": "utils" | ||
| 23 | } | ||
| 24 | }, | ||
| 25 | "systems": { | ||
| 26 | "locked": { | ||
| 27 | "lastModified": 1681028828, | ||
| 28 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", | ||
| 29 | "owner": "nix-systems", | ||
| 30 | "repo": "default", | ||
| 31 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", | ||
| 32 | "type": "github" | ||
| 33 | }, | ||
| 34 | "original": { | ||
| 35 | "owner": "nix-systems", | ||
| 36 | "repo": "default", | ||
| 37 | "type": "github" | ||
| 38 | } | ||
| 39 | }, | ||
| 40 | "utils": { | ||
| 41 | "inputs": { | ||
| 42 | "systems": "systems" | ||
| 43 | }, | ||
| 44 | "locked": { | ||
| 45 | "lastModified": 1731533236, | ||
| 46 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", | ||
| 47 | "owner": "numtide", | ||
| 48 | "repo": "flake-utils", | ||
| 49 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", | ||
| 50 | "type": "github" | ||
| 51 | }, | ||
| 52 | "original": { | ||
| 53 | "owner": "numtide", | ||
| 54 | "repo": "flake-utils", | ||
| 55 | "type": "github" | ||
| 56 | } | ||
| 57 | } | ||
| 58 | }, | ||
| 59 | "root": "root", | ||
| 60 | "version": 7 | ||
| 61 | } | ||
flake.nix created+25| ... | @@ -0,0 +1,25 @@ | ||
| 1 | { | ||
| 2 | inputs = { | ||
| 3 | nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | ||
| 4 | utils.url = "github:numtide/flake-utils"; | ||
| 5 | }; | ||
| 6 | outputs = | ||
| 7 | { nixpkgs, utils, ... }: | ||
| 8 | utils.lib.eachDefaultSystem ( | ||
| 9 | system: | ||
| 10 | let | ||
| 11 | pkgs = nixpkgs.legacyPackages.${system}; | ||
| 12 | in | ||
| 13 | { | ||
| 14 | devShells.default = pkgs.mkShell { | ||
| 15 | buildInputs = [ | ||
| 16 | pkgs.nodejs_24 # runtime | ||
| 17 | pkgs.deno # formatter | ||
| 18 | (pkgs.ffmpeg.override { | ||
| 19 | withSvtav1 = true; | ||
| 20 | }) | ||
| 21 | ]; | ||
| 22 | }; | ||
| 23 | } | ||
| 24 | ); | ||
| 25 | } | ||
framework/bundle.ts+2-2| ... | @@ -40,7 +40,7 @@ export async function bundleClientJavaScript( | ... | @@ -40,7 +40,7 @@ export async function bundleClientJavaScript( |
| 40 | logLevel: "silent", | 40 | logLevel: "silent", |
| 41 | metafile: true, | 41 | metafile: true, |
| 42 | minify: !dev, | 42 | minify: !dev, |
| 43 | outdir: "/out!", | 43 | outdir: "out!", |
| 44 | plugins: clientPlugins, | 44 | plugins: clientPlugins, |
| 45 | write: false, | 45 | write: false, |
| 46 | define: { | 46 | define: { |
| ... | @@ -174,7 +174,7 @@ export async function bundleServerJavaScript( | ... | @@ -174,7 +174,7 @@ export async function bundleServerJavaScript( |
| 174 | platform: "node", | 174 | platform: "node", |
| 175 | format: "esm", | 175 | format: "esm", |
| 176 | minify: false, | 176 | minify: false, |
| 177 | outdir: "/out!", | 177 | outdir: "out!", |
| 178 | plugins: serverPlugins, | 178 | plugins: serverPlugins, |
| 179 | splitting: true, | 179 | splitting: true, |
| 180 | logLevel: "silent", | 180 | logLevel: "silent", |
framework/hot.ts+1-1| ... | @@ -96,7 +96,7 @@ Module._resolveFilename = (...args) => { | ... | @@ -96,7 +96,7 @@ Module._resolveFilename = (...args) => { |
| 96 | try { | 96 | try { |
| 97 | return require.resolve(replacedPath, { paths: [projectSrc] }); | 97 | return require.resolve(replacedPath, { paths: [projectSrc] }); |
| 98 | } catch (err: any) { | 98 | } catch (err: any) { |
| 99 | if (err.code === "MODULE_NOT_FOUND" && err.requireStack.length <= 1) { | 99 | if (err.code === "MODULE_NOT_FOUND" && (err?.requireStack?.length ?? 0) <= 1) { |
| 100 | err.message.replace(replacedPath, args[0]); | 100 | err.message.replace(replacedPath, args[0]); |
| 101 | } | 101 | } |
| 102 | } | 102 | } |
readme.md+3| ... | @@ -67,6 +67,9 @@ node run watch | ... | @@ -67,6 +67,9 @@ node run watch |
| 67 | <!-- poor module support), CLIs can include a `main` function, which is executed --> | 67 | <!-- poor module support), CLIs can include a `main` function, which is executed --> |
| 68 | <!-- when the REPL runs it. --> | 68 | <!-- when the REPL runs it. --> |
| 69 | 69 | ||
| 70 | for unix systems, the provided `flake.nix` can be used with `nix develop` to | ||
| 71 | open a shell with all needed system dependencies. | ||
| 72 | |||
| 70 | ## Contributions | 73 | ## Contributions |
| 71 | 74 | ||
| 72 | No contributions to `src` accepted, only `framework`. | 75 | No contributions to `src` accepted, only `framework`. |
src/file-viewer/bin/scan3.ts+4-3| ... | @@ -10,7 +10,7 @@ | ... | @@ -10,7 +10,7 @@ |
| 10 | // This is the third iteration of the scanner, hence its name "scan3"; | 10 | // This is the third iteration of the scanner, hence its name "scan3"; |
| 11 | // Remember that any software you want to be maintainable and high | 11 | // Remember that any software you want to be maintainable and high |
| 12 | // quality cannot be written with AI. | 12 | // quality cannot be written with AI. |
| 13 | const root = path.resolve("C:/media"); | 13 | const root = path.resolve("/Volumes/clover/Published"); |
| 14 | const workDir = path.resolve(".clover/file-assets"); | 14 | const workDir = path.resolve(".clover/file-assets"); |
| 15 | 15 | ||
| 16 | export async function main() { | 16 | export async function main() { |
| ... | @@ -118,7 +118,7 @@ export async function main() { | ... | @@ -118,7 +118,7 @@ export async function main() { |
| 118 | }, | 118 | }, |
| 119 | getItemText: (job) => | 119 | getItemText: (job) => |
| 120 | job.publicPath.slice(1) + (job.stat ? "" : " (deleted)"), | 120 | job.publicPath.slice(1) + (job.stat ? "" : " (deleted)"), |
| 121 | maxJobs: 2, | 121 | maxJobs: 10, |
| 122 | }); | 122 | }); |
| 123 | using qProcess = new async.Queue({ | 123 | using qProcess = new async.Queue({ |
| 124 | name: "Process Contents", | 124 | name: "Process Contents", |
| ... | @@ -136,7 +136,7 @@ export async function main() { | ... | @@ -136,7 +136,7 @@ export async function main() { |
| 136 | }, | 136 | }, |
| 137 | getItemText: ({ mediaFile, processor }) => | 137 | getItemText: ({ mediaFile, processor }) => |
| 138 | `${mediaFile.path.slice(1)} - ${processor.name}`, | 138 | `${mediaFile.path.slice(1)} - ${processor.name}`, |
| 139 | maxJobs: 1, | 139 | maxJobs: 4, |
| 140 | }); | 140 | }); |
| 141 | 141 | ||
| 142 | function decodeProcessors(input: string) { | 142 | function decodeProcessors(input: string) { |
| ... | @@ -442,6 +442,7 @@ const procVideos = transcodeRules.videoFormats.map<Process>((preset) => ({ | ... | @@ -442,6 +442,7 @@ const procVideos = transcodeRules.videoFormats.map<Process>((preset) => ({ |
| 442 | include: rules.extsVideo, | 442 | include: rules.extsVideo, |
| 443 | enable: ffmpegBin != null, | 443 | enable: ffmpegBin != null, |
| 444 | async run({ absPath, mediaFile, spin }) { | 444 | async run({ absPath, mediaFile, spin }) { |
| 445 | if ((mediaFile.duration ?? 0) < 10) return; | ||
| 445 | await produceAsset(`${mediaFile.hash}/${preset.id}`, async (base) => { | 446 | await produceAsset(`${mediaFile.hash}/${preset.id}`, async (base) => { |
| 446 | base = path.dirname(base); | 447 | base = path.dirname(base); |
| 447 | await fs.mkdir(base); | 448 | await fs.mkdir(base); |
src/file-viewer/ffmpeg.ts+2-1| ... | @@ -28,7 +28,7 @@ export interface SpawnOptions { | ... | @@ -28,7 +28,7 @@ export interface SpawnOptions { |
| 28 | 28 | ||
| 29 | export async function spawn(options: SpawnOptions) { | 29 | export async function spawn(options: SpawnOptions) { |
| 30 | const { ffmpeg = "ffmpeg", args, title, cwd } = options; | 30 | const { ffmpeg = "ffmpeg", args, title, cwd } = options; |
| 31 | const proc = child_process.spawn(ffmpeg, args, { | 31 | const proc = child_process.spawn(ffmpeg, [...defaultExtraOptions, ...args], { |
| 32 | stdio: ["ignore", "inherit", "pipe"], | 32 | stdio: ["ignore", "inherit", "pipe"], |
| 33 | env: { ...process.env, SVT_LOG: "2" }, | 33 | env: { ...process.env, SVT_LOG: "2" }, |
| 34 | cwd, | 34 | cwd, |
| ... | @@ -59,6 +59,7 @@ export async function spawn(options: SpawnOptions) { | ... | @@ -59,6 +59,7 @@ export async function spawn(options: SpawnOptions) { |
| 59 | } else result satisfies never; | 59 | } else result satisfies never; |
| 60 | }); | 60 | }); |
| 61 | const [code, signal] = await events.once(proc, "close"); | 61 | const [code, signal] = await events.once(proc, "close"); |
| 62 | running = false; | ||
| 62 | if (code !== 0) { | 63 | if (code !== 0) { |
| 63 | const fmt = code ? `code ${code}` : `signal ${signal}`; | 64 | const fmt = code ? `code ${code}` : `signal ${signal}`; |
| 64 | const e: any = new Error(`ffmpeg failed with ${fmt}`); | 65 | const e: any = new Error(`ffmpeg failed with ${fmt}`); |