Fixed tests

This commit is contained in:
Ajay Ramachandran
2021-03-26 19:13:52 -04:00
parent 37a07ace72
commit 5152d7e649
2 changed files with 36 additions and 4 deletions

View File

@@ -424,9 +424,9 @@ export async function postSkipSegments(req: Request, res: Response) {
apiVideoInfo = await getYouTubeVideoInfo(videoID);
}
const apiVideoDuration = getYouTubeVideoDuration(apiVideoInfo);
if (!apiVideoDuration || Math.abs(videoDuration - apiVideoDuration) > 2) {
if (!videoDuration || (apiVideoDuration && Math.abs(videoDuration - apiVideoDuration) > 2)) {
// If api duration is far off, take that one instead (it is only precise to seconds, not millis)
videoDuration = apiVideoDuration;
videoDuration = apiVideoDuration || 0 as VideoDuration;
}
// Auto moderator check