Check-in [a6b5fc3cc9]
Overview
| Comment: | Exception for json decoding from SHOUTcast. (Doesn't work with older requests library.) |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
a6b5fc3cc9c5ba99f816d9301525126d |
| User & Date: | mario on 2015-03-25 21:54:14 |
| Other Links: | manifest | tags |
Context
|
2015-03-26
| ||
| 18:51 | Explain audio player configuration with more examples, detail options for streamripper recording. check-in: 803cb52d3f user: mario tags: trunk | |
|
2015-03-25
| ||
| 21:54 | Exception for json decoding from SHOUTcast. (Doesn't work with older requests library.) check-in: a6b5fc3cc9 user: mario tags: trunk | |
| 21:53 | Properly query "local" category. check-in: acf4baf5e4 user: mario tags: trunk | |
Changes
Modified channels/shoutcast.py from [ffcf202481] to [f799791802].
| ︙ | ︙ | |||
101 102 103 104 105 106 107 |
return []
id = self.catmap[cat]
# page
url = "http://www.shoutcast.com/Home/BrowseByGenre"
params = { "genrename": cat }
referer = None
| > | > > > > | | 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
return []
id = self.catmap[cat]
# page
url = "http://www.shoutcast.com/Home/BrowseByGenre"
params = { "genrename": cat }
referer = None
try:
json = http.get(url, params=params, referer=referer, post=1, ajax=1)
json = json_decode(json)
except:
__print__(db.ERR, "HTTP request or JSON decoding failed. Outdated python/requests perhaps.")
return []
self.parent.status(0.75)
# remap JSON
entries = []
for e in json:
entries.append({
"id": int(e.get("ID", 0)),
"genre": str(e.get("Genre", "")),
"title": str(e.get("Name", "")),
"playing": str(e.get("CurrentTrack", "")),
"bitrate": int(e.get("Bitrate", 0)),
"listeners": int(e.get("Listeners", 0)),
|
| ︙ | ︙ |