* Fix SponsorBlock segments where video duration is not provided * add another null check
22 lines
585 B
Plaintext
22 lines
585 B
Plaintext
import "pkg:/source/services/SponsorBlock.bs"
|
|
|
|
@asynctask
|
|
function SponsorBlockTask(input as object) as object
|
|
videoId = input.videoId
|
|
lengthSeconds = input.metadata.lengthSeconds
|
|
|
|
skipSegments = SponsorBlock.GetSkipSegmentsForVideo(videoId)
|
|
barPath = invalid
|
|
|
|
if skipSegments <> invalid
|
|
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
|
|
SponsorBlock.GenerateProgressBarBackground(skipSegments, lengthSeconds, barPath)
|
|
end if
|
|
|
|
return {
|
|
videoId: videoId,
|
|
skipSegments: skipSegments,
|
|
barPath: barPath
|
|
}
|
|
end function
|