SponsorBlock Notification (#47)

* SponsorBlock Notification

* Lint fix

* Reuse animation for multiple skips

* Small change

* Rename color utils

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2023-02-10 15:20:08 -05:00
1 parent 9697ac58d0
commit e0020ffa66
17 files changed
+460 -62

No files matched your search

@@ -1,5 +1,6 @@
import "pkg:/source/services/Invidious.bs"
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/SponsorBlockNotification/SponsorBlockNotificationManager.bs"
function PlayVideo(videoId as string, args = invalid as object)
sender = args?.sender
@@ -23,6 +24,7 @@ function PlayVideo(videoId as string, args = invalid as object)
videoContainer.sender = sender
end if
videoContainer.videoPlayer = videoContainer.createChild("VideoPlayer")
videoContainer.insertChild(videoContainer.videoPlayer, 0)
videoContainer.videoPlayer.id = "VideoPlayer"
videoContainer.videoPlayer.metadata = metadata
videoContainer.videoPlayer.videoId = videoId
@@ -49,6 +51,7 @@ function CloseVideo(setFocus = true as boolean)
videoContainer.sender.SetFocus(true)
end if
end if
SponsorBlockNotifcationSetVisible(false)
end function
function ToggleVideoPictureInPicture(sender = invalid as object) as boolean
@@ -4,6 +4,8 @@ import "pkg:/components/VideoPlayer/Video.bs"
import "pkg:/components/VideoPlayer/VideoDetailsTask.bs"
function Init()
m.videoContainer = GetVideoContainer()
SetupSponsorBlock()
SetupAnimation()
SetupBusySpinner()
@@ -12,7 +14,6 @@ function Init()
m.top.bufferingBar.filledBarBlendColor = "0xFF0000FF"
m.top.retrievingBar.filledBarBlendColor = "0xFF0000FF"
m.videoContainer = GetVideoContainer()
m.top.enableUI = m.videoContainer.fullscreen
m.videoContainer.observeFieldScoped("fullscreen", "OnFullScreenChange")
@@ -335,4 +336,5 @@ function OnFullScreenChange()
m.translationAnimation.control = "start"
m.top.enableUI = m.videoContainer.fullscreen
SponsorBlockNotifcationSetVisible(m.videoContainer.fullscreen)
end function
@@ -1,9 +1,13 @@
import "pkg:/source/asyncTask/asyncTask.bs"
import "pkg:/components/VideoPlayer/SponsorBlockTask.bs"
import "pkg:/components/VideoPlayer/SponsorBlockTrackingTask.bs"
import "pkg:/components/SponsorBlockNotification/SponsorBlockNotificationManager.bs"
function SetupSponsorBlock()
PositionChapterLabel()
SponsorBlockNotifcationSetVisible(m.videoContainer.fullscreen)
m.timeLabel = FindTimeLabel()
m.top.trickPlayBar.observeField("visible", "OnTrickPlayBarVisible")
m.chapterLabelTimer = m.top.findNode("chapterLabelTimer")
@@ -123,6 +127,7 @@ function OnPositionChangeSkipSponsorBlockSections() as void
' TODO: if segmentEnd is at the end of the video, close video
m.top.seek = segmentEnd
print("Skipping section:" + segment["category"])
ShowSponsorBlockNotifcation(segment)
SendSkippedSectionEvent(segment.UUID)
return
end if