Files
playlet-piped/src/components/VideoPlayer/SponsorBlockTask.bs
T
Brahim Hadriche 68a8d61eb0 Refactor and fix player (#19)
* Refactor and fix player

* Rename functions, fix video loading indicator

* Hide loading indicator on exit
2022-12-02 10:46:48 -05:00

21 lines
532 B
Plaintext

import "pkg:/source/services/SponsorBlock.bs"
function TaskMain()
input = m.top.getField("input")
videoId = input.videoId
skipSegments = SponsorBlock.GetSkipSegmentsForVideo(videoId)
barPath = invalid
if skipSegments <> invalid
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)
end if
m.top.setField("output", {
videoId: videoId,
skipSegments: skipSegments,
barPath: barPath
})
end function