Hopefully fixed the parsing on the AzuraCast JSON. #2
|
@ -71,13 +71,17 @@ class Module(ModuleManager.BaseModule):
|
|||
def save_nowplaying(self, jsontxt):
|
||||
if jsontxt == "":
|
||||
data = utils.http.request(RADIO_API_BASE + "/nowplaying/1").json()
|
||||
self.is_online = data["live"]["is_live"]
|
||||
self.dj = data["live"]["streamer_name"]
|
||||
self.song = data["song_history"][0]["song"]["text"]
|
||||
self.listeners = data["listeners"]["current"]
|
||||
else:
|
||||
data = json.loads(jsontxt)
|
||||
self.is_online = data["live"]["is_live"]
|
||||
self.dj = data["live"]["streamer_name"]
|
||||
self.song = data["now_playing"]["song"]["text"]
|
||||
self.listeners = data["listeners"]["current"]
|
||||
|
||||
self.is_online = data["live"]["is_live"]
|
||||
self.dj = data["live"]["streamer_name"]
|
||||
self.song = data["now_playing"]["song"]["text"]
|
||||
self.listeners = data["listeners"]["current"]
|
||||
|
||||
def format_nowplaying(self):
|
||||
ret = ""
|
||||
|
|
Loading…
Reference in New Issue