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

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [984872dde3]:

To Artifact [4c365e0c90]:


101
102
103
104
105
106
107

108
109
110
111
112
113
114
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115







+






        if search:
            data = self.api(
                "stations/search",
                {"search": search, "limit": conf.max_streams}
            )
        # topclick, topvote
        elif cat in self.pricat:
            self.status(0.3)
            data = self.api(
                "stations/{}/{}".format(cat, conf.max_streams),
                {"limit": conf.max_streams}
            )
        # empty category
        #elif cat in ("tags", "countries", "languages"):
        #    return [
125
126
127
128
129
130
131

132
133
134
135
136
137
138
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140







+






                    "limit": conf.max_streams * 2
                }
            )
            #data = self.api("stations/" + self.catmap[conf.radiobrowser_cat] + "/" + cat)

        if len(data) >= 5000:
            data = data[0:5000]
        self.status(0.75)

        r = []
        for e in data:
            r.append(dict(
                genre = e["tags"],
                url = e["url"],
                format = mime_fmt(e["codec"]),
164
165
166
167
168
169
170
171

172
173
174
175

176
177
178
179
180
181
182
166
167
168
169
170
171
172

173
174
175
176

177
178
179
180
181
182
183
184







-
+



-
+








    # callback for general stream play event
    def click(self, row, channel):
        if not channel == self:
            return
        # fetch uuid, then register click
        uuid = self.api("stations/byurl", {"url": row.get("url")})
        uuid = self.api("stations/byurl", {"url": row.get("url")}, quieter=1)
        if uuid:
            if isinstance(uuid, list): # just vote on the first entry
                uuid = uuid[0]
            log.PROC_CLICK_COUNT(self.api("url/{}".format(uuid["stationuuid"])))
            log.CLICK(self.api("url/{}".format(uuid["stationuuid"], quieter=1)))


    # Add radio station to RBI
    def submit(self, *w):
        cn = self.parent.channel()
        row = cn.row()
        # convert row from channel