Skip to content

Commit

Permalink
Expose livestreamId from auditoria to the video stream widget
Browse files Browse the repository at this point in the history
  • Loading branch information
reivilibre committed Jan 21, 2025
1 parent 2856d16 commit a921115
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/default.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ livestream:
# The template for livestreams in auditorium rooms
# Available variables:
# id - The room ID/name (eg: "D.collab")
# sId - The room ID/name, but lowercase and only alphanumeric characters
# sId - [DEPRECATED] The room ID/name, but lowercase and only alphanumeric characters
# are included (eg: "dcollab")
# livestreamId - The livestream ID acquired from the conference schedule source.
auditoriumUrl: "https://stream.example.org/conference/hls/{id}.m3u8"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Map {
"id": "5",
"isPhysical": true,
"kind": "auditorium",
"livestreamId": "c1111a",
"name": "Open CAD/CAM devroom",
"slug": "open_cad_cam",
"talks": Map {
Expand Down Expand Up @@ -50,6 +51,7 @@ Map {
"id": "6",
"isPhysical": true,
"kind": "auditorium",
"livestreamId": "c4172",
"name": "Self-Hosted Software devroom",
"slug": "selfhosting",
"talks": Map {
Expand Down Expand Up @@ -115,6 +117,7 @@ Map {
"id": "7",
"isPhysical": true,
"kind": "auditorium",
"livestreamId": "",
"name": "Keynotes (TALKS NOT ANNOUNCED YET)",
"slug": "key_notes",
"talks": Map {},
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/backends/json/fosdem_democon.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"matrix_id": "@conal:example.org"
}
],
"conference_room": "C.1.111",
"conference_room": "c1111a",
"start_datetime": "2024-02-01T09:30:00+01:00",
"duration": 30,
"track": {
Expand Down Expand Up @@ -55,7 +55,7 @@
"matrix_id": "@chloe:example.org"
}
],
"conference_room": "C.4.172",
"conference_room": "c4172",
"start_datetime": "2024-02-01T09:45:00+01:00",
"duration": 45,
"track": {
Expand Down Expand Up @@ -84,7 +84,7 @@
"matrix_id": "@chloe:example.org"
}
],
"conference_room": "C.4.172",
"conference_room": "c4172",
"start_datetime": "2024-02-01T10:45:00+01:00",
"duration": 45,
"track": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`parsing pentabarf XML: overview: auditoriums 1`] = `
"id": "A.01 (Someroom)",
"isPhysical": false,
"kind": "auditorium",
"livestreamId": "",
"name": "A.01 (Someroom)",
"slug": "a.01_someroom_",
"talks": Map {
Expand Down Expand Up @@ -50,6 +51,7 @@ exports[`parsing pentabarf XML: overview: conference 1`] = `
"id": "A.01 (Someroom)",
"isPhysical": false,
"kind": "auditorium",
"livestreamId": "",
"name": "A.01 (Someroom)",
"slug": "a.01_someroom_",
"talks": Map {
Expand Down
21 changes: 21 additions & 0 deletions src/backends/json/FosdemJsonScheduleLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class FosdemJsonScheduleLoader {
const jsonSchedule = jsonDesc as FOSDEMSpecificJSONSchedule;

this.auditoriums = new Map();
const livestreamIdMapping = this.makeLivestreamIdMapping(jsonSchedule);

for (let rawTrack of jsonSchedule.tracks) {
// Tracks are now (since 2025) mapped 1:1 to auditoria
Expand All @@ -29,6 +30,12 @@ export class FosdemJsonScheduleLoader {
throw `Conflict in auditorium ID «${auditorium.id}»!`;
}
this.auditoriums.set(auditorium.id, auditorium);

// Look up the livestream ID
let livestreamId = livestreamIdMapping.get(auditorium.id);
if (livestreamId !== undefined) {
auditorium.livestreamId = livestreamId;
}
}

this.talks = new Map();
Expand Down Expand Up @@ -57,6 +64,19 @@ export class FosdemJsonScheduleLoader {
};
}

/**
* Returns a mapping from auditorium (track) ID to the conference_room for one of the talks in that track.
*
* Assumption: All talks in the same track are scheduled in the same room. (this is true for FOSDEM)
*/
private makeLivestreamIdMapping(sched: FOSDEMSpecificJSONSchedule): Map<string, string> {
let out = new Map();
for (let talk of sched.talks) {
out.set(talk.track.id.toString(), talk.conference_room);
}
return out;
}

private convertPerson(person: FOSDEMPerson): IPerson {
if (! Object.values<string>(Role).includes(person.event_role)) {
throw new Error("unknown role: " + person.event_role);
Expand Down Expand Up @@ -117,6 +137,7 @@ export class FosdemJsonScheduleLoader {
talks: new Map(),
// Hardcoded: FOSDEM is always physical now.
isPhysical: true,
// This will be populated afterwards, with the value of one of the talks.
livestreamId: '',
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
},
"conference_room": {
"type": "string",
"description": "Name of the physical (in real life) room that the talk is held in."
"description": "System name (not human-friendly) of the physical (in real life) room that the talk is held in. e.g. `ud2218a`"
}
},
"required": [ "event_id", "title", "start_datetime", "duration", "persons", "track", "conference_room" ]
Expand Down
2 changes: 1 addition & 1 deletion src/backends/json/jsontypes/FosdemJsonSchedule.schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface FOSDEMTalk {
[k: string]: unknown;
};
/**
* Name of the physical (in real life) room that the talk is held in.
* System name (not human-friendly) of the physical (in real life) room that the talk is held in. e.g. `ud2218a`
*/
conference_room: string;
[k: string]: unknown;
Expand Down
1 change: 1 addition & 0 deletions src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export function renderAuditoriumWidget(req: Request, res: Response, conference:
// HACK for FOSDEM 2023 and FOSDEM 2024: transform auditorium IDs to the livestream ID
// 1. 'K1.105A (Words)' -> 'k1.105a'
// 2. 'k1.105a' -> 'k1105a'
// DEPRECATED — see livestreamId instead nowadays!
let sid = audId.toLowerCase().replace(/\s+\(.+\)$/, '').replace(/[^a-z0-9]/g, '');

const streamUrl = template(auditoriumUrl, {
Expand Down

0 comments on commit a921115

Please sign in to comment.