mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-23 07:58:22 +03:00
Merge branch 'testing' of https://github.com/ajayyy/SponsorBlockServer into nb-mod-fetch
# Conflicts: # src/routes/postSkipSegments.js # test/cases/postSkipSegments.js
This commit is contained in:
@@ -102,13 +102,16 @@ async function autoModerateSubmission(submission, callback) {
|
||||
} else {
|
||||
// Check to see if video exists
|
||||
if (data.pageInfo.totalResults === 0) {
|
||||
callback("No video exists with id " + submission.videoID);
|
||||
return "No video exists with id " + submission.videoID;
|
||||
} else {
|
||||
let duration = data.items[0].contentDetails.duration;
|
||||
duration = isoDurations.toSeconds(isoDurations.parse(duration));
|
||||
|
||||
// Reject submission if over 80% of the video
|
||||
if ((submission.endTime - submission.startTime) > (duration/100) * 80) {
|
||||
if (duration == 0) {
|
||||
// Allow submission if the duration is 0 (bug in youtube api)
|
||||
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.";
|
||||
} else {
|
||||
let overlap = false;
|
||||
|
||||
Reference in New Issue
Block a user