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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [2ac5815def]:

To Artifact [f6c4524b4e]:


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# Punkcast is no longer updated. This plugin is kept for
# historic reasons. It was one of the default streamtuner1
# channels.


import re
import ahttp as http
from config import conf
import action
from channels import *
from config import *


# basic.ch broadcast archive







|







20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#
# Punkcast is no longer updated. This plugin is kept for
# historic reasons. It was one of the default streamtuner1
# channels.


import re
import ahttp
from config import conf
import action
from channels import *
from config import *


# basic.ch broadcast archive
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
            <a\shref="(http://punkcast.com/(\d+)/index.html)">
            .*? ALT="([^<">]+)"
        """, re.S|re.X)

        entries = []
        
        #-- all from frontpage
        html = http.get("http://www.punkcast.com/")
        for uu in rx_link.findall(html):
            (homepage, id, title) = uu
            entries.append({
                    "genre": "%s" % id,
                    "title": title,
                    "playing": "PUNKCAST #%s" % id,
                    "format": "audio/mpeg",
                    "url": "none:",
                    "homepage": homepage,
                    "img": "http://punkcast.com/%s/PUNK%s.jpg" % (id, id) if conf.punkcast_img else None,
            })

        # done    
        return entries


    # special handler for play
    def play(self, row):
    
        rx_sound = re.compile("""(http://[^"<>]+[.](mp3|ogg|m3u|pls|ram))""")
        html = http.get(row["homepage"])
        
        # look up ANY audio url
        for uu in rx_sound.findall(html):
            log.DATA( uu )
            (url, fmt) = uu
            action.play(url, self.mime_fmt(fmt), "srv")
            return
        
        # or just open webpage
        action.browser(row["homepage"])








|




















|











52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
            <a\shref="(http://punkcast.com/(\d+)/index.html)">
            .*? ALT="([^<">]+)"
        """, re.S|re.X)

        entries = []
        
        #-- all from frontpage
        html = ahttp.get("http://www.punkcast.com/")
        for uu in rx_link.findall(html):
            (homepage, id, title) = uu
            entries.append({
                    "genre": "%s" % id,
                    "title": title,
                    "playing": "PUNKCAST #%s" % id,
                    "format": "audio/mpeg",
                    "url": "none:",
                    "homepage": homepage,
                    "img": "http://punkcast.com/%s/PUNK%s.jpg" % (id, id) if conf.punkcast_img else None,
            })

        # done    
        return entries


    # special handler for play
    def play(self, row):
    
        rx_sound = re.compile("""(http://[^"<>]+[.](mp3|ogg|m3u|pls|ram))""")
        html = ahttp.get(row["homepage"])
        
        # look up ANY audio url
        for uu in rx_sound.findall(html):
            log.DATA( uu )
            (url, fmt) = uu
            action.play(url, self.mime_fmt(fmt), "srv")
            return
        
        # or just open webpage
        action.browser(row["homepage"])