@@ -35,14 +35,14 @@ import re import json from config import * from channels import * -import ahttp as http +import ahttp -# Surfmusik sharing site +# iCast.io API class icast (ChannelPlugin): # control attributes has_search = True listformat = "pls" @@ -52,11 +52,11 @@ # Categories require little post-processing, just dict into list conversion def update_categories(self): self.categories = [] - for genre,cats in json.loads(http.get(self.base + "genres"))["genres"].items(): + for genre,cats in json.loads(ahttp.get(self.base + "genres"))["genres"].items(): self.categories.append(genre.title()) self.categories.append([c.title() for c in cats]) # Just copy over stream URLs and station titles def update_streams(self, cat, search=None): @@ -82,15 +82,15 @@ # fetch multiple pages def api(self, method, path, params): r = [] while len(r) < int(conf.max_streams): - data = json.loads(http.get( self.base + method + path, params)) + data = json.loads(ahttp.get( self.base + method + path, params)) r += data["stations"] if len(r) >= data["meta"]["total_count"] or len(data["stations"]) < 10: break else: params["page"] = int(data["meta"]["current_page"]) + 1 self.parent.status(params["page"] * 9.5 / float(conf.max_streams)) #log.DATA(data) return r