Skip to content

Commit

Permalink
Version 4.2.7; Catch when a epgnow response is unsuccessful
Browse files Browse the repository at this point in the history
  • Loading branch information
autinerd committed Aug 16, 2024
1 parent aa33f98 commit e5a5eed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion openwebif/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Top-level package for openwebif."""

__version__ = "4.2.6"
__version__ = "4.2.7"
8 changes: 6 additions & 2 deletions openwebif/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,12 @@ async def get_bouquet_sources(self, bouquet: str | None = None) -> dict[str, Any

result = await self._call_api(PATH_EPGNOW, {"bRef": bRef})

if result:
sources = {src["sname"]: src["sref"] for src in result["events"]} if len(result["events"]) > 0 else {}
if result and "events" in result and len(result["events"]) > 0:
sources = {
src["sname"]: src["sref"]
for src in result["events"]
if "sname" in src and "sref" in src
}
else:
_LOGGER.warning("No sources could be loaded from specified bouquet.")
return sources
Expand Down

0 comments on commit e5a5eed

Please sign in to comment.