Add SponsorBlock Viewed API (#31)

* Add SponsorBlock Viewed API

* Add task for viewed events

* Changelog
This commit is contained in:
Brahim Hadriche authored and GitHub committed 2023-01-01 13:02:53 -05:00
1 parent 5822207397
commit 493a8f7d17
5 files changed
+35

No files matched your search

+7
View File
@@ -5,6 +5,7 @@ import "pkg:/source/utils/Crypto.bs"
namespace SponsorBlock
const API_URL = "https://sponsor.ajay.app"
const SKIP_SEGMENT_ENDPOINT = "/api/skipSegments"
const VIEWED_SEGMENT_ENDPOINT = "/api/viewedVideoSponsorTime"
function SegmentColor(category as string) as integer
map = m.SponsorBlockColors
@@ -75,6 +76,12 @@ namespace SponsorBlock
return invalid
end function
function PostSegmentViewed(segmentId as string) as boolean
url = `${SponsorBlock.API_URL}${SponsorBlock.VIEWED_SEGMENT_ENDPOINT}?UUID=${segmentId}`
response = Requests().post(url)
return response.statuscode = 200
end function
function GenerateProgressBarBackground(segments as object, path as string)
bar = CreateObject("roBitmap", { width: 1000, height: 20, AlphaEnable: true })
bar.Clear(&hFFFFFF80)