Fix loading shows due to myradio caching.

This commit is contained in:
Matthew Stratford 2021-04-25 00:45:20 +01:00
parent 7c3721d3fd
commit 62565e0887

View file

@ -183,7 +183,21 @@ class MyRadioAPI:
self._logException("Failed to get show plan.")
return None
return json.loads(await request)["payload"]
payload = json.loads(await request)["payload"]
plan = {}
# Account for MyRadio api being dumb depending on if it's cached or not.
if isinstance(payload, list):
for channel in range(len(payload)):
plan[str(channel)] = payload[channel]
return plan
elif isinstance(payload, dict):
return payload
self.logger.log.error("Show plan in unknown format.")
return None
# Audio Library