mirror of
https://github.com/natekspencer/hacs-oasis_mini.git
synced 2025-11-16 09:03:50 -05:00
Handle removed updated_at property
This commit is contained in:
@@ -30,9 +30,11 @@ async def update_tracks() -> None:
|
|||||||
|
|
||||||
updated_tracks: dict[int, dict[str, Any]] = {}
|
updated_tracks: dict[int, dict[str, Any]] = {}
|
||||||
for result in filter(lambda d: d["public"], data):
|
for result in filter(lambda d: d["public"], data):
|
||||||
if (track_id := result["id"]) not in TRACKS or result["updated_at"] != TRACKS[
|
if (
|
||||||
track_id
|
(track_id := result["id"]) not in TRACKS
|
||||||
].get("updated_at"):
|
or result["name"] != TRACKS[track_id].get("name")
|
||||||
|
or result["image"] != TRACKS[track_id].get("image")
|
||||||
|
):
|
||||||
print(f"Updating track {track_id}: {result["name"]}")
|
print(f"Updating track {track_id}: {result["name"]}")
|
||||||
track_info = await client.async_cloud_get_track_info(int(track_id))
|
track_info = await client.async_cloud_get_track_info(int(track_id))
|
||||||
if not track_info:
|
if not track_info:
|
||||||
@@ -46,7 +48,6 @@ async def update_tracks() -> None:
|
|||||||
"image": result["image"],
|
"image": result["image"],
|
||||||
"clean_pattern": track_info.get("cleanPattern", {}).get("id"),
|
"clean_pattern": track_info.get("cleanPattern", {}).get("id"),
|
||||||
"reduced_svg_content": track_info.get("reduced_svg_content"),
|
"reduced_svg_content": track_info.get("reduced_svg_content"),
|
||||||
"updated_at": result["updated_at"],
|
|
||||||
}
|
}
|
||||||
await client.session.close()
|
await client.session.close()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user