e
This commit is contained in:
parent
f6dc06ca77
commit
00000d952c
2 changed files with 4 additions and 9 deletions
|
|
@ -8,6 +8,7 @@ from xml.etree import ElementTree as ET
|
||||||
import httpx
|
import httpx
|
||||||
|
|
||||||
epg_file = Path(__file__).parent / "TV.xml"
|
epg_file = Path(__file__).parent / "TV.xml"
|
||||||
|
|
||||||
epg_urls = [
|
epg_urls = [
|
||||||
"https://epgshare01.online/epgshare01/epg_ripper_CA2.xml.gz",
|
"https://epgshare01.online/epgshare01/epg_ripper_CA2.xml.gz",
|
||||||
"https://epgshare01.online/epgshare01/epg_ripper_DUMMY_CHANNELS.xml.gz",
|
"https://epgshare01.online/epgshare01/epg_ripper_DUMMY_CHANNELS.xml.gz",
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ log = get_logger(__name__)
|
||||||
|
|
||||||
urls: dict[str, dict[str, str | float]] = {}
|
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)
|
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,
|
re.IGNORECASE,
|
||||||
)
|
)
|
||||||
|
|
||||||
start_dt = now.delta(minutes=-30)
|
|
||||||
end_dt = now.delta(minutes=30)
|
|
||||||
|
|
||||||
for event in api_data.get("events", []):
|
for event in api_data.get("events", []):
|
||||||
event_dt = Time.from_str(event["date"], timezone="UTC")
|
event_dt = Time.from_str(event["date"], timezone="UTC")
|
||||||
|
|
||||||
if now.date() != event_dt.date():
|
if event_dt.date() != now.date():
|
||||||
continue
|
|
||||||
|
|
||||||
if not start_dt <= event_dt <= end_dt:
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
event_name = event["match_name"]
|
event_name = event["match_name"]
|
||||||
|
|
@ -103,7 +97,7 @@ async def get_events(cached_keys: set[str]) -> dict[str, str | float]:
|
||||||
"url": stream_link,
|
"url": stream_link,
|
||||||
"logo": logo,
|
"logo": logo,
|
||||||
"base": "https://pixelsport.tv/",
|
"base": "https://pixelsport.tv/",
|
||||||
"timestamp": event_dt.timestamp(),
|
"timestamp": now.timestamp(),
|
||||||
"id": tvg_id or "Live.Event.us",
|
"id": tvg_id or "Live.Event.us",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue