94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120 | pass
# downloads stream list from shoutcast for given category
def update_streams(self, cat):
if (cat not in self.catmap):
__print__( dbg.ERR, "nocat" )
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({ |
|
|
| 94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120 | pass
# downloads stream list from shoutcast for given category
def update_streams(self, cat):
if (cat not in self.catmap):
__print__( dbg.ERR, "Category not in known map.", cat )
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__(dbg.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({ |