Compare commits

..

4 Commits

Author SHA1 Message Date
dmunozv04
30cac71820 Fix watchdog triggering too much 2025-07-04 19:14:08 +02:00
dmunozv04
f2155abad3 Bump version 2025-05-30 21:56:45 +02:00
David
edbea793ed Merge pull request #312 from dmunozv04/fix-311
Fixes constant "new decive connected"
2025-05-30 21:55:46 +02:00
dmunozv04
df629805c2 Fixes constant "new decive connected" 2025-05-30 21:55:00 +02:00
2 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
[project]
name = "iSponsorBlockTV"
version = "2.5.2"
version = "2.5.3"
authors = [
{"name" = "dmunozv04"}
]

View File

@@ -1,6 +1,7 @@
import asyncio
import json
import sys
import time
from typing import Any, List
import pyytlounge
@@ -50,12 +51,12 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
it cancels the current subscription.
"""
self.watchdog_running = True
self.last_event_time = asyncio.get_event_loop().time()
self.last_event_time = time.time()
try:
while self.watchdog_running:
await asyncio.sleep(10)
current_time = asyncio.get_event_loop().time()
current_time = time.time()
time_since_last_event = current_time - self.last_event_time
# YouTube sends a message at least every 30 seconds
@@ -105,7 +106,7 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
def _process_event(self, event_type: str, args: List[Any]):
self.logger.debug(f"process_event({event_type}, {args})")
# Update last event time for the watchdog
self.last_event_time = asyncio.get_event_loop().time()
self.last_event_time = time.time()
# A bunch of events useful to detect ads playing,
# and the next video before it starts playing
@@ -260,13 +261,12 @@ class YtLoungeApi(pyytlounge.YtLoungeApi):
raise NotLinkedException("Not linked")
connect_body = {
"id": str(uuid4()),
"id": self.auth.screen_id,
"mdx-version": "3",
"TYPE": "xmlhttp",
"theme": "cl",
"sessionSource": "MDX_SESSION_SOURCE_UNKNOWN",
"connectParams": '{"setStatesParams": "{"playbackSpeed":0}"}',
"sessionNonce": str(uuid4()),
"RID": "1",
"CVER": "1",
"capabilities": "que,dsdtr,atp,vsp",