erdnaxeli / castblock

Automatically skip sponsor segments and ads in YouTube videos playing on Chromecast.
MIT License
183 stars 20 forks source link

Castblock claims to be skipping, but nothing happens #5

Closed stephen304 closed 3 years ago

stephen304 commented 3 years ago

Ran into this just now - It looks like it's trying to skip the same segment but nothing actually happened:

Apr 28 11:46:20 pihole castblock[76792]: 2021-04-28T15:46:20.632400Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:46:33 pihole castblock[76792]: 2021-04-28T15:46:33.636287Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:46:43 pihole castblock[76792]: 2021-04-28T15:46:43.642162Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:46:53 pihole castblock[76792]: 2021-04-28T15:46:53.648376Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:06 pihole castblock[76792]: 2021-04-28T15:47:06.650518Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:16 pihole castblock[76792]: 2021-04-28T15:47:16.652738Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:26 pihole castblock[76792]: 2021-04-28T15:47:26.657088Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:39 pihole castblock[76792]: 2021-04-28T15:47:39.662750Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:49 pihole castblock[76792]: 2021-04-28T15:47:49.664129Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894
Apr 28 11:47:59 pihole castblock[76792]: 2021-04-28T15:47:59.666159Z   INFO - castblock.blocker: Found a sponsor segment, skipping it. -- id: "kMxcw_lQBjI", start: 40.812607, end: 102.831894

Unfortunately I wasn't running in debug mode. Also worth noting that it seems to be permanently stuck in this state.

I'm not familiar at all with the go-chromecast http api, any ideas on what might be the cause?

Edit: Could it be that the watch thread is still connected but the http api used for skipping lost the device?

erdnaxeli commented 3 years ago

The log for error when calling /seek-to uses debug level :roll_eyes: . I changed it to error level and I added the error from go-chromecast in the message. You can use master (or latest docker images), if it happens again we will see the error.

Anyway the timing is weird. watch is set to send a message every second, and the code just react to those messages, but thoses log indicate that it is trying to seek every 10 or 13s. It seems like something (the httpserver probably) is either slow to timeout or does automatic retries. I need to dig that.

erdnaxeli commented 3 years ago

I just add the same bug as you!

This is what I saw:

Unfortunately I didn't try to call /disconnect, then /connect again, then /seek-to. If you do have the error again could you try to do that please?

erdnaxeli commented 3 years ago

The error comes from here: https://github.com/vishen/go-chromecast/blob/0795e28217f8b18586ebb69c1569c46451dbab0b/cast/connection.go#L121. It seems like the connection is just broken. I will implement a disconnect / reconnect mechanism.

stephen304 commented 3 years ago

Sounds good, I was too slow to reproduce the issue :)

stephen304 commented 3 years ago

Got it to happen again, this is what happens when I try to disconnect / reconnect: image It still doesn't seem to fix the issue

erdnaxeli commented 3 years ago

Yes, go-chromecast can't disconnect from a broken connection. I am opening an issue on their side.

stephen304 commented 3 years ago

Looks like that fix makes disconnecting and reconnecting work to fix the issue. I guess all that's needed is to auto reconnect when it gets disconnected

erdnaxeli commented 3 years ago

Tell me if it happens again. I spotted a weird bug in go-chromecast where the /seek-to endpoint can return a 200 even if the connection is broken (https://github.com/vishen/go-chromecast/issues/106). If that happens we will not do a disconnect / reconnect.

But I suspect that in real life conditions the endpoint would return an error, and in that case the code will try to reconnect.