Fix SponsorBlock zero videoDuration bug (#23)

This commit is contained in:
Brahim Hadriche authored and GitHub committed 2022-12-03 19:43:53 -05:00
1 parent e716b7f80b
commit 08dd620380
2 files changed
+13 -1

No files matched your search

+12 -1
View File
@@ -4,9 +4,20 @@ function TaskMain()
input = m.top.getField("input")
videoId = input.videoId
skipSegments = SponsorBlock.GetSkipSegmentsForVideo(videoId)
sponsorBlockResponse = SponsorBlock.GetSkipSegmentsForVideo(videoId)
barPath = invalid
skipSegments = []
for each segment in sponsorBlockResponse
if segment.videoDuration > 0
skipSegments.push(segment)
end if
end for
if skipSegments.Count() = 0
skipSegments = invalid
end if
if skipSegments <> invalid
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)