This commit is contained in:
doms9 2025-11-19 12:29:27 -05:00
parent f6dc06ca77
commit 00000d952c
2 changed files with 4 additions and 9 deletions

View file

@ -9,7 +9,7 @@ log = get_logger(__name__)
urls: dict[str, dict[str, str | float]] = {}
CACHE_FILE = Cache("pixel.json", exp=10_800)
CACHE_FILE = Cache("pixel.json", exp=86_400)
API_FILE = Cache("pixel-api.json", exp=86_400)
@ -69,16 +69,10 @@ async def get_events(cached_keys: set[str]) -> dict[str, str | float]:
re.IGNORECASE,
)
start_dt = now.delta(minutes=-30)
end_dt = now.delta(minutes=30)
for event in api_data.get("events", []):
event_dt = Time.from_str(event["date"], timezone="UTC")
if now.date() != event_dt.date():
continue
if not start_dt <= event_dt <= end_dt:
if event_dt.date() != now.date():
continue
event_name = event["match_name"]
@ -103,7 +97,7 @@ async def get_events(cached_keys: set[str]) -> dict[str, str | float]:
"url": stream_link,
"logo": logo,
"base": "https://pixelsport.tv/",
"timestamp": event_dt.timestamp(),
"timestamp": now.timestamp(),
"id": tvg_id or "Live.Event.us",
}