diff --git a/src/iSponsorBlockTV/ytlounge.py b/src/iSponsorBlockTV/ytlounge.py index bdf7f92..e4c4e03 100644 --- a/src/iSponsorBlockTV/ytlounge.py +++ b/src/iSponsorBlockTV/ytlounge.py @@ -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