159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
));
return r
# process json
def from_json(self, ls_json):
ls = []
for js in ls_json:
ls += json.loads(js)["data"]["stations"]["playables"]
r = []
for row in ls:
href = row["id"]
r.append(dict(
name = href,
title = row["name"],
genre = ",".join(row["genres"]),
url = "urn:radionet:"+href,
playing = row.get("city", row.get("country", "-")),
homepage = "http://www.radio.net/s/{}".format(href),
img = row["logo100x100"],
))
print(row)
return r
|
|
>
>
|
|
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
|
));
return r
# process json
def from_json(self, ls_json):
ls = []
for js in ls_json:
js = json.loads(js)["data"]
print(json.dumps(js, indent=4))
ls += js["topTenStations"]#["playables"]
r = []
for row in ls:
href = row["id"]
r.append(dict(
name = href,
title = row["name"],
genre = ",".join(row.get("genres", [])),
url = "urn:radionet:"+href,
playing = row.get("city", row.get("country", "-")),
homepage = "http://www.radio.net/s/{}".format(href),
img = row["logo100x100"],
))
print(row)
return r
|