e
This commit is contained in:
parent
4f6e1caa5f
commit
00000d9c6d
16 changed files with 106 additions and 89 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import httpx
|
||||
|
||||
|
|
@ -9,9 +8,9 @@ log = get_logger(__name__)
|
|||
|
||||
urls: dict[str, dict[str, str | float]] = {}
|
||||
|
||||
API_FILE = Cache(Path(__file__).parent / "caches" / "pixel_api.json", exp=28_800)
|
||||
CACHE_FILE = Cache("pixel.json", exp=10_800)
|
||||
|
||||
CACHE_FILE = Cache(Path(__file__).parent / "caches" / "pixel.json", exp=10_800)
|
||||
API_FILE = Cache("pixel-api.json", exp=28_800)
|
||||
|
||||
BASE_URL = "https://pixelsport.tv/backend/livetv/events"
|
||||
|
||||
|
|
@ -28,6 +27,7 @@ async def refresh_api_cache(
|
|||
r.raise_for_status()
|
||||
except Exception as e:
|
||||
log.error(f'Failed to fetch "{url}": {e}')
|
||||
|
||||
return {}
|
||||
|
||||
data = r.json()
|
||||
|
|
@ -63,7 +63,7 @@ async def get_events(
|
|||
end_dt = now.delta(minutes=30)
|
||||
|
||||
for event in api_data["events"]:
|
||||
event_dt = Time.from_str(f'{event["date"]}', timezone="UTC")
|
||||
event_dt = Time.from_str(event["date"], timezone="UTC")
|
||||
|
||||
if now.date() != event_dt.date():
|
||||
continue
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue