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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [3301815009]

Overview
Comment:Fix case-sensitive PLS construction and File\d+ index starting from 1. Adapt format detection regexps as well for html, and xspf xmlns.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3301815009c790660f1366c018575e01e983fc1c
User & Date: mario on 2015-04-11 14:06:35
Other Links: manifest | tags
Context
2015-04-11
14:10
Slim down first_show() in main.channel_switch(). check-in: 97a832d8f2 user: mario tags: trunk
14:06
Fix case-sensitive PLS construction and File\d+ index starting from 1. Adapt format detection regexps as well for html, and xspf xmlns. check-in: 3301815009 user: mario tags: trunk
01:20
Initialize with empty station TreeView again. Make bookmarks channel not override the behaviour. (This sort of works around the .current category mismatch after startup.) check-in: 6109a1a671 user: mario tags: trunk
Changes

Modified action.py from [097271c366] to [f8a0134421].

86
87
88
89
90
91
92
93
94


95
96
97
98

99
100
101
102
103
104
105
86
87
88
89
90
91
92


93
94
95
96
97

98
99
100
101
102
103
104
105







-
-
+
+



-
+







    asx = "(%asx) \\b",
    smil= "(%smil) \\b",
    srv = "(%srv | %d | %s) \\b",
)

# Playlist format content probing (assert type)
playlist_content_map = [
   ("pls",  r""" (?i)\[playlist\].*numberofentries """),
   ("xspf", r""" <\?xml .* <playlist .* http://xspf\.org/ns/0/ """),
   ("pls",  r""" (?i)\[playlist\].*NumberOfEntries """),
   ("xspf", r""" <\?xml .* <playlist .* ((?i)http://xspf\.org)/ns/0/ """),
   ("m3u",  r""" ^ \s* #(EXT)?M3U """),
   ("asx" , r""" <asx\b """),
   ("smil", r""" <smil[^>]*> .* <seq> """),
   ("html", r""" <(audio|video)\b[^>]+\bsrc\s*=\s*["']?https?:// """),
   ("html", r""" (?i)<(audio|video)\b[^>]+\bsrc\s*=\s*["']?https?:// """),
   ("wpl",  r""" <\?wpl \s+ version="1\.0" \s* \?> """),
   ("b4s",  r""" <WinampXML> """),   # http://gonze.com/playlists/playlist-format-survey.html
   ("jspf", r""" ^ \s* \{ \s* "playlist": \s* \{ """),
   ("asf",  r""" ^ \[Reference\] .*? ^Ref\d+= """),
   ("json", r""" "url": \s* "\w+:// """),
   ("gvp",  r""" ^gvp_version:1\.\d+$ """),
   ("href", r""" .* """),
386
387
388
389
390
391
392
393

394
395

396
397
398
399
400
401
402
386
387
388
389
390
391
392

393
394

395
396
397
398
399
400
401
402







-
+

-
+







        for r in rows:
            txt += "#EXTINF:-1,%s\n" % r["title"]
            txt += "%s\n" % http_fix_url(r["url"])
        return txt

    # PLS
    def pls(self, rows):
        txt = "[playlist]\n" + "numberofentries=%s\n" % len(rows)
        txt = "[playlist]\n" + "NumberOfEntries=%s\n" % len(rows)
        for i,r in enumerate(rows):
            txt += "File%s=%s\nTitle%s=%s\nLength%s=%s\n" % (i, r["url"], i, r["title"], i, -1)
            txt += "File%s=%s\nTitle%s=%s\nLength%s=%s\n" % (i+1, r["url"], i+1, r["title"], i+1, -1)
        txt += "Version=2\n"
        return txt

    # JSON (native lists of streamtuner2)
    def json(self, rows):
        return json.dumps(rows, indent=4)