e
This commit is contained in:
parent
da854a6847
commit
00000d989d
2 changed files with 20 additions and 11 deletions
|
|
@ -130,7 +130,13 @@ async def get_events(
|
||||||
cached_keys: set[str],
|
cached_keys: set[str],
|
||||||
) -> list[dict[str, str]]:
|
) -> list[dict[str, str]]:
|
||||||
if not (api_data := API_FILE.load(per_entry=False)):
|
if not (api_data := API_FILE.load(per_entry=False)):
|
||||||
api_data = await refresh_api_cache(client, urljoin(base_url, "api/streams"))
|
api_data = await refresh_api_cache(
|
||||||
|
client,
|
||||||
|
urljoin(
|
||||||
|
base_url,
|
||||||
|
"api/streams",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
API_FILE.write(api_data)
|
API_FILE.write(api_data)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,11 @@ async def get_events(
|
||||||
) -> list[dict[str, str]]:
|
) -> list[dict[str, str]]:
|
||||||
if not (api_data := API_FILE.load(per_entry=False, index=True)):
|
if not (api_data := API_FILE.load(per_entry=False, index=True)):
|
||||||
api_data = await refresh_api_cache(
|
api_data = await refresh_api_cache(
|
||||||
client, urljoin(base_url, "api/matches/all-today")
|
client,
|
||||||
|
urljoin(
|
||||||
|
base_url,
|
||||||
|
"api/matches/all-today",
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
API_FILE.write(api_data)
|
API_FILE.write(api_data)
|
||||||
|
|
@ -180,18 +184,17 @@ async def get_events(
|
||||||
if not start_dt <= event_dt <= end_dt:
|
if not start_dt <= event_dt <= end_dt:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
source: list[dict[str, str]] = event["sources"]
|
sources: list[dict[str, str]] = event["sources"]
|
||||||
|
|
||||||
for s in source:
|
if not sources:
|
||||||
source_type = s.get("source")
|
continue
|
||||||
|
|
||||||
stream_id = s.get("id")
|
first_source = sources[0]
|
||||||
|
source_type = first_source.get("source")
|
||||||
|
stream_id = first_source.get("id")
|
||||||
|
|
||||||
if not source_type:
|
if not (source_type and stream_id):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not stream_id:
|
|
||||||
continue
|
|
||||||
|
|
||||||
events.append(
|
events.append(
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue