Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [db262a5d06]:

To Artifact [8581a994c5]:


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126


    # Patch API url together, send request, decode JSON list
    def api(self, method, **params):
        params["token"] = conf.dirble_api_key or self.key
        try:
            # HTTP request and JSON decoding take a while
            r = ahttp.get(self.base.format(method), params)
            r = json.loads(r)
            if isinstance(r, dict) and "error" in r:
                log.ERR(r["error"])
                raise Exception
            # cut down stream list
            if len(r) > int(conf.max_streams):
                del r[int(conf.max_streams):]
        except Exception as e:
            log.ERR("Dirble API retrieval failure:", e)
            r = []
        return r









|













106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126


    # Patch API url together, send request, decode JSON list
    def api(self, method, **params):
        params["token"] = conf.dirble_api_key or self.key
        try:
            # HTTP request and JSON decoding take a while
            r = ahttp.get(self.base.format(method), params, encoding="utf-8")
            r = json.loads(r)
            if isinstance(r, dict) and "error" in r:
                log.ERR(r["error"])
                raise Exception
            # cut down stream list
            if len(r) > int(conf.max_streams):
                del r[int(conf.max_streams):]
        except Exception as e:
            log.ERR("Dirble API retrieval failure:", e)
            r = []
        return r