Changed interval check

This commit is contained in:
Andrew Lee
2020-04-25 17:38:21 -04:00
parent b101831a1b
commit 1026f65280

View File

@@ -114,19 +114,16 @@ async function autoModerateSubmission(submission, callback) {
let overlap = false; let overlap = false;
http = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID); http = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID);
if (http.status === 500) return false; if (http.status === 500) return false;
nb_predictions = await http.json();
nb_predictions = await http.json();
for (const nb_seg of nb_predictions.sponsorSegments){ for (const nb_seg of nb_predictions.sponsorSegments){
let head = 0; // The submission needs to be a subset of the widened NB prediction
let tail = 0; // and at least 65% of NB's prediction.
// If there's an overlap, find the percentage of overlap. if (nb_seg[0]-2 <= submission.startTime && submission.endTime <= nb_seg[1]+2){
if (submission.startTime <= nb_seg[1] && nb_seg[0] <= submission.endTime){ if ((submission.endTime - submission.startTime)/(nb_seg[1]-nb_seg[0] >= 0.65)){
head = Math.max(submission.startTime, nb_seg[0]); overlap=true;
tail = Math.min(submission.endTime, nb_seg[1]); break;
} }
if ((tail-head)/(nb_seg[1]-nb_seg[0]) >= 0.65){
overlap = true;
break;
} }
} }
if (overlap){ if (overlap){