Skip to content

Commit 486d70d

Browse files
author
Karin Huber
committed
Streaming assets
1 parent 2d4139a commit 486d70d

14 files changed

+81
-60
lines changed

streaming-assets/banners/generate.js

Lines changed: 81 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -5,79 +5,100 @@ const rawData = fs.readFileSync('./../../data/sessionize.json');
55
const template = fs.readFileSync('template.svg', { encoding: 'utf-8' });
66
const data = JSON.parse(rawData);
77

8-
98
// banner-logo
10-
execSync(`"C:\\Program Files\\Inkscape\\bin\\inkscape" --export-filename "png/banner-logo.png" --export-type "png" "logo.svg"`, (error, stdout, stderr) => {
9+
execSync(
10+
`"C:\\Program Files\\Inkscape\\bin\\inkscape" --export-filename "png/banner-logo.png" --export-type "png" "logo.svg"`,
11+
(error, stdout, stderr) => {
1112
console.log(' ', error, stdout, stderr);
12-
});
13-
13+
}
14+
);
1415

1516
for (let session of data.sessions) {
16-
try {
17-
console.log(session.title);
18-
19-
// title
20-
let words = session.title.split(' ');
21-
let chars = 0;
22-
let title1 = '';
23-
let title2 = '';
17+
try {
18+
console.log(session.title);
2419

25-
for (let word of words) {
26-
if (chars + word.length < 90 && !title2) {
27-
if (title1) {
28-
title1 += ' ';
29-
chars++;
30-
}
20+
// title
21+
let words = session.title.split(' ');
22+
let chars = 0;
23+
let title1 = '';
24+
let title2 = '';
3125

32-
title1 += word;
33-
chars += word.length;
34-
} else {
35-
if (title2) {
36-
title2 += ' ';
37-
chars++;
38-
}
39-
40-
title2 += word;
41-
chars += word.length;
42-
}
26+
for (let word of words) {
27+
if (chars + word.length < 90 && !title2) {
28+
if (title1) {
29+
title1 += ' ';
30+
chars++;
4331
}
4432

45-
let svg = template.replace('{{title1}}', title1.replace('&', '&amp;'));
46-
svg = svg.replace('{{title2}}', title2.replace('&', '&amp;'));
47-
33+
title1 += word;
34+
chars += word.length;
35+
} else {
4836
if (title2) {
49-
svg = svg.replace('{{bannerHeight}}', 210);
50-
svg = svg.replace('{{bannerY}}', 1080 - 210);
51-
svg = svg.replace('{{title1Y}}', 930);
52-
svg = svg.replace('{{title2Y}}', 980);
53-
} else {
54-
svg = svg.replace('{{bannerHeight}}', 160);
55-
svg = svg.replace('{{bannerY}}', 1080 - 160);
56-
svg = svg.replace('{{title1Y}}', 980);
57-
svg = svg.replace('{{title2Y}}', 980);
37+
title2 += ' ';
38+
chars++;
5839
}
5940

60-
// speaker
61-
const answers = session.questionAnswers;
62-
let shortTitle = answers.find(q => q.questionId === 71787).answerValue;
41+
title2 += word;
42+
chars += word.length;
43+
}
44+
}
6345

64-
const speakers = session.speakers.map(speakerId => data.speakers.find(s => s.id === speakerId));
65-
const room = data.rooms.find(s => s.id === session.roomId).name;
66-
let speakersText = speakers.sort((a, b) => a.lastName > b.lastName ? 1 : -1).map(s => s.firstName + ' ' + s.lastName + (s.tagLine && speakers.length === 1 ? ', ' + s.tagLine : '')).join(', ');
67-
if (speakers.length > 1 && shortTitle === 'dwh-porsche') {
68-
speakersText += ' (Porsche Holding Salzburg)';
69-
}
70-
speakersText = speakersText.replace(/\&/, '&amp;');
71-
svg = svg.replace('{{speakers}}', speakersText);
46+
let svg = template.replace('{{title1}}', title1.replace('&', '&amp;'));
47+
svg = svg.replace('{{title2}}', title2.replace('&', '&amp;'));
48+
49+
if (title2) {
50+
svg = svg.replace('{{bannerHeight}}', 210);
51+
svg = svg.replace('{{bannerY}}', 1080 - 210);
52+
svg = svg.replace('{{title1Y}}', 930);
53+
svg = svg.replace('{{title2Y}}', 980);
54+
} else {
55+
svg = svg.replace('{{bannerHeight}}', 160);
56+
svg = svg.replace('{{bannerY}}', 1080 - 160);
57+
svg = svg.replace('{{title1Y}}', 980);
58+
svg = svg.replace('{{title2Y}}', 980);
59+
}
7260

73-
// save
74-
fs.writeFileSync('./svg/' + shortTitle + '.svg', svg, { encoding: 'utf-8' });
61+
// speaker
62+
const answers = session.questionAnswers;
63+
let shortTitle = answers.find((q) => q.questionId === 71787).answerValue;
7564

76-
// convert to png
77-
execSync(`"C:\\Program Files\\Inkscape\\bin\\inkscape" --export-filename "png/${room} - ${(new Date(session.startsAt)).getHours()}-00 - ${shortTitle}.png" --export-type "png" "svg\\${shortTitle}.svg"`, (error, stdout, stderr) => {
78-
console.log(' ', error, stdout, stderr);
79-
});
80-
} catch (e) {
81-
console.log('error', e)
65+
const speakers = session.speakers.map((speakerId) =>
66+
data.speakers.find((s) => s.id === speakerId)
67+
);
68+
const room = data.rooms.find((s) => s.id === session.roomId).name;
69+
let speakersText = speakers
70+
.sort((a, b) => (a.lastName > b.lastName ? 1 : -1))
71+
.map(
72+
(s) =>
73+
s.firstName +
74+
' ' +
75+
s.lastName +
76+
(s.tagLine && speakers.length === 1 ? ', ' + s.tagLine : '')
77+
)
78+
.join(', ');
79+
if (speakers.length > 1 && shortTitle === 'dwh-porsche') {
80+
speakersText += ' (Porsche Holding Salzburg)';
8281
}
82+
speakersText = speakersText.replace(/\&/, '&amp;');
83+
svg = svg.replace('{{speakers}}', speakersText);
84+
85+
// save
86+
fs.writeFileSync('./svg/' + shortTitle + '.svg', svg, {
87+
encoding: 'utf-8',
88+
});
89+
90+
// convert to png
91+
execSync(
92+
`"C:\\Program Files\\Inkscape\\bin\\inkscape" --export-filename "png/${room} - ${new Date(
93+
session.startsAt
94+
).getHours()}-${new Date(
95+
session.startsAt
96+
).getMinutes()} - ${shortTitle}.png" --export-type "png" "svg\\${shortTitle}.svg"`,
97+
(error, stdout, stderr) => {
98+
console.log(' ', error, stdout, stderr);
99+
}
100+
);
101+
} catch (e) {
102+
console.log('error', e);
103+
}
83104
}

streaming-assets/banners/png/Saal 12 - 11-00 - code-signing.png renamed to streaming-assets/banners/png/Saal 12 - 11-0 - code-signing.png

File renamed without changes.

streaming-assets/banners/png/Saal 12 - 11-00 - empowering-developers.png renamed to streaming-assets/banners/png/Saal 12 - 11-55 - empowering-developers.png

File renamed without changes.

streaming-assets/banners/png/Saal 12 - 13-00 - proxmox-in-der-praxis.png renamed to streaming-assets/banners/png/Saal 12 - 13-30 - proxmox-in-der-praxis.png

File renamed without changes.

streaming-assets/banners/png/Saal 12 - 14-00 - leading-through-ai-driven-transformation.png renamed to streaming-assets/banners/png/Saal 12 - 14-25 - leading-through-ai-driven-transformation.png

File renamed without changes.

streaming-assets/banners/png/Saal 12 - 9-00 - central-network-management.png renamed to streaming-assets/banners/png/Saal 12 - 9-55 - central-network-management.png

File renamed without changes.

streaming-assets/banners/png/Saal 13 - 11-00 - openai-service.png renamed to streaming-assets/banners/png/Saal 13 - 11-0 - openai-service.png

File renamed without changes.

streaming-assets/banners/png/Saal 13 - 11-00 - finetuning-openai-llms.png renamed to streaming-assets/banners/png/Saal 13 - 11-55 - finetuning-openai-llms.png

File renamed without changes.

streaming-assets/banners/png/Saal 13 - 12-00 - ai-driven-sea-navigation.png renamed to streaming-assets/banners/png/Saal 13 - 12-40 - ai-driven-sea-navigation.png

File renamed without changes.

streaming-assets/banners/png/Saal 13 - 13-00 - multitenant-deployment-strategy.png renamed to streaming-assets/banners/png/Saal 13 - 13-30 - multitenant-deployment-strategy.png

File renamed without changes.

0 commit comments

Comments
 (0)