waha-shared 1.0.318 → 1.0.319

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.
@@ -12,11 +12,11 @@ exports.enrichSections = enrichSections;
12
12
  exports.normalizeVerseTimings = normalizeVerseTimings;
13
13
  const bibleStatuses_1 = require("../data/bibleStatuses");
14
14
  const firebase_1 = require("../data/firebase");
15
+ const mediaDurations_1 = require("../data/mediaDurations");
15
16
  const languages_1 = require("../functions/languages");
16
17
  const sets_1 = require("../types/sets");
17
18
  const bibleBooks_1 = require("./bibleBooks");
18
19
  const bibles_1 = require("./bibles");
19
- const utils_1 = require("./utils");
20
20
  var bibleBooks_2 = require("./bibleBooks");
21
21
  Object.defineProperty(exports, "parseVerseRange", { enumerable: true, get: function () { return bibleBooks_2.parseVerseRange; } });
22
22
  function getChapterUrl(params) {
@@ -211,11 +211,11 @@ function verseToSuperscript(num) {
211
211
  * section has no FTB.
212
212
  */
213
213
  function getFtbDuration(section, lessonInfo) {
214
- if (!section.ftbPath)
214
+ if (!section.ftbFileName)
215
215
  return 0;
216
- const ftbDuration = (0, utils_1.getCachedDuration)(section.ftbPath);
216
+ const ftbDuration = mediaDurations_1.mediaDurations[lessonInfo.contentLanguages.ftbs]?.[section.ftbFileName];
217
217
  if (ftbDuration == null) {
218
- console.warn(`FTB duration not found for ${(0, utils_1.basename)(section.ftbPath)}`);
218
+ console.warn(`FTB duration not found for ${section.ftbFileName}`);
219
219
  }
220
220
  return (ftbDuration ?? 0) + lessonInfo.lessonPauses.afterFtb;
221
221
  }
@@ -243,7 +243,7 @@ function enrichSections(lessonInfo, scripture) {
243
243
  const ignoreTimings = isStory && priorStoryLengthUnknown ? true : undefined;
244
244
  const startTime = currentTime;
245
245
  if (!isStory) {
246
- length = (0, utils_1.getCachedDuration)(section.path);
246
+ length = mediaDurations_1.mediaDurations[section.languageId]?.[section.fileName];
247
247
  }
248
248
  else {
249
249
  currentTime += getFtbDuration(section, lessonInfo);
@@ -263,7 +263,7 @@ function enrichSections(lessonInfo, scripture) {
263
263
  priorStoryLengthUnknown = true;
264
264
  }
265
265
  if (length == null) {
266
- console.warn(`Missing duration for section ${section.id} (${section.chapter}, ${(0, utils_1.basename)(section.path)})`);
266
+ console.warn(`Missing duration for section ${section.id} (${section.chapter}, ${section.fileName})`);
267
267
  }
268
268
  currentTime += length ?? 0;
269
269
  return { ...section, length: length ?? 0, startTime, ignoreTimings };
@@ -271,9 +271,11 @@ function enrichSections(lessonInfo, scripture) {
271
271
  // Backward pass: compute application section start times from the end of the
272
272
  // lesson file, so they are always correct even if story durations are
273
273
  // slightly off.
274
- const path = lessonInfo.type === 'dbs' ? lessonInfo.fullPath : lessonInfo.videoPath;
275
- const totalDuration = (0, utils_1.getCachedDuration)(path);
276
- if (totalDuration) {
274
+ const fullFileName = lessonInfo.type === 'dbs'
275
+ ? lessonInfo.full.localFileName
276
+ : lessonInfo.video.localFileName;
277
+ const totalDuration = mediaDurations_1.mediaDurations[lessonInfo.languageId]?.[fullFileName] ?? 0;
278
+ if (totalDuration > 0) {
277
279
  let timeFromEnd = totalDuration;
278
280
  const applicationSections = enriched.filter((s) => s.chapter === sets_1.Chapter.APPLICATION);
279
281
  for (const section of [...applicationSections].reverse()) {
@@ -16,7 +16,7 @@ export declare function getLessonInfo({ lessonId, languageInfo, setInfo, t, useS
16
16
  }): LessonInfo | undefined;
17
17
  export declare function convertSToString(time: number): string;
18
18
  /** Determines whether a lesson should be visible in Waha. */
19
- export declare function shouldShowLesson(lessonInfo: LessonInfo | undefined): boolean;
19
+ export declare function shouldShowLesson(lessonInfo: LessonInfo | undefined, languageInfo: LanguageInfo): boolean;
20
20
  /**
21
21
  * Validates that the computed lesson duration (from section lengths) matches
22
22
  * the actual audio file duration. Sections must be enriched (all have `length`)
@@ -6,6 +6,7 @@ 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");
@@ -95,41 +96,52 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
95
96
  id: 'title',
96
97
  index: 0,
97
98
  indexWithinChapter: 0,
98
- path: '',
99
+ fileName: '',
100
+ languageId,
99
101
  },
100
102
  ];
101
103
  fellowshipQuestions.forEach((questionId, index) => {
104
+ const fileName = `${languageInfo.contentLanguages.questionAudio}.${questionId}.mp3`;
102
105
  sections.push({
103
106
  id: questionId,
107
+ languageId: languageInfo.contentLanguages.questionAudio,
104
108
  index: sections.length,
105
109
  header: index === 0 ? t.fellowship : undefined,
106
110
  chapter: sets_2.Chapter.FELLOWSHIP,
107
111
  indexWithinChapter: index,
108
112
  text: fellowshipQuestionsText[index],
109
- path: (0, utils_1.join)(languageInfo.contentLanguages.questionAudio, 'questions', [languageInfo.contentLanguages.questionAudio, questionId, 'mp3'].join('.')),
113
+ fileName,
110
114
  });
111
115
  });
112
116
  if (specialIds_1.specialIds.evaluationQuestionLessonIds.includes(lesson.lessonId)) {
113
117
  sections.push({
114
118
  id: 'eq',
119
+ languageId: languageInfo.contentLanguages.intros,
115
120
  index: sections.length,
116
121
  chapter: sets_2.Chapter.INTRODUCTION,
117
122
  indexWithinChapter: 0,
118
123
  pauseBefore: 0,
119
124
  text: t.introductions.introductions.eq,
120
- path: (0, utils_1.join)(languageInfo.contentLanguages.intros, [languageInfo.contentLanguages.intros, 'eq', 'mp3'].join('.')),
125
+ fileName: `${languageInfo.contentLanguages.intros}.eq.mp3`,
121
126
  });
122
127
  }
123
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('.');
124
135
  sections.push({
125
136
  id: 'introduction',
137
+ languageId: languageInfo.contentLanguages.intros,
126
138
  index: sections.length,
127
139
  chapter: sets_2.Chapter.INTRODUCTION,
128
140
  indexWithinChapter: 0,
129
141
  pauseBefore: languageInfo.lessonPauses.beforeFtb,
130
142
  header: t.introductions.introduction,
131
143
  text: t.introductions.introductions[lessonId],
132
- path: (0, utils_1.join)(languageInfo.contentLanguages.intros, [languageInfo.contentLanguages.intros, lessonId, 'intro', 'mp3'].join('.')),
144
+ fileName: introFileName,
133
145
  });
134
146
  }
135
147
  let lastBook = null;
@@ -143,17 +155,18 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
143
155
  const ftbRequired = lastBook !== passageInfo.book;
144
156
  sections.push({
145
157
  id: `${bibleId};${passageId}`,
158
+ languageId,
146
159
  index: sections.length,
147
160
  chapter: sets_2.Chapter.STORY,
148
161
  indexWithinChapter: index,
149
162
  pauseBefore: ftbRequired
150
163
  ? languageInfo.lessonPauses.beforeFtb
151
164
  : languageInfo.lessonPauses.betweenPassages,
152
- ftbPath: ftbRequired
153
- ? (0, utils_1.join)(languageInfo.contentLanguages.ftbs, 'ftb', [languageInfo.contentLanguages.ftbs, passageInfo.book, 'mp3'].join('.'))
165
+ ftbFileName: ftbRequired
166
+ ? `${languageInfo.contentLanguages.ftbs}.${passageInfo.book}.mp3`
154
167
  : undefined,
155
- path: bibleStatuses_1.bibleStatuses[bibleId]?.customPassages?.[passageId]
156
- ? (0, utils_1.join)('audio_bibles', bibleId, 'custom_passages', [passageId, 'mp3'].join('.'))
168
+ fileName: bibleStatuses_1.bibleStatuses[bibleId]?.customPassages?.[passageId]
169
+ ? passageId + '.mp3'
157
170
  : passageInfo.chapterAudioFileName,
158
171
  header: (0, scripturePassages_1.getPassagesString)([{ bibleId, passageId }]),
159
172
  });
@@ -178,21 +191,16 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
178
191
  const ftbRequired = lastBook !== passageInfo.book;
179
192
  sections.push({
180
193
  id: `${modifier.bibleId};${passageId}`,
194
+ languageId,
181
195
  index: sections.length,
182
196
  chapter: sets_2.Chapter.STORY,
183
197
  indexWithinChapter: concatStoryIndex,
184
- path: bibleStatuses_1.bibleStatuses[modifier.bibleId]?.customPassages?.[passageId]
185
- ? (0, utils_1.join)('audio_bibles', modifier.bibleId, 'custom_passages', [passageId, 'mp3'].join('.'))
186
- : passageInfo.chapterAudioFileName,
198
+ fileName: passageInfo.chapterAudioFileName,
187
199
  pauseBefore: ftbRequired
188
200
  ? languageInfo.lessonPauses.beforeFtb
189
201
  : languageInfo.lessonPauses.betweenPassages,
190
- ftbPath: ftbRequired
191
- ? (0, utils_1.join)(languageInfo.contentLanguages.ftbs, 'ftb', [
192
- languageInfo.contentLanguages.ftbs,
193
- passageInfo.book,
194
- 'mp3',
195
- ].join('.'))
202
+ ftbFileName: ftbRequired
203
+ ? `${languageInfo.contentLanguages.ftbs}.${passageInfo.book}.mp3`
196
204
  : undefined,
197
205
  header: (0, scripturePassages_1.getPassagesString)([{ bibleId: modifier.bibleId, passageId }]),
198
206
  });
@@ -201,8 +209,14 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
201
209
  });
202
210
  });
203
211
  applicationQuestions.forEach((questionId, index) => {
212
+ const fileName = questionId.includes('video')
213
+ ? `${languageInfo.contentLanguages.trainingVideos}.${lessonId}.mp4`
214
+ : `${languageInfo.contentLanguages.questionAudio}.${questionId}.mp3`;
204
215
  sections.push({
205
216
  id: questionId,
217
+ languageId: questionId.includes('video')
218
+ ? languageInfo.contentLanguages.trainingVideos
219
+ : languageInfo.contentLanguages.questionAudio,
206
220
  index: sections.length,
207
221
  chapter: sets_2.Chapter.APPLICATION,
208
222
  indexWithinChapter: index,
@@ -211,17 +225,7 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
211
225
  text: questionId.includes('video')
212
226
  ? t.training_video
213
227
  : applicationQuestionsText[index],
214
- path: questionId.includes('video')
215
- ? (0, utils_1.join)(languageInfo.contentLanguages.trainingVideos, 'course', 'videos_compressed', [
216
- languageInfo.contentLanguages.trainingVideos,
217
- lessonId,
218
- 'mp4',
219
- ].join('.'))
220
- : (0, utils_1.join)(languageInfo.contentLanguages.questionAudio, 'questions', [
221
- languageInfo.contentLanguages.questionAudio,
222
- questionId,
223
- 'mp3',
224
- ].join('.')),
228
+ fileName,
225
229
  });
226
230
  });
227
231
  const baseInfo = {
@@ -237,62 +241,86 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
237
241
  .filter((s) => s.chapter === sets_2.Chapter.FELLOWSHIP)
238
242
  .reduce((sum, section) => sum +
239
243
  (section.pauseBefore ?? 0) +
240
- ((0, utils_1.getCachedDuration)(section.path) ?? 0), 0);
244
+ (mediaDurations_1.mediaDurations[languageInfo.contentLanguages.questionAudio]?.[section.fileName] ?? 0), 0);
241
245
  let applicationDuration = sections
242
246
  .filter((s) => s.chapter === sets_2.Chapter.APPLICATION)
243
247
  .reduce((sum, section) => sum +
244
248
  (section.pauseBefore ?? 0) +
245
- ((0, utils_1.getCachedDuration)(section.path) ?? 0), 0);
249
+ (mediaDurations_1.mediaDurations[languageInfo.contentLanguages.questionAudio]?.[section.fileName] ?? 0), 0);
246
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);
247
254
  return {
248
255
  type: 'eq',
249
256
  ...baseInfo,
250
257
  fellowshipDuration,
251
258
  applicationDuration,
252
- eqPath: (0, utils_1.join)(languageInfo.contentLanguages.intros, 'introductions', `${languageInfo.contentLanguages.intros}.eq.mp3`),
259
+ eq: {
260
+ id: eqId,
261
+ localFileName: eqFileName,
262
+ remoteFileName: eqFileName,
263
+ path: eqPath,
264
+ url: (0, utils_1.firebasePath)(eqPath),
265
+ },
253
266
  };
254
267
  }
255
- const assetVersion = languageInfo.audioAssetVersion ?? '';
256
- if (setInfo.setId === specialIds_1.specialIds.dmCourseSetId || languageId === 'ase') {
257
- let videoPath;
258
- let trainingVideoPath;
259
- let trainingVideoNarrationPath;
260
- let trainingVideoOriginalPath;
261
- let trainingVideoNarrationWithMusicPath;
262
- let youtubeLink;
268
+ else if (setInfo.setId === specialIds_1.specialIds.dmCourseSetId ||
269
+ languageId === 'ase') {
270
+ let video;
271
+ let trainingVideo;
263
272
  if (languageId === 'ase') {
264
- videoPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, [languageId, lessonId, '1080', 'mp4'].join('.'));
265
- trainingVideoPath = undefined;
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;
266
285
  }
267
286
  else {
268
- videoPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, [
287
+ const videoLessonId = [
269
288
  languageId,
270
289
  languageInfo.contentLanguages.trainingVideos,
271
290
  lessonId,
272
- '1080',
273
- 'mp4',
274
- ].join('.'));
275
- const trainingVideosDir = (0, utils_1.join)(languageInfo.contentLanguages.trainingVideos, 'course');
276
- trainingVideoPath = (0, utils_1.join)(trainingVideosDir, 'videos_compressed', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp4'].join('.'));
277
- trainingVideoNarrationPath = (0, utils_1.join)(trainingVideosDir, 'audio', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp3'].join('.'));
278
- trainingVideoOriginalPath = (0, utils_1.join)(trainingVideosDir, 'videos_export', [languageInfo.contentLanguages.trainingVideos, lessonId, 'm4v'].join('.'));
279
- trainingVideoNarrationWithMusicPath = (0, utils_1.join)(trainingVideosDir, 'audio_with_music', [languageInfo.contentLanguages.trainingVideos, lessonId, 'mp3'].join('.'));
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`;
280
307
  // Add the length of the training video to the application duration.
281
- applicationDuration += (0, utils_1.getCachedDuration)(trainingVideoPath) ?? 0;
282
- if (videoPath && (0, utils_1.basename)(videoPath) in youtubeVideos_1.youtubeVideos)
283
- youtubeLink =
284
- 'https://www.youtube.com/watch?v=' +
285
- youtubeVideos_1.youtubeVideos[(0, utils_1.basename)(videoPath)];
286
- if (specialIds_1.specialIds.dmCourseVideoOnlyLessonIds.includes(lessonId))
287
- videoPath = trainingVideoPath;
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
+ };
288
318
  }
289
- const fullPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, [
290
- languageId,
291
- languageInfo.contentLanguages.trainingVideos,
292
- lessonId,
293
- 'mp3',
294
- ].join('.'));
295
- const storyPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, [languageId, lessonId, 'story', 'mp3'].join('.'));
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];
296
324
  return {
297
325
  type: 'video',
298
326
  ...baseInfo,
@@ -300,29 +328,44 @@ function getLessonInfo({ lessonId, languageInfo, setInfo, t, useSpokenQuestions,
300
328
  applicationDuration,
301
329
  lessonSectionHeader: thisSetTranslations?.sectionHeaders?.[lessonId],
302
330
  lessonSectionBody: thisSetTranslations?.sectionBodies?.[lessonId],
303
- videoPath,
304
- trainingVideoPath,
305
- trainingVideoNarrationPath,
306
- trainingVideoOriginalPath,
307
- trainingVideoNarrationWithMusicPath,
308
- fullPath: lesson.s.length > 0 ? fullPath : undefined,
309
- storyPath: lesson.s.length > 0 ? storyPath : undefined,
331
+ video,
332
+ trainingVideo,
310
333
  youtubeLink,
311
334
  passagesString,
312
335
  };
313
336
  }
314
337
  else {
315
- const fullPath = (0, utils_1.join)(languageId, `full_lessons${assetVersion}`, setInfo.setId, `${languageId}.${lessonId}.mp3`);
316
- const storyPath = fullPath.replace('.mp3', '.story.mp3');
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);
317
345
  return {
318
346
  type: 'dbs',
319
347
  ...baseInfo,
320
348
  fellowshipDuration,
321
349
  applicationDuration,
322
350
  passagesString,
323
- fullPath,
324
- storyPath,
325
- dbsCastPath: (0, utils_1.join)(languageId, `full_lessons`, setInfo.setId, [languageId, lessonId, '1080', 'mp4'].join('.')),
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
+ },
326
369
  };
327
370
  }
328
371
  }
@@ -367,25 +410,27 @@ function convertSToString(time) {
367
410
  }
368
411
  }
369
412
  /** Determines whether a lesson should be visible in Waha. */
370
- function shouldShowLesson(lessonInfo) {
413
+ function shouldShowLesson(lessonInfo, languageInfo) {
371
414
  if (lessonInfo?.lessonTitle === undefined || lessonInfo.lessonTitle === '') {
372
415
  console.log('Missing lesson info or lessonTitle lesson:', lessonInfo?.lessonId);
373
416
  return false;
374
417
  }
375
418
  else if (lessonInfo.type === 'eq' &&
376
- (0, utils_1.getCachedDuration)(lessonInfo.eqPath) === undefined) {
419
+ mediaDurations_1.mediaDurations[languageInfo.contentLanguages.intros]?.[lessonInfo.eq.remoteFileName] === undefined) {
377
420
  console.log('Missing remote eq file for lesson:', lessonInfo.lessonId);
378
421
  return false;
379
422
  }
380
423
  else if (lessonInfo.type === 'dbs' &&
381
- (0, utils_1.getCachedDuration)(lessonInfo.fullPath) === undefined) {
424
+ mediaDurations_1.mediaDurations[lessonInfo.languageId]?.[lessonInfo.full.remoteFileName] ===
425
+ undefined) {
382
426
  console.log('Missing remote dbs file for lesson:', lessonInfo.lessonId);
383
427
  return false;
384
428
  }
385
429
  else if (lessonInfo.type === 'video' &&
386
- lessonInfo.videoPath &&
387
- (0, utils_1.getCachedDuration)(lessonInfo.videoPath) === undefined) {
388
- console.log('Missing remote video for lesson:', lessonInfo.lessonId);
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);
389
434
  return false;
390
435
  }
391
436
  else
@@ -1,7 +1,2 @@
1
1
  export declare const join: (...parts: string[]) => string;
2
- export declare const basename: (p: string) => string;
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;
@@ -1,22 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCachedDuration = exports.basenamenoext = exports.extname = exports.dirname = exports.first = exports.basename = exports.join = void 0;
4
- const mediaDurations_1 = require("../data/mediaDurations");
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 basename = (p) => p.split('/').pop();
8
- exports.basename = basename;
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;
@@ -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
- ftbPath?: string;
40
- path: string;
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
- fullPath: string;
56
- storyPath: string;
57
- dbsCastPath: string;
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
- videoPath: string;
63
- trainingVideoPath: string | undefined;
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
- eqPath: string;
82
+ eq: Content;
86
83
  }
87
84
  export type LessonInfo = DbsInfo | VideoInfo | EqInfo;
88
85
  export declare enum Chapter {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waha-shared",
3
- "version": "1.0.318",
3
+ "version": "1.0.319",
4
4
  "author": "Waha",
5
5
  "dependencies": {
6
6
  "@types/signale": "^1.4.7",
@@ -1 +0,0 @@
1
- export declare const languageAssets: Record<string, string[]>;
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.languageAssets = void 0;
4
- // This file is auto-generated by scripts/prep. Do not edit manually.
5
- const languageAssets_zod_1 = require("./languageAssets.zod");
6
- const data = require('./languageAssets.json');
7
- exports.languageAssets = languageAssets_zod_1.LanguageAssets.parse(data.data);