Fix SponsorBlock zero videoDuration bug (#23)
This commit is contained in:
1 parent
e716b7f80b
commit
08dd620380
2 files changed
+13
-1
No files matched your search
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user