Skip to content

Commit

Permalink
minor fixes for EPG cache
Browse files Browse the repository at this point in the history
  • Loading branch information
DYefremov committed Feb 25, 2024
1 parent ee2fcf8 commit b383c25
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/ui/epg/epg.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def update_http_data(self, epg):
@run_task
def update_xml_data(self):
services = self._app.current_services
names = {services[s].service for s in self._app.current_bouquets.get(self._current_bq, [])}
names = {services[s].service for s in self._app.current_bouquets.get(self._current_bq, []) if s in services}
for name, events in self._reader.get_current_events(names).items():
ev = min(events, key=lambda x: x.start, default=None)
if ev:
Expand Down Expand Up @@ -311,7 +311,7 @@ def reset(self) -> None:

def update_epg_data(self) -> bool:
services = self._app.current_services
names = {services[s].service for s in chain.from_iterable(self._app.current_bouquets.values())}
names = {services[s].service for s in chain.from_iterable(self._app.current_bouquets.values()) if s in services}
for name, events in self._reader.get_current_events(names).items():
self.events[name] = events

Expand Down Expand Up @@ -747,7 +747,8 @@ def get_multi_epg(self):
api.send(HttpAPI.Request.EPG_MULTI, f'1:7:1:0:0:0:0:0:0:0:{req}', self.update_http_epg_data, timeout=15)
else:
srvs = self._app.current_services
self.update_xmltv_epg_data(srvs[s].service for s in self._app.current_bouquets.get(self._current_bq, []))
bq_names = (srvs[s].service for s in self._app.current_bouquets.get(self._current_bq, []) if s in srvs)
self.update_xmltv_epg_data(bq_names)

# ****************** Timers ***************** #

Expand Down

0 comments on commit b383c25

Please sign in to comment.