Fix SponsorBlock zero videoDuration bug (#23)
This commit is contained in:
1 parent
e716b7f80b
commit
08dd620380
2 files changed
+13
-1
No files matched your search
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Bug where app freezes if metadata fails to fetch
|
- Bug where app freezes if metadata fails to fetch
|
||||||
|
- A bug where SponsorBlock returning videoDuration of zero causes the app to hang
|
||||||
|
|
||||||
## [0.5.0] - 2022-12-02
|
## [0.5.0] - 2022-12-02
|
||||||
### Added
|
### Added
|
||||||
|
|||||||
@@ -4,9 +4,20 @@ function TaskMain()
|
|||||||
input = m.top.getField("input")
|
input = m.top.getField("input")
|
||||||
videoId = input.videoId
|
videoId = input.videoId
|
||||||
|
|
||||||
skipSegments = SponsorBlock.GetSkipSegmentsForVideo(videoId)
|
sponsorBlockResponse = SponsorBlock.GetSkipSegmentsForVideo(videoId)
|
||||||
barPath = invalid
|
barPath = invalid
|
||||||
|
|
||||||
|
skipSegments = []
|
||||||
|
for each segment in sponsorBlockResponse
|
||||||
|
if segment.videoDuration > 0
|
||||||
|
skipSegments.push(segment)
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
|
||||||
|
if skipSegments.Count() = 0
|
||||||
|
skipSegments = invalid
|
||||||
|
end if
|
||||||
|
|
||||||
if skipSegments <> invalid
|
if skipSegments <> invalid
|
||||||
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
|
barPath = `tmp:/sponsorblock_bar_${videoId}.png`
|
||||||
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)
|
SponsorBlock.GenerateProgressBarBackground(skipSegments, barPath)
|
||||||
|
|||||||
Reference in new issue
Block a user