Skip to content
Snippets Groups Projects
Verified Commit 8584f9a6 authored by Joschua "λ" Kesper's avatar Joschua "λ" Kesper
Browse files

Read old.json from file rather than from URL

parent bd24ba1e
Branches
No related tags found
1 merge request!51Fix title
Pipeline #263172 passed
...@@ -17,6 +17,6 @@ Install dependencies: ...@@ -17,6 +17,6 @@ Install dependencies:
## Testing ## Testing
1. Run `pnpm build && node out.js test/test_transcripts test/out` 1. Run `pnpm build && node out.js test/test_transcripts test/out -O test/test_old.json`
- If you only want to test a single file, you also use `test/single_transcript` as input - If you only want to test a single file, you also use `test/single_transcript` as input
2. Open any file in test/out in your browser 2. Open any file in test/out in your browser
...@@ -12,6 +12,7 @@ async function main() { ...@@ -12,6 +12,7 @@ async function main() {
) )
.argument("<outputDir>", "path to output the rendered html to") .argument("<outputDir>", "path to output the rendered html to")
.option("-A, --output-ast", "Also save the AST as a file", false) .option("-A, --output-ast", "Also save the AST as a file", false)
.option("-O, --old-json [path]", "JSON file to take data about extra transcripts from")
.option("-B, --base-url [url]", "Basic URL for the RSS feed") .option("-B, --base-url [url]", "Basic URL for the RSS feed")
.action(run); .action(run);
await program.parseAsync(process.argv); await program.parseAsync(process.argv);
...@@ -53,18 +54,19 @@ async function run(inputDir: string, outputDir: string, options: CliOptions) { ...@@ -53,18 +54,19 @@ async function run(inputDir: string, outputDir: string, options: CliOptions) {
// (4) Generate index page // (4) Generate index page
let oldTranscripts: FinishedTranscriptMeta[] = []; let oldTranscripts: FinishedTranscriptMeta[] = [];
try { if (options.oldJson) {
// These are generated in the Sitzungen repo try {
const res = await fetch("https://fsr.oh14.de/protokolle/old.json"); // These are generated in the Sitzungen repo
oldTranscripts = (await res.json()).map(t => ({ const res = await fs.readFile(options.oldJson, { encoding: 'utf8' })
// Fallback for some options: oldTranscripts = JSON.parse(res).map(t => ({
spec_version: -1, // PDFs // Fallback for some options:
no_link: false, spec_version: -1, // PDFs
...t, no_link: false,
})); ...t,
console.log(oldTranscripts); }));
} catch (e) { } catch (e) {
console.error("Failed to get old transcripts", e); console.error("Failed to get old transcripts", e);
}
} }
const allTranscripts = [ const allTranscripts = [
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment