gabe565 / CastSponsorSkip

⏭️ Skip YouTube ads and sponsorships on all local Google Cast devices
Apache License 2.0
286 stars 6 forks source link

Feature Request: Retry segment download on timeout. #15

Closed schumi4 closed 11 months ago

schumi4 commented 11 months ago

When a video is already running on boot (like when having an RPi powered by the TV itself) the segment download fails:

Aug 28 11:29:41 DietPi systemd[1]: Started castsponsorskip.service - A Go program that skips sponsored YouTube content on all local Google Cast devices.
Aug 28 11:29:43 DietPi castsponsorskip[429]: 2023/08/28 11:29:43 INFO Searching for devices...
Aug 28 11:29:43 DietPi castsponsorskip[429]: 2023/08/28 11:29:43 INFO Connected to cast device. device="Chromeo ULTRA"
Aug 28 11:29:44 DietPi castsponsorskip[429]: 2023/08/28 11:29:44 INFO Detected video stream. device="Chromeo ULTRA" video_id=[redacted]
Aug 28 11:29:54 DietPi castsponsorskip[429]: 2023/08/28 11:29:54 ERROR Failed to query segments. Retrying... device="Chromeo ULTRA" error="Get \"https://sponsor.ajay.app/api/skipSegments/[redacted]?category=sponsor&category=selfpromo&category=interaction\": net/http: TLS handshake timeout"

It says retrying, but does not seem to do that. Might be specific to my setup, but I can imagine segment download could also fail for numerous other temporary reasons. Maybe add limited retries on fail?

Thank you for considering!

gabe565 commented 11 months ago

I don't think this happened due to the video already running on boot, but you're right that it should retry like the log says. It originally did but after a couple of optimization stages, it seems like it only tries once.

gabe565 commented 11 months ago

I remember the change that caused this! It would originally retry on every update loop, but that caused streams with no segments to be retried every second. I just need to make it so that it retries if the segment download endpoint fails, but doesn't retry if it returns a 404!

gabe565 commented 11 months ago

Fixed in v0.3.3