From 64181040199c94830a80cc0fedc5acd5207b6a89 Mon Sep 17 00:00:00 2001 From: Gabe Cook Date: Tue, 3 Oct 2023 02:53:40 -0500 Subject: [PATCH] fix(device): Fix missing video ID breaking ad skip Ref #27 --- internal/device/watch.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/internal/device/watch.go b/internal/device/watch.go index b1aaf98..f6f588e 100644 --- a/internal/device/watch.go +++ b/internal/device/watch.go @@ -178,14 +178,12 @@ func (d *Device) tick() error { default: if castMedia.Media.ContentId == "" { d.queryVideoId(castMedia) - if castMedia.Media.ContentId == "" { - d.changeTickInterval(config.Default.PausedInterval) - return nil - } } if castMedia.Media.ContentId != d.prevVideoId { - d.logger.Info("Detected video stream.", "video_id", castMedia.Media.ContentId) + if castMedia.Media.ContentId != "" { + d.logger.Info("Detected video stream.", "video_id", castMedia.Media.ContentId) + } d.prevVideoId = castMedia.Media.ContentId d.unmuteSegment() d.querySegments(castMedia) @@ -382,6 +380,10 @@ func (d *Device) unmuteSegment() { } func (d *Device) querySegments(castMedia *cast.Media) { + if castMedia.Media.ContentId == "" { + return + } + if err := util.Retry(d.ctx, 10, 500*time.Millisecond, func(try uint) (err error) { d.segments, err = sponsorblock.QuerySegments(d.ctx, castMedia.Media.ContentId) return err