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

⌈⌋ branch:  streamtuner2


Diff

Differences From Artifact [ee9e1bcb9d]:

To Artifact [d87b406b97]:


324
325
326
327
328
329
330


331














332
333
334
335
336
337
338
324
325
326
327
328
329
330
331
332

333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353







+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+






        urls = re.findall(rx, self.src, re.X)
        # decode urls
        if decode in ("xml", "*"):
            urls = [xmlunescape(url) for url in urls]
        if decode in ("json", "*"):
            urls = [url.replace("\\/", "/") for url in urls]
        # only uniques
        uniq = []
        urls = [uniq.append(u) for u in urls if not u in uniq]
        return list(set(urls))
        return uniq

    # Try to capture common title schemes 
    def title(self):
        t = re.search(r"""(?:
              ^Title\d*=(.+)
           |  ^\#EXTINF[-:\d,]*(.+)
           |  <title>([^<>]+)
           |  (?i)Title[\W]+(.+)
        )""", self.src, re.X|re.M)
        for i in range(1,10):
            if t and t.group(i):
                return t.group(i)
        

    # Only look out for URLs, not local file paths, nor titles
    extr_urls = (
       ("pls",  (r"(?im) ^ \s*File\d* \s*=\s* (\w+://[^\s]+) ", None)),
       ("m3u",  (r" (?m) ^( \w+:// [^#\n]+ )", None)),
       ("xspf", (r" (?x) <location> (\w+://[^<>\s]+) </location> ", "xml")),
       ("asx",  (r" (?x) <ref \b[^>]+\b href \s*=\s* [\'\"] (\w+://[^\s\"\']+) [\'\"] ", "xml")),