mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Send video duration if known
This commit is contained in:
parent
0932f63398
commit
ef3e48ec24
3 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ export interface ThumbnailResult {
|
|||
export interface BrandingResult {
|
||||
titles: TitleResult[],
|
||||
thumbnails: ThumbnailResult[],
|
||||
randomTime: number
|
||||
randomTime: number,
|
||||
videoDuration: number | null
|
||||
}
|
||||
|
||||
export interface BrandingHashDBResult {
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue