Fix failing to return when no shows.

This commit is contained in:
Matthew Stratford 2021-08-16 23:29:58 +01:00
parent 8d98410a6a
commit b90330ff57

View file

@ -156,23 +156,22 @@ class MyRadioAPI:
payload = json.loads(await request)["payload"]
shows = []
if not payload["current"]:
self._logException("API did not return a current show.")
else:
shows.append(payload["current"])
if not payload["next"]:
self._logException("API did not return a list of next shows.")
else:
shows.extend(payload["next"])
shows = []
shows.append(payload["current"])
shows.extend(payload["next"])
timeslots = []
# Remove jukebox etc
for show in shows:
if not "timeslot_id" in show:
shows.remove(show)
# TODO filter out jukebox
return shows
async def get_showplan(self, timeslotid: int):