nichobi / sponsorblockcast

A shell script that skips sponsored YouTube content on all local Chromecasts
GNU General Public License v3.0
348 stars 16 forks source link

Cast target disappears, script stays running #6

Closed teubenja closed 2 years ago

teubenja commented 3 years ago

Hey,

I have an Android TV box. When I put that box in standby the cast target disappears, but the script still says it is running/watching that specific target. What happens because of that is that the script won't reattach when I wake the box, so it effectively stops working for that target.

I thought maybe you could add a timeout in the script so that when a target disappears it stops that thread and resets so that it can rediscover that target.

nichobi commented 3 years ago

Interesting, I don't have Android TV myself, so I can't really test it, though I think this might be a go-chromecast bug. I would expect the watch command to either exit or fail when the cast-device disappears, after which sponsorblockcast would restart the watch command when it next scans for devices.

I found a potentially relevant issue here vishen/go-chromecast#85, which has already been fixed in version 0.2.7. Check if you're using an older version, otherwise it may be separate issue.

teubenja commented 3 years ago

Thanks for the quick reply! It is indeed the same issue that I have. I'll check which version I have and if updating solves the issues

nichobi commented 3 years ago

Did you get this sorted out for you? I'll go ahead and close the issue if it's fixed

teubenja commented 3 years ago

Oh sorry for the late reply. No I haven't fixed it yet, updating everything didn't work and I kinda forgot about it. Is there anything I can do to help debug this?

nichobi commented 3 years ago

Hmm, it's likely an underlying issue in go-chromecast. You could manually run a go-chromecast watch from a terminal and see what happens when your device goes to sleep. Then you'll likely be better off opening an issue in the go-chromecast repository.

Rapti commented 1 year ago

My Chromecast is plugged into a smart WiFi socket and only receives power when I intend to use it. This causes the same problems: sponsorblockcast only finds the device the first time it's powered on. Once I cut the power to the Chromecast and turn it back on, sponsorblockcast no longer finds the device until I restart the service.

I've spent some time digging into this and it is indeed caused by go-chromecast not exiting when a device goes offline. Instead, it outputs a prompt and waits for another device to be selected, or if --first is passed, it just starts watching a random other device. Right now, there seems to be no way to change this. I've created an issue about this here: https://github.com/vishen/go-chromecast/issues/159

As a workaround, I've added a rule to my smart home system that restarts the systemd service whenever the smart socket is turned on.

Rapti commented 1 year ago

The issue has been fixed in go-chromecast. No change is needed in sponsorblockcast; just update go-chromecast and the issue should be gone.

bruvv commented 1 year ago

And how can you update the go-chromecast within the docker image ;) ? will be awesome if @nichobi can release a new docker build.