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