mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-31 11:56:27 +03:00
Renamed variables and added spacing.
This commit is contained in:
@@ -108,29 +108,30 @@ async function autoModerateSubmission(submission, callback) {
|
|||||||
duration = isoDurations.toSeconds(isoDurations.parse(duration));
|
duration = isoDurations.toSeconds(isoDurations.parse(duration));
|
||||||
|
|
||||||
// Reject submission if over 80% of the video
|
// Reject submission if over 80% of the video
|
||||||
if ((submission.endTime - submission.startTime) > (duration/100)*80) {
|
if ((submission.endTime - submission.startTime) > (duration/100) * 80) {
|
||||||
return "Sponsor segment is over 80% of the video.";
|
return "Sponsor segment is over 80% of the video.";
|
||||||
} else {
|
} else {
|
||||||
let overlap = false;
|
let overlap = false;
|
||||||
let response = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID);
|
|
||||||
if (!response.ok) return false;
|
|
||||||
|
|
||||||
nb_predictions = await response.json();
|
let response = await fetch("https://ai.neuralblock.app/api/getSponsorSegments?vid=" + submission.videoID);
|
||||||
for (const nb_seg of nb_predictions.sponsorSegments){
|
if (!response.ok) return false;
|
||||||
// The submission needs to be a subset of the widened NB prediction
|
|
||||||
// and at least 65% of NB's prediction.
|
let nbPredictions = await response.json();
|
||||||
if (nb_seg[0]-2 <= submission.startTime && submission.endTime <= nb_seg[1]+2){
|
for (const nbSegment of nbPredictions.sponsorSegments) {
|
||||||
if ((submission.endTime - submission.startTime)/(nb_seg[1]-nb_seg[0]) >= 0.65){
|
// The submission needs to be a subset of the widened NB prediction
|
||||||
overlap=true;
|
// and at least 65% of NB's prediction.
|
||||||
break;
|
if (nbSegment[0] - 2 <= submission.startTime && submission.endTime <= nbSegment[1] + 2){
|
||||||
}
|
if ((submission.endTime - submission.startTime) / (nbSegment[1]-nbSegment[0]) >= 0.65){
|
||||||
|
overlap = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (overlap) {
|
||||||
|
return false;
|
||||||
|
} else{
|
||||||
|
return "Sponsor segment doesn't have at least 65% match.";
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (overlap){
|
|
||||||
return false;
|
|
||||||
} else{
|
|
||||||
return "Sponsor segment doesn't have at least 65% match.";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user