Files
playlet-piped/playlet-lib/src/components/VideoPlayer/SponsorBlockTask.bs
T
Brahim Hadriche a224b86fca Fix SponsorBlock segments where video duration is not provided (#102)
* Fix SponsorBlock segments where video duration is not provided

* add another null check
2023-07-04 15:21:19 -04:00

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