waha-shared 1.0.326 → 1.0.331
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/dist/data/languages/index.d.ts +1 -5
- package/dist/data/languages/languages.json +45 -135
- package/dist/data/languages/languages.schema.json +3 -24
- package/dist/data/languages/languages.zod.d.ts +1 -10
- package/dist/data/languages/languages.zod.js +5 -18
- package/dist/data/mediaDurations/mediaDurations.json +673 -45
- package/dist/data/releaseNotes/releaseNotes.json +9 -2
- package/dist/data/youtubeVideos/youtubeVideos.json +115 -55
- package/dist/functions/scripturePassages.js +11 -9
- package/dist/functions/sets.d.ts +4 -15
- package/dist/functions/sets.js +228 -168
- package/dist/functions/utils.d.ts +1 -6
- package/dist/functions/utils.js +4 -18
- package/dist/types/sets.d.ts +19 -22
- package/package.json +2 -3
- package/dist/data/languageAssets/index.d.ts +0 -1
- package/dist/data/languageAssets/index.js +0 -7
- package/dist/data/languageAssets/languageAssets.json +0 -44404
- package/dist/data/languageAssets/languageAssets.schema.json +0 -19
- package/dist/data/languageAssets/languageAssets.zod.d.ts +0 -3
- package/dist/data/languageAssets/languageAssets.zod.js +0 -7
- package/dist/functions/ffmpeg.d.ts +0 -104
- package/dist/functions/ffmpeg.js +0 -307
- package/dist/functions/upload.d.ts +0 -34
- package/dist/functions/upload.js +0 -49
package/dist/functions/sets.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getSetInfo = getSetInfo;
|
|
4
|
-
exports.assembleLessonSections = assembleLessonSections;
|
|
5
4
|
exports.getLessonInfo = getLessonInfo;
|
|
5
|
+
exports.convertSToString = convertSToString;
|
|
6
6
|
exports.shouldShowLesson = shouldShowLesson;
|
|
7
7
|
exports.getExpectedLessonDuration = getExpectedLessonDuration;
|
|
8
8
|
const bibleStatuses_1 = require("../data/bibleStatuses");
|
|
9
|
+
const mediaDurations_1 = require("../data/mediaDurations");
|
|
9
10
|
const sets_1 = require("../data/sets");
|
|
10
11
|
const specialIds_1 = require("../data/specialIds");
|
|
11
12
|
const youtubeVideos_1 = require("../data/youtubeVideos");
|
|
@@ -52,79 +53,95 @@ function getSetInfo({ setId, languageId, setIds, t, }) {
|
|
|
52
53
|
};
|
|
53
54
|
return toReturn;
|
|
54
55
|
}
|
|
55
|
-
function
|
|
56
|
+
function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions, }) {
|
|
57
|
+
if (!lessonId)
|
|
58
|
+
return;
|
|
59
|
+
else if (lessonId.split('.').length !== 3)
|
|
60
|
+
return;
|
|
61
|
+
const [category, setNumber, lessonNumber] = lessonId.split('.');
|
|
62
|
+
const languageId = languageInfo.languageId;
|
|
63
|
+
setInfo =
|
|
64
|
+
setInfo ??
|
|
65
|
+
getSetInfo({
|
|
66
|
+
setId: [category, setNumber].join('.'),
|
|
67
|
+
languageId,
|
|
68
|
+
setIds: languageInfo.setIds,
|
|
69
|
+
t,
|
|
70
|
+
});
|
|
71
|
+
if (!setInfo) {
|
|
72
|
+
console.log('Missing set info for lesson:', lessonId);
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const lesson = setInfo.lessons.find((lesson) => lesson.lessonId === lessonId);
|
|
76
|
+
if (!lesson)
|
|
77
|
+
return;
|
|
78
|
+
let thisSetTranslations;
|
|
79
|
+
let lessonTitle;
|
|
56
80
|
if (languageId === 'ase') {
|
|
57
81
|
const englishEquivalent = sets_1.sets.find((set) => set.name === setInfo.name && !set.comment);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
? {
|
|
62
|
-
...thisSetTranslations,
|
|
63
|
-
lessonTitle: thisSetTranslations?.lessonTitles?.[`${englishEquivalent?.setId}.${lessonNumber}`],
|
|
64
|
-
}
|
|
65
|
-
: undefined;
|
|
82
|
+
thisSetTranslations = t.sets.find((setTranslations) => setTranslations.setId === englishEquivalent?.setId);
|
|
83
|
+
lessonTitle =
|
|
84
|
+
thisSetTranslations?.lessonTitles?.[`${englishEquivalent?.setId}.${lessonNumber}`];
|
|
66
85
|
}
|
|
67
86
|
else {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
? {
|
|
71
|
-
...thisSetTranslations,
|
|
72
|
-
lessonTitle: thisSetTranslations?.lessonTitles?.[lessonId],
|
|
73
|
-
}
|
|
74
|
-
: undefined;
|
|
87
|
+
thisSetTranslations = t.sets.find((setTranslations) => setTranslations.setId === setInfo?.setId);
|
|
88
|
+
lessonTitle = thisSetTranslations?.lessonTitles?.[lessonId];
|
|
75
89
|
}
|
|
76
|
-
}
|
|
77
|
-
/** Assembles all of the audio sections for a lesson. */
|
|
78
|
-
function assembleLessonSections({ languageInfo, setInfo, lesson, t, useSpokenQuestions, }) {
|
|
79
90
|
const fellowshipQuestions = languageInfo.questionSets.find((questionSet) => questionSet.questionSetId === lesson.f)?.questions ?? [];
|
|
80
|
-
const applicationQuestions = languageInfo.questionSets.find((questionSet) => questionSet.questionSetId === lesson.a)?.questions ?? [];
|
|
81
91
|
const fellowshipQuestionsText = fellowshipQuestions.map((questionId) => useSpokenQuestions ? t.questionsSpoken[questionId] : t.questions[questionId]);
|
|
92
|
+
const applicationQuestions = languageInfo.questionSets.find((questionSet) => questionSet.questionSetId === lesson.a)?.questions ?? [];
|
|
82
93
|
const applicationQuestionsText = applicationQuestions.map((questionId) => useSpokenQuestions ? t.questionsSpoken[questionId] : t.questions[questionId]);
|
|
83
94
|
const sections = [
|
|
84
95
|
{
|
|
85
96
|
id: 'title',
|
|
86
97
|
index: 0,
|
|
87
98
|
indexWithinChapter: 0,
|
|
88
|
-
|
|
99
|
+
fileName: '',
|
|
100
|
+
languageId,
|
|
89
101
|
},
|
|
90
102
|
];
|
|
91
103
|
fellowshipQuestions.forEach((questionId, index) => {
|
|
104
|
+
const fileName = `${languageInfo.contentLanguages.questionAudio}.${questionId}.mp3`;
|
|
92
105
|
sections.push({
|
|
93
106
|
id: questionId,
|
|
107
|
+
languageId: languageInfo.contentLanguages.questionAudio,
|
|
94
108
|
index: sections.length,
|
|
95
109
|
header: index === 0 ? t.fellowship : undefined,
|
|
96
110
|
chapter: sets_2.Chapter.FELLOWSHIP,
|
|
97
111
|
indexWithinChapter: index,
|
|
98
112
|
text: fellowshipQuestionsText[index],
|
|
99
|
-
|
|
113
|
+
fileName,
|
|
100
114
|
});
|
|
101
115
|
});
|
|
102
116
|
if (specialIds_1.specialIds.evaluationQuestionLessonIds.includes(lesson.lessonId)) {
|
|
103
117
|
sections.push({
|
|
104
118
|
id: 'eq',
|
|
119
|
+
languageId: languageInfo.contentLanguages.intros,
|
|
105
120
|
index: sections.length,
|
|
106
121
|
chapter: sets_2.Chapter.INTRODUCTION,
|
|
107
122
|
indexWithinChapter: 0,
|
|
108
123
|
pauseBefore: 0,
|
|
109
124
|
text: t.introductions.introductions.eq,
|
|
110
|
-
|
|
125
|
+
fileName: `${languageInfo.contentLanguages.intros}.eq.mp3`,
|
|
111
126
|
});
|
|
112
127
|
}
|
|
113
128
|
else if (specialIds_1.specialIds.growingAsDmcSetIds.includes(setInfo.setId)) {
|
|
129
|
+
const introFileName = [
|
|
130
|
+
languageInfo.contentLanguages.intros,
|
|
131
|
+
lessonId,
|
|
132
|
+
'intro',
|
|
133
|
+
'mp3',
|
|
134
|
+
].join('.');
|
|
114
135
|
sections.push({
|
|
115
136
|
id: 'introduction',
|
|
137
|
+
languageId: languageInfo.contentLanguages.intros,
|
|
116
138
|
index: sections.length,
|
|
117
139
|
chapter: sets_2.Chapter.INTRODUCTION,
|
|
118
140
|
indexWithinChapter: 0,
|
|
119
141
|
pauseBefore: languageInfo.lessonPauses.beforeFtb,
|
|
120
142
|
header: t.introductions.introduction,
|
|
121
|
-
text: t.introductions.introductions[
|
|
122
|
-
|
|
123
|
-
languageInfo.contentLanguages.intros,
|
|
124
|
-
lesson.lessonId,
|
|
125
|
-
'intro',
|
|
126
|
-
'mp3',
|
|
127
|
-
].join('.')),
|
|
143
|
+
text: t.introductions.introductions[lessonId],
|
|
144
|
+
fileName: introFileName,
|
|
128
145
|
});
|
|
129
146
|
}
|
|
130
147
|
let lastBook = null;
|
|
@@ -138,22 +155,29 @@ function assembleLessonSections({ languageInfo, setInfo, lesson, t, useSpokenQue
|
|
|
138
155
|
const ftbRequired = lastBook !== passageInfo.book;
|
|
139
156
|
sections.push({
|
|
140
157
|
id: `${bibleId};${passageId}`,
|
|
158
|
+
languageId,
|
|
141
159
|
index: sections.length,
|
|
142
160
|
chapter: sets_2.Chapter.STORY,
|
|
143
161
|
indexWithinChapter: index,
|
|
144
162
|
pauseBefore: ftbRequired
|
|
145
163
|
? languageInfo.lessonPauses.beforeFtb
|
|
146
164
|
: languageInfo.lessonPauses.betweenPassages,
|
|
147
|
-
|
|
148
|
-
?
|
|
165
|
+
ftbFileName: ftbRequired
|
|
166
|
+
? `${languageInfo.contentLanguages.ftbs}.${passageInfo.book}.mp3`
|
|
149
167
|
: undefined,
|
|
150
|
-
|
|
151
|
-
?
|
|
168
|
+
fileName: bibleStatuses_1.bibleStatuses[bibleId]?.customPassages?.[passageId]
|
|
169
|
+
? passageId + '.mp3'
|
|
152
170
|
: passageInfo.chapterAudioFileName,
|
|
153
171
|
header: (0, scripturePassages_1.getPassagesString)([{ bibleId, passageId }]),
|
|
154
172
|
});
|
|
155
173
|
lastBook = passageInfo.book;
|
|
156
174
|
});
|
|
175
|
+
const passagesString = (0, scripturePassages_1.getPassagesString)(sections
|
|
176
|
+
.filter((section) => section.chapter === sets_2.Chapter.STORY)
|
|
177
|
+
.map((section) => {
|
|
178
|
+
const [bibleId, passageId] = section.id.split(';');
|
|
179
|
+
return { passageId, bibleId };
|
|
180
|
+
}));
|
|
157
181
|
let concatStoryIndex = lesson.s.length;
|
|
158
182
|
languageInfo.bibleModifiers?.forEach((modifier) => {
|
|
159
183
|
lesson.s.forEach((passageId) => {
|
|
@@ -167,21 +191,16 @@ function assembleLessonSections({ languageInfo, setInfo, lesson, t, useSpokenQue
|
|
|
167
191
|
const ftbRequired = lastBook !== passageInfo.book;
|
|
168
192
|
sections.push({
|
|
169
193
|
id: `${modifier.bibleId};${passageId}`,
|
|
194
|
+
languageId,
|
|
170
195
|
index: sections.length,
|
|
171
196
|
chapter: sets_2.Chapter.STORY,
|
|
172
197
|
indexWithinChapter: concatStoryIndex,
|
|
173
|
-
|
|
174
|
-
? (0, utils_1.join)('audio_bibles', modifier.bibleId, 'custom_passages', [passageId, 'mp3'].join('.'))
|
|
175
|
-
: passageInfo.chapterAudioFileName,
|
|
198
|
+
fileName: passageInfo.chapterAudioFileName,
|
|
176
199
|
pauseBefore: ftbRequired
|
|
177
200
|
? languageInfo.lessonPauses.beforeFtb
|
|
178
201
|
: languageInfo.lessonPauses.betweenPassages,
|
|
179
|
-
|
|
180
|
-
?
|
|
181
|
-
languageInfo.contentLanguages.ftbs,
|
|
182
|
-
passageInfo.book,
|
|
183
|
-
'mp3',
|
|
184
|
-
].join('.'))
|
|
202
|
+
ftbFileName: ftbRequired
|
|
203
|
+
? `${languageInfo.contentLanguages.ftbs}.${passageInfo.book}.mp3`
|
|
185
204
|
: undefined,
|
|
186
205
|
header: (0, scripturePassages_1.getPassagesString)([{ bibleId: modifier.bibleId, passageId }]),
|
|
187
206
|
});
|
|
@@ -190,8 +209,14 @@ function assembleLessonSections({ languageInfo, setInfo, lesson, t, useSpokenQue
|
|
|
190
209
|
});
|
|
191
210
|
});
|
|
192
211
|
applicationQuestions.forEach((questionId, index) => {
|
|
212
|
+
const fileName = questionId.includes('video')
|
|
213
|
+
? `${languageInfo.contentLanguages.trainingVideos}.${lessonId}.mp4`
|
|
214
|
+
: `${languageInfo.contentLanguages.questionAudio}.${questionId}.mp3`;
|
|
193
215
|
sections.push({
|
|
194
216
|
id: questionId,
|
|
217
|
+
languageId: questionId.includes('video')
|
|
218
|
+
? languageInfo.contentLanguages.trainingVideos
|
|
219
|
+
: languageInfo.contentLanguages.questionAudio,
|
|
195
220
|
index: sections.length,
|
|
196
221
|
chapter: sets_2.Chapter.APPLICATION,
|
|
197
222
|
indexWithinChapter: index,
|
|
@@ -200,177 +225,212 @@ function assembleLessonSections({ languageInfo, setInfo, lesson, t, useSpokenQue
|
|
|
200
225
|
text: questionId.includes('video')
|
|
201
226
|
? t.training_video
|
|
202
227
|
: applicationQuestionsText[index],
|
|
203
|
-
|
|
204
|
-
? (0, utils_1.join)(languageInfo.contentLanguages.trainingVideos, 'course', 'videos_compressed', [
|
|
205
|
-
languageInfo.contentLanguages.trainingVideos,
|
|
206
|
-
lesson.lessonId,
|
|
207
|
-
'mp4',
|
|
208
|
-
].join('.'))
|
|
209
|
-
: (0, utils_1.join)(languageInfo.contentLanguages.questionAudio, 'questions', [
|
|
210
|
-
languageInfo.contentLanguages.questionAudio,
|
|
211
|
-
questionId,
|
|
212
|
-
'mp3',
|
|
213
|
-
].join('.')),
|
|
228
|
+
fileName,
|
|
214
229
|
});
|
|
215
230
|
});
|
|
216
|
-
return {
|
|
217
|
-
sections,
|
|
218
|
-
fellowshipDuration: sections
|
|
219
|
-
.filter((s) => s.chapter === sets_2.Chapter.FELLOWSHIP)
|
|
220
|
-
.reduce((sum, section) => sum +
|
|
221
|
-
(section.pauseBefore ?? 0) +
|
|
222
|
-
((0, utils_1.getCachedDuration)(section.path) ?? 0), 0),
|
|
223
|
-
applicationDuration: sections
|
|
224
|
-
.filter((s) => s.chapter === sets_2.Chapter.APPLICATION)
|
|
225
|
-
.reduce((sum, section) => sum +
|
|
226
|
-
(section.pauseBefore ?? 0) +
|
|
227
|
-
((0, utils_1.getCachedDuration)(section.path) ?? 0), 0),
|
|
228
|
-
};
|
|
229
|
-
}
|
|
230
|
-
function getTrainingVideoPaths({ languageInfo, lessonId, }) {
|
|
231
|
-
const trainingVideosDir = (0, utils_1.join)(languageInfo.contentLanguages.trainingVideos, 'course');
|
|
232
|
-
const trainingVideoPath = (0, utils_1.join)(trainingVideosDir, 'videos_compressed', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp4'].join('.'));
|
|
233
|
-
const trainingVideoNarrationPath = (0, utils_1.join)(trainingVideosDir, 'audio', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp3'].join('.'));
|
|
234
|
-
const trainingVideoOriginalPath = (0, utils_1.join)(trainingVideosDir, 'videos_export', [languageInfo.contentLanguages.trainingVideos, lessonId, 'm4v'].join('.'));
|
|
235
|
-
const trainingVideoNarrationWithMusicPath = (0, utils_1.join)(trainingVideosDir, 'audio_with_music', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp3'].join('.'));
|
|
236
|
-
return {
|
|
237
|
-
trainingVideoPath,
|
|
238
|
-
trainingVideoNarrationPath,
|
|
239
|
-
trainingVideoOriginalPath,
|
|
240
|
-
trainingVideoNarrationWithMusicPath,
|
|
241
|
-
};
|
|
242
|
-
}
|
|
243
|
-
function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions, }) {
|
|
244
|
-
if (!lessonId)
|
|
245
|
-
return;
|
|
246
|
-
else if (lessonId.split('.').length !== 3)
|
|
247
|
-
return;
|
|
248
|
-
const [category, setNumber, lessonNumber] = lessonId.split('.');
|
|
249
|
-
const languageId = languageInfo.languageId;
|
|
250
|
-
setInfo =
|
|
251
|
-
setInfo ??
|
|
252
|
-
getSetInfo({
|
|
253
|
-
setId: [category, setNumber].join('.'),
|
|
254
|
-
languageId,
|
|
255
|
-
setIds: languageInfo.setIds,
|
|
256
|
-
t,
|
|
257
|
-
});
|
|
258
|
-
if (!setInfo) {
|
|
259
|
-
console.log('Missing set info for lesson:', lessonId);
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
const lesson = setInfo.lessons.find((lesson) => lesson.lessonId === lessonId);
|
|
263
|
-
if (!lesson)
|
|
264
|
-
return;
|
|
265
|
-
const thisSetTranslations = getSetTranslations({
|
|
266
|
-
setInfo,
|
|
267
|
-
lessonId,
|
|
268
|
-
languageId,
|
|
269
|
-
t,
|
|
270
|
-
});
|
|
271
|
-
const { sections, applicationDuration, fellowshipDuration } = assembleLessonSections({
|
|
272
|
-
setInfo,
|
|
273
|
-
lesson,
|
|
274
|
-
languageInfo,
|
|
275
|
-
t,
|
|
276
|
-
useSpokenQuestions,
|
|
277
|
-
});
|
|
278
|
-
const passagesString = (0, scripturePassages_1.getPassagesString)(sections
|
|
279
|
-
.filter((section) => section.chapter === sets_2.Chapter.STORY)
|
|
280
|
-
// Slice out any concat passages.
|
|
281
|
-
.slice(0, lesson.s.length)
|
|
282
|
-
.map((section) => {
|
|
283
|
-
const [bibleId, passageId] = section.id.split(';');
|
|
284
|
-
return { passageId, bibleId };
|
|
285
|
-
}));
|
|
286
231
|
const baseInfo = {
|
|
287
232
|
lessonLink: `https://web.waha.app/lesson?lesson-id=${lessonId}&meet-language=${languageId}`,
|
|
288
233
|
lessonNumber,
|
|
289
|
-
lessonTitle
|
|
234
|
+
lessonTitle,
|
|
290
235
|
sections,
|
|
291
|
-
fellowshipDuration,
|
|
292
|
-
applicationDuration,
|
|
293
236
|
...setInfo,
|
|
294
237
|
...lesson,
|
|
295
238
|
...languageInfo,
|
|
296
239
|
};
|
|
240
|
+
const fellowshipDuration = sections
|
|
241
|
+
.filter((s) => s.chapter === sets_2.Chapter.FELLOWSHIP)
|
|
242
|
+
.reduce((sum, section) => sum +
|
|
243
|
+
(section.pauseBefore ?? 0) +
|
|
244
|
+
(mediaDurations_1.mediaDurations[languageInfo.contentLanguages.questionAudio]?.[section.fileName] ?? 0), 0);
|
|
245
|
+
let applicationDuration = sections
|
|
246
|
+
.filter((s) => s.chapter === sets_2.Chapter.APPLICATION)
|
|
247
|
+
.reduce((sum, section) => sum +
|
|
248
|
+
(section.pauseBefore ?? 0) +
|
|
249
|
+
(mediaDurations_1.mediaDurations[languageInfo.contentLanguages.questionAudio]?.[section.fileName] ?? 0), 0);
|
|
297
250
|
if (specialIds_1.specialIds.evaluationQuestionLessonIds.includes(lesson.lessonId)) {
|
|
251
|
+
const eqId = `${languageInfo.contentLanguages.intros}.eq`;
|
|
252
|
+
const eqFileName = `${eqId}.mp3`;
|
|
253
|
+
const eqPath = (0, utils_1.join)(languageInfo.contentLanguages.intros, 'introductions', eqFileName);
|
|
298
254
|
return {
|
|
299
255
|
type: 'eq',
|
|
300
256
|
...baseInfo,
|
|
301
|
-
|
|
257
|
+
fellowshipDuration,
|
|
258
|
+
applicationDuration,
|
|
259
|
+
eq: {
|
|
260
|
+
id: eqId,
|
|
261
|
+
localFileName: eqFileName,
|
|
262
|
+
remoteFileName: eqFileName,
|
|
263
|
+
path: eqPath,
|
|
264
|
+
url: (0, utils_1.firebasePath)(eqPath),
|
|
265
|
+
},
|
|
302
266
|
};
|
|
303
267
|
}
|
|
304
|
-
if (setInfo.setId === specialIds_1.specialIds.dmCourseSetId ||
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
268
|
+
else if (setInfo.setId === specialIds_1.specialIds.dmCourseSetId ||
|
|
269
|
+
languageId === 'ase') {
|
|
270
|
+
let video;
|
|
271
|
+
let trainingVideo;
|
|
272
|
+
if (languageId === 'ase') {
|
|
273
|
+
const aseVideoLessonId = `${languageId}.${lessonId}`;
|
|
274
|
+
const aseVideoLocalFileName = `${aseVideoLessonId}.mp4`;
|
|
275
|
+
const aseVideoRemoteFileName = `${aseVideoLessonId}.1080.mp4`;
|
|
276
|
+
const aseVideoPath = (0, utils_1.join)(languageId, 'full_lessons', setInfo.setId, aseVideoRemoteFileName);
|
|
277
|
+
video = {
|
|
278
|
+
id: aseVideoLessonId,
|
|
279
|
+
localFileName: aseVideoLocalFileName,
|
|
280
|
+
remoteFileName: aseVideoRemoteFileName,
|
|
281
|
+
path: aseVideoPath,
|
|
282
|
+
url: (0, utils_1.firebasePath)(aseVideoPath),
|
|
283
|
+
};
|
|
284
|
+
trainingVideo = undefined;
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
const videoLessonId = [
|
|
288
|
+
languageId,
|
|
289
|
+
languageInfo.contentLanguages.trainingVideos,
|
|
290
|
+
lessonId,
|
|
291
|
+
].join('.');
|
|
292
|
+
const videoLessonRemoteFileName = `${videoLessonId}.1080.mp4`;
|
|
293
|
+
const videoLessonLocalFileName = `${videoLessonId}.mp4`;
|
|
294
|
+
const videoPath = (0, utils_1.join)(languageId, 'full_lessons', setInfo.setId, videoLessonRemoteFileName);
|
|
295
|
+
video = {
|
|
296
|
+
id: videoLessonId,
|
|
297
|
+
localFileName: videoLessonLocalFileName,
|
|
298
|
+
remoteFileName: videoLessonRemoteFileName,
|
|
299
|
+
path: videoPath,
|
|
300
|
+
url: (0, utils_1.firebasePath)(videoPath),
|
|
301
|
+
};
|
|
302
|
+
const trainingVideoId = [
|
|
303
|
+
languageInfo.contentLanguages.trainingVideos,
|
|
304
|
+
lessonId,
|
|
305
|
+
].join('.');
|
|
306
|
+
const trainingVideoFileName = `${trainingVideoId}.mp4`;
|
|
307
|
+
// Add the length of the training video to the application duration.
|
|
308
|
+
applicationDuration +=
|
|
309
|
+
mediaDurations_1.mediaDurations[languageInfo.contentLanguages.trainingVideos]?.[trainingVideoFileName] ?? 0;
|
|
310
|
+
const trainingVideoPath = (0, utils_1.join)(languageInfo.contentLanguages.trainingVideos, 'course', 'videos_compressed', trainingVideoFileName);
|
|
311
|
+
trainingVideo = {
|
|
312
|
+
id: trainingVideoId,
|
|
313
|
+
localFileName: trainingVideoFileName,
|
|
314
|
+
remoteFileName: trainingVideoFileName,
|
|
315
|
+
path: trainingVideoPath,
|
|
316
|
+
url: (0, utils_1.firebasePath)(trainingVideoPath),
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
let youtubeLink;
|
|
320
|
+
if (video.remoteFileName && video.remoteFileName in youtubeVideos_1.youtubeVideos)
|
|
321
|
+
youtubeLink =
|
|
322
|
+
'https://www.youtube.com/watch?v=' +
|
|
323
|
+
youtubeVideos_1.youtubeVideos[video.remoteFileName];
|
|
328
324
|
return {
|
|
329
325
|
type: 'video',
|
|
330
326
|
...baseInfo,
|
|
331
|
-
|
|
327
|
+
fellowshipDuration,
|
|
328
|
+
applicationDuration,
|
|
332
329
|
lessonSectionHeader: thisSetTranslations?.sectionHeaders?.[lessonId],
|
|
333
330
|
lessonSectionBody: thisSetTranslations?.sectionBodies?.[lessonId],
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
storyPath: lesson.s.length > 0 ? videoStoryAudioPath : undefined,
|
|
331
|
+
video,
|
|
332
|
+
trainingVideo,
|
|
337
333
|
youtubeLink,
|
|
338
334
|
passagesString,
|
|
339
335
|
};
|
|
340
336
|
}
|
|
341
337
|
else {
|
|
342
|
-
const
|
|
343
|
-
const
|
|
338
|
+
const assetVersion = languageInfo.audioAssetVersion ?? '';
|
|
339
|
+
const fullLessonId = `${languageId}.${lessonId}`;
|
|
340
|
+
const fullLessonFileName = `${fullLessonId}.mp3`;
|
|
341
|
+
const fullLessonPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, fullLessonFileName);
|
|
342
|
+
const storyId = fullLessonId + '.story';
|
|
343
|
+
const storyFileName = `${storyId}.mp3`;
|
|
344
|
+
const storyPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, storyFileName);
|
|
344
345
|
return {
|
|
345
346
|
type: 'dbs',
|
|
346
347
|
...baseInfo,
|
|
348
|
+
fellowshipDuration,
|
|
349
|
+
applicationDuration,
|
|
347
350
|
passagesString,
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
+
full: {
|
|
352
|
+
id: fullLessonId,
|
|
353
|
+
localFileName: fullLessonFileName,
|
|
354
|
+
remoteFileName: fullLessonFileName,
|
|
355
|
+
path: fullLessonPath,
|
|
356
|
+
url: (0, utils_1.firebasePath)(fullLessonPath),
|
|
357
|
+
},
|
|
358
|
+
story: {
|
|
359
|
+
id: storyId,
|
|
360
|
+
localFileName: storyFileName,
|
|
361
|
+
remoteFileName: storyFileName,
|
|
362
|
+
path: storyPath,
|
|
363
|
+
url: (0, utils_1.firebasePath)(storyPath),
|
|
364
|
+
},
|
|
365
|
+
dbsCast: {
|
|
366
|
+
remoteFileName: `${languageId}.${lessonId}.1080.mp4`,
|
|
367
|
+
url: (0, utils_1.firebasePath)((0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, `${languageId}.${lessonId}.1080.mp4`)),
|
|
368
|
+
},
|
|
351
369
|
};
|
|
352
370
|
}
|
|
353
371
|
}
|
|
372
|
+
function convertSToString(time) {
|
|
373
|
+
let secondsNumber;
|
|
374
|
+
let minutesNumber;
|
|
375
|
+
let hoursNumber;
|
|
376
|
+
let secondsString;
|
|
377
|
+
let minutesString;
|
|
378
|
+
let hoursString;
|
|
379
|
+
if (time > 0) {
|
|
380
|
+
// If the time is greater than an hour, we need to show the hour of the time as well.
|
|
381
|
+
if (time >= 3600) {
|
|
382
|
+
secondsNumber = Math.floor(time % 60);
|
|
383
|
+
minutesNumber = Math.floor((time / 60) % 60);
|
|
384
|
+
hoursNumber = Math.floor((time / (60 * 60)) % 60);
|
|
385
|
+
secondsString = secondsNumber.toString();
|
|
386
|
+
minutesString =
|
|
387
|
+
minutesNumber < 10
|
|
388
|
+
? '0' + minutesNumber.toString()
|
|
389
|
+
: minutesNumber.toString();
|
|
390
|
+
hoursString =
|
|
391
|
+
hoursNumber < 10 ? '0' + hoursNumber.toString() : hoursNumber.toString();
|
|
392
|
+
return `${hoursString}:${minutesString}:${secondsString}`;
|
|
393
|
+
}
|
|
394
|
+
else {
|
|
395
|
+
secondsNumber = Math.floor(time % 60);
|
|
396
|
+
minutesNumber = Math.floor((time / 60) % 60);
|
|
397
|
+
minutesString =
|
|
398
|
+
minutesNumber < 10
|
|
399
|
+
? '0' + minutesNumber.toString()
|
|
400
|
+
: minutesNumber.toString();
|
|
401
|
+
secondsString =
|
|
402
|
+
secondsNumber < 10
|
|
403
|
+
? '0' + secondsNumber.toString()
|
|
404
|
+
: secondsNumber.toString();
|
|
405
|
+
return `${minutesString}:${secondsString}`;
|
|
406
|
+
}
|
|
407
|
+
} // If the time is greater than the max allowed, just show the max.
|
|
408
|
+
else {
|
|
409
|
+
return '00:00';
|
|
410
|
+
}
|
|
411
|
+
}
|
|
354
412
|
/** Determines whether a lesson should be visible in Waha. */
|
|
355
|
-
function shouldShowLesson(lessonInfo) {
|
|
413
|
+
function shouldShowLesson(lessonInfo, languageInfo) {
|
|
356
414
|
if (lessonInfo?.lessonTitle === undefined || lessonInfo.lessonTitle === '') {
|
|
357
415
|
console.log('Missing lesson info or lessonTitle lesson:', lessonInfo?.lessonId);
|
|
358
416
|
return false;
|
|
359
417
|
}
|
|
360
418
|
else if (lessonInfo.type === 'eq' &&
|
|
361
|
-
|
|
419
|
+
mediaDurations_1.mediaDurations[languageInfo.contentLanguages.intros]?.[lessonInfo.eq.remoteFileName] === undefined) {
|
|
362
420
|
console.log('Missing remote eq file for lesson:', lessonInfo.lessonId);
|
|
363
421
|
return false;
|
|
364
422
|
}
|
|
365
423
|
else if (lessonInfo.type === 'dbs' &&
|
|
366
|
-
|
|
424
|
+
mediaDurations_1.mediaDurations[lessonInfo.languageId]?.[lessonInfo.full.remoteFileName] ===
|
|
425
|
+
undefined) {
|
|
367
426
|
console.log('Missing remote dbs file for lesson:', lessonInfo.lessonId);
|
|
368
427
|
return false;
|
|
369
428
|
}
|
|
370
429
|
else if (lessonInfo.type === 'video' &&
|
|
371
|
-
lessonInfo.
|
|
372
|
-
|
|
373
|
-
|
|
430
|
+
lessonInfo.video &&
|
|
431
|
+
mediaDurations_1.mediaDurations[lessonInfo.languageId]?.[lessonInfo.video.remoteFileName] ===
|
|
432
|
+
undefined) {
|
|
433
|
+
console.log('Missing remote video for lesson:', lessonInfo.video.remoteFileName);
|
|
374
434
|
return false;
|
|
375
435
|
}
|
|
376
436
|
else
|
|
@@ -1,7 +1,2 @@
|
|
|
1
1
|
export declare const join: (...parts: string[]) => string;
|
|
2
|
-
export declare const
|
|
3
|
-
export declare const first: (p: string) => string;
|
|
4
|
-
export declare const dirname: (p: string) => string;
|
|
5
|
-
export declare const extname: (p: string) => string;
|
|
6
|
-
export declare const basenamenoext: (p: string) => string;
|
|
7
|
-
export declare const getCachedDuration: (path: string) => number | undefined;
|
|
2
|
+
export declare const firebasePath: (path: string) => string;
|
package/dist/functions/utils.js
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.firebasePath = exports.join = void 0;
|
|
4
|
+
const firebase_1 = require("../data/firebase");
|
|
5
5
|
const join = (...parts) => parts.join('/').replace(/\/+/g, '/');
|
|
6
6
|
exports.join = join;
|
|
7
|
-
const
|
|
8
|
-
exports.
|
|
9
|
-
const first = (p) => p.split('/')[0];
|
|
10
|
-
exports.first = first;
|
|
11
|
-
const dirname = (p) => p.substring(0, p.lastIndexOf('/'));
|
|
12
|
-
exports.dirname = dirname;
|
|
13
|
-
const extname = (p) => p.slice(p.lastIndexOf('.'));
|
|
14
|
-
exports.extname = extname;
|
|
15
|
-
const basenamenoext = (p) => {
|
|
16
|
-
const base = (0, exports.basename)(p);
|
|
17
|
-
const dotIndex = base.lastIndexOf('.');
|
|
18
|
-
return dotIndex !== -1 ? base.slice(0, dotIndex) : base;
|
|
19
|
-
};
|
|
20
|
-
exports.basenamenoext = basenamenoext;
|
|
21
|
-
const getCachedDuration = (path) => mediaDurations_1.mediaDurations[(0, exports.first)(path)]?.[(0, exports.basename)(path)];
|
|
22
|
-
exports.getCachedDuration = getCachedDuration;
|
|
7
|
+
const firebasePath = (path) => firebase_1.firebaseUrl + encodeURIComponent(path) + `?alt=media`;
|
|
8
|
+
exports.firebasePath = firebasePath;
|
package/dist/types/sets.d.ts
CHANGED
|
@@ -13,6 +13,13 @@ export interface SetInfo extends Set {
|
|
|
13
13
|
setTag?: string;
|
|
14
14
|
setLink: string;
|
|
15
15
|
}
|
|
16
|
+
export interface Content {
|
|
17
|
+
id: string;
|
|
18
|
+
localFileName: string;
|
|
19
|
+
remoteFileName: string;
|
|
20
|
+
path: string;
|
|
21
|
+
url: string;
|
|
22
|
+
}
|
|
16
23
|
export interface BaseInfo extends LanguageInfo {
|
|
17
24
|
lessonNumber: string;
|
|
18
25
|
lessonTitle: string | undefined;
|
|
@@ -25,6 +32,7 @@ export interface BaseInfo extends LanguageInfo {
|
|
|
25
32
|
}
|
|
26
33
|
export interface Section {
|
|
27
34
|
id: string;
|
|
35
|
+
languageId: string;
|
|
28
36
|
header?: string;
|
|
29
37
|
text?: string;
|
|
30
38
|
index: number;
|
|
@@ -36,8 +44,8 @@ export interface Section {
|
|
|
36
44
|
* Filename for the "From the Book" clip to insert before this section, if
|
|
37
45
|
* there is one.
|
|
38
46
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
47
|
+
ftbFileName?: string;
|
|
48
|
+
fileName: string;
|
|
41
49
|
}
|
|
42
50
|
export interface EnrichedSection extends Section {
|
|
43
51
|
startTime: number;
|
|
@@ -52,29 +60,18 @@ export interface EnrichedSection extends Section {
|
|
|
52
60
|
}
|
|
53
61
|
export interface DbsInfo extends BaseInfo, SetInfo, Lesson {
|
|
54
62
|
type: 'dbs';
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
63
|
+
full: Content;
|
|
64
|
+
story: Content;
|
|
65
|
+
dbsCast: {
|
|
66
|
+
remoteFileName: string;
|
|
67
|
+
url: string;
|
|
68
|
+
};
|
|
58
69
|
passagesString: string;
|
|
59
70
|
}
|
|
60
71
|
export interface VideoInfo extends BaseInfo, SetInfo, Lesson {
|
|
61
72
|
type: 'video';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
trainingVideoNarrationPath: string | undefined;
|
|
65
|
-
trainingVideoNarrationWithMusicPath: string | undefined;
|
|
66
|
-
trainingVideoOriginalPath: string | undefined;
|
|
67
|
-
/**
|
|
68
|
-
* Full audio file (training-video audio + scripture + questions). Populated
|
|
69
|
-
* only for video lessons that have audio to play (e.g. dmCourse lessons with
|
|
70
|
-
* scripture passages). Video-only lessons leave this undefined.
|
|
71
|
-
*/
|
|
72
|
-
fullPath?: string;
|
|
73
|
-
/**
|
|
74
|
-
* Story audio file (scripture passages only). Same population rules as
|
|
75
|
-
* `full`.
|
|
76
|
-
*/
|
|
77
|
-
storyPath?: string;
|
|
73
|
+
video: Content;
|
|
74
|
+
trainingVideo: Content | undefined;
|
|
78
75
|
lessonSectionHeader: string | undefined;
|
|
79
76
|
lessonSectionBody: string | undefined;
|
|
80
77
|
youtubeLink: string | undefined;
|
|
@@ -82,7 +79,7 @@ export interface VideoInfo extends BaseInfo, SetInfo, Lesson {
|
|
|
82
79
|
}
|
|
83
80
|
export interface EqInfo extends BaseInfo, SetInfo, Lesson {
|
|
84
81
|
type: 'eq';
|
|
85
|
-
|
|
82
|
+
eq: Content;
|
|
86
83
|
}
|
|
87
84
|
export type LessonInfo = DbsInfo | VideoInfo | EqInfo;
|
|
88
85
|
export declare enum Chapter {
|