allow submissions when duration is parsed as 0

This commit is contained in:
Joe-Dowd
2020-04-24 18:11:09 +01:00
parent c60d7ed75e
commit 6cd672f9e6

View File

@@ -105,9 +105,11 @@ async function autoModerateSubmission(submission, callback) {
} else { } else {
let duration = data.items[0].contentDetails.duration; let duration = data.items[0].contentDetails.duration;
duration = isoDurations.toSeconds(isoDurations.parse(duration)); duration = isoDurations.toSeconds(isoDurations.parse(duration));
if (duration === 0) {
// Reject submission if over 80% of the video // Allow submission if the duration is 0 (bug in youtube api)
if ((submission.endTime - submission.startTime) > (duration/100)*80) { return false;
} else if ((submission.endTime - submission.startTime) > (duration/100)*80) {
// Reject submission if over 80% of the video
return "Sponsor segment is over 80% of the video."; return "Sponsor segment is over 80% of the video.";
} else { } else {
return false; return false;