diff --git a/src/routes/getBranding.ts b/src/routes/getBranding.ts index 29bf56d..8d23904 100644 --- a/src/routes/getBranding.ts +++ b/src/routes/getBranding.ts @@ -189,7 +189,8 @@ async function filterAndSortBranding(videoID: VideoID, dbTitles: TitleDBResult[] return { titles, thumbnails, - randomTime: findRandomTime(videoID, dbSegments) + randomTime: findRandomTime(videoID, dbSegments), + videoDuration: dbSegments[0]?.videoDuration ?? null }; } diff --git a/src/types/branding.model.ts b/src/types/branding.model.ts index 8c49f5a..e6bd8c0 100644 --- a/src/types/branding.model.ts +++ b/src/types/branding.model.ts @@ -46,7 +46,8 @@ export interface ThumbnailResult { export interface BrandingResult { titles: TitleResult[], thumbnails: ThumbnailResult[], - randomTime: number + randomTime: number, + videoDuration: number | null } export interface BrandingHashDBResult { diff --git a/test/cases/getBranding.ts b/test/cases/getBranding.ts index 9883130..e7e075a 100644 --- a/test/cases/getBranding.ts +++ b/test/cases/getBranding.ts @@ -239,6 +239,8 @@ describe("getBranding", () => { const timeAbsolute = randomTime * videoDuration; assert.ok(timeAbsolute < 1 || (timeAbsolute > 11 && timeAbsolute < 20) || timeAbsolute > 33); + + assert.strictEqual(result1.data.videoDuration, 100); }); async function checkVideo(videoID: string, videoIDHash: string, expected: {