add video; update dedup script
This commit is contained in:
1 parent
b85cf6053b
commit
6cff0efff2
3 files changed
+1895
-3
No files matched your search
+9
-3
@@ -25,6 +25,7 @@
|
||||
import { readFileSync, writeFileSync } from "node:fs";
|
||||
import { resolve, dirname } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import matter from "gray-matter";
|
||||
// @ts-ignore - sharp ships no bundled .d.ts; types are not needed at runtime
|
||||
import sharp from "sharp";
|
||||
|
||||
@@ -267,17 +268,22 @@ export async function renderFile(inputPath, outputPath, threshold = 0.005) {
|
||||
const baseDir = dirname(resolvedInput);
|
||||
|
||||
console.log(`Reading : ${resolvedInput}`);
|
||||
console.log(`Threshold : ${threshold}`);
|
||||
|
||||
const raw = readFileSync(resolvedInput, "utf8");
|
||||
const { data, content: raw } = matter(readFileSync(resolvedInput, "utf8"));
|
||||
const lines = raw.split("\n").map(parseLine);
|
||||
|
||||
threshold =
|
||||
typeof data["dedup"] === "number" && data["dedup"] > 0
|
||||
? data["dedup"]
|
||||
: threshold;
|
||||
console.log(`Threshold : ${threshold}`);
|
||||
|
||||
/** @type {Stats} */
|
||||
const stats = { comparisons: 0, grouped: 0 };
|
||||
const grouped = await groupImages(lines, baseDir, threshold, stats);
|
||||
const output = render(grouped);
|
||||
|
||||
writeFileSync(resolvedOutput, output, "utf8");
|
||||
writeFileSync(resolvedOutput, matter.stringify(output, data), "utf8");
|
||||
|
||||
console.log(
|
||||
`Comparisons: ${stats.comparisons} | grouped: ${stats.grouped}`,
|
||||
|
||||
Reference in new issue
Block a user