@tricoteuses/senat 2.22.6 → 2.22.8
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/lib/src/parsers/texte.js
CHANGED
|
@@ -7,6 +7,7 @@ function buildDivision(node, index) {
|
|
|
7
7
|
const level = DivisionType[tag];
|
|
8
8
|
const titleNode = node.querySelector("num");
|
|
9
9
|
const subtitleNode = node.querySelector("heading");
|
|
10
|
+
const mention = node.getAttribute("data:mention") ?? null;
|
|
10
11
|
const headings = [
|
|
11
12
|
...(titleNode
|
|
12
13
|
? [
|
|
@@ -25,6 +26,12 @@ function buildDivision(node, index) {
|
|
|
25
26
|
]
|
|
26
27
|
: []),
|
|
27
28
|
];
|
|
29
|
+
if (mention?.includes("(nouveau)") && headings.length > 0) {
|
|
30
|
+
headings[0] = {
|
|
31
|
+
text: headings[0].text != null ? `${headings[0].text} (nouveau)` : "(nouveau)",
|
|
32
|
+
html: headings[0].html != null ? `${headings[0].html} (nouveau)` : "(nouveau)",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
28
35
|
const division = {
|
|
29
36
|
index,
|
|
30
37
|
eId,
|
|
@@ -65,6 +72,7 @@ function buildEmptyArticle(index) {
|
|
|
65
72
|
function splitTexte(texteContentRoot) {
|
|
66
73
|
const divisions = [];
|
|
67
74
|
let divisionIndex = 0;
|
|
75
|
+
const mentionByEId = new Map();
|
|
68
76
|
const iter = (node) => {
|
|
69
77
|
if (node.nodeName === "content") {
|
|
70
78
|
return;
|
|
@@ -79,9 +87,16 @@ function splitTexte(texteContentRoot) {
|
|
|
79
87
|
case "section":
|
|
80
88
|
case "subsection":
|
|
81
89
|
case "paragraph":
|
|
82
|
-
case "article":
|
|
83
90
|
divisions.push(buildDivision(node, divisionIndex++));
|
|
84
91
|
break;
|
|
92
|
+
case "article": {
|
|
93
|
+
const division = buildDivision(node, divisionIndex++);
|
|
94
|
+
const mention = node.getAttribute("data:mention");
|
|
95
|
+
if (mention)
|
|
96
|
+
mentionByEId.set(division.eId, mention);
|
|
97
|
+
divisions.push(division);
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
85
100
|
}
|
|
86
101
|
if (node.nodeName === "alinea") {
|
|
87
102
|
Array.from(node.childNodes)
|
|
@@ -104,6 +119,21 @@ function splitTexte(texteContentRoot) {
|
|
|
104
119
|
}
|
|
105
120
|
};
|
|
106
121
|
iter(texteContentRoot);
|
|
122
|
+
for (const division of divisions) {
|
|
123
|
+
if (division.tag !== "article")
|
|
124
|
+
continue;
|
|
125
|
+
const article = division;
|
|
126
|
+
const mention = mentionByEId.get(division.eId);
|
|
127
|
+
if (mention?.includes("(Supprimé)") && article.alineas.length === 0) {
|
|
128
|
+
article.alineas.push({
|
|
129
|
+
eId: "",
|
|
130
|
+
heading: { text: null },
|
|
131
|
+
text: "(Supprimé)",
|
|
132
|
+
html: "(Supprimé)",
|
|
133
|
+
pastille: null,
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
107
137
|
return divisions;
|
|
108
138
|
}
|
|
109
139
|
export function transformTexte(document) {
|
|
@@ -132,6 +132,7 @@ async function processGroupedReunion(agenda, session, dataDir, lastByVideo) {
|
|
|
132
132
|
// 3) Always update BEST agenda JSON from local NVS
|
|
133
133
|
await processOneReunionMatch({
|
|
134
134
|
agenda,
|
|
135
|
+
best,
|
|
135
136
|
baseDir: ctx.baseDir,
|
|
136
137
|
dataDir: ctx.dataDir,
|
|
137
138
|
session: ctx.session,
|
|
@@ -3,6 +3,7 @@ import { BestMatch, LastForVideo, MatchContext } from "./types";
|
|
|
3
3
|
import { CommandLineOptions } from "command-line-args";
|
|
4
4
|
export declare function processOneReunionMatch(args: {
|
|
5
5
|
agenda: Reunion;
|
|
6
|
+
best: BestMatch | null;
|
|
6
7
|
baseDir: string;
|
|
7
8
|
dataDir: string;
|
|
8
9
|
session: number;
|
|
@@ -29,6 +30,7 @@ export declare function processBisIfNeeded(args: {
|
|
|
29
30
|
writeIfChanged: (p: string, content: string) => Promise<void>;
|
|
30
31
|
processOneReunionMatch: (args: {
|
|
31
32
|
agenda: Reunion;
|
|
33
|
+
best: BestMatch | null;
|
|
32
34
|
baseDir: string;
|
|
33
35
|
dataDir: string;
|
|
34
36
|
session: number;
|
|
@@ -6,7 +6,7 @@ import fs from "fs-extra";
|
|
|
6
6
|
import fsp from "fs/promises";
|
|
7
7
|
import path from "path";
|
|
8
8
|
export async function processOneReunionMatch(args) {
|
|
9
|
-
const { agenda, baseDir, dataDir, session, options, writeIfChanged, lastByVideo, getAgendaSegmentTimecodes, buildSenatVodMasterM3u8FromNvs, } = args;
|
|
9
|
+
const { agenda, best, baseDir, dataDir, session, options, writeIfChanged, lastByVideo, getAgendaSegmentTimecodes, buildSenatVodMasterM3u8FromNvs, } = args;
|
|
10
10
|
const reunionUid = agenda.uid;
|
|
11
11
|
let dataTxt;
|
|
12
12
|
let finalTxt;
|
|
@@ -67,7 +67,7 @@ export async function processOneReunionMatch(args) {
|
|
|
67
67
|
console.warn(`[warn] invalid JSON in ${agendaJsonPath}`);
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
const next = { ...obj, urlVideo: master, startTime: agenda.startTime };
|
|
70
|
+
const next = { ...obj, urlVideo: master, startTime: agenda.startTime, urlPageVideo: best?.pageUrl };
|
|
71
71
|
if (timecodeDebutVideo != null) {
|
|
72
72
|
next.timecodeDebutVideo = timecodeDebutVideo;
|
|
73
73
|
if (timecodeFinVideo != null)
|
|
@@ -102,6 +102,7 @@ export async function processBisIfNeeded(args) {
|
|
|
102
102
|
await downloadNvsForMatch(secondBest, baseDirBis);
|
|
103
103
|
await processOneReunionMatch({
|
|
104
104
|
agenda: agendaBis,
|
|
105
|
+
best: secondBest,
|
|
105
106
|
baseDir: baseDirBis,
|
|
106
107
|
dataDir: ctx.dataDir,
|
|
107
108
|
session: ctx.session,
|