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

⌈⌋ branch:  streamtuner2


Check-in [0ca35b742b]

Overview
SHA1:0ca35b742b8f0b3470364d96f0a9a72c7f1c616c
Date: 2017-08-05 19:37:54
User: mario
Comment:delicast: updated for new radio listing format.
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2017-09-23
03:15
[6fd31bb3cc] Change default streamripper user agent. (user: mario, tags: trunk)
2017-08-05
19:37
[0ca35b742b] delicast: updated for new radio listing format. (user: mario, tags: trunk)
2017-07-04
14:31
[291090a1b2] Update documentation, plan on making liveradio a default plugin. (user: mario, tags: trunk)
Changes

Modified contrib/delicast.py from [1da3b76466] to [d83562106b].

1
2
3
4
5
6
7
8
9
10
11
12
13
..
15
16
17
18
19
20
21

22
23
24
25
26
27
28
29
30
31
32
..
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
# encoding: UTF-8
# api: streamtuner2
# title: Delicast
# description: directory of streaming media
# url: http://delicast.com/
# version: 0.5
# type: channel
# category: radio
# config: -
# png:
#    iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA
#    AmJLR0QA/4ePzL8AAAAHdElNRQffBB4UJAsX77G0AAAANUlEQVQY02OwQwMMdv/BAEUASCFEoAIIEZIEIGYjBCAUwpb/6O5ACEABGQJ2cFsQIlB3oAEA6iVo+vl+BbQA
#    AAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMDQtMzBUMjI6MzY6MDMrMDI6MDAFLUvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTA0LTMwVDIyOjM2OjAzKzAyOjAwdHDz
................................................................................
# priority: rare
# extraction-method: regex, action-handler
#
# Just a standard genre/country radio directory. Not very
# suitable for extraction actually, because it requires a
# second page request for uncovering the streaming URLs.
#

# This is done in row(), so only happens on playback. Which
# of course won't allow for exporting/bookmarking etc.
# And the server is somewhat unresponsive at times. Only one
# page (50 stations) is fetched.


import re
from config import *
from channels import *
import ahttp
import action
................................................................................
        pass


    # Fetch entries
    def update_streams(self, cat, search=None):

        ucat = re.sub("\W+", "-", cat.lower())


        html = ahttp.get("http://delicast.com/radio/" + ucat)




        r = []
        for tr in html.split("<tr>")[1:]:
            ls = re.findall("""
                "pStop\(\)" \s href="(.*?)">

                .*?


                pics/((?!play_triangle)\w+)
                .*?
                120%'>([^<>]+)</span>
            """, tr, re.X|re.S)
            if len(ls):
                homepage, country, title = ls[0]
                r.append(dict(
                    homepage = homepage,
                    playing = country,
                    title = unhtml(title),
                    url = "urn:delicast",
                    genre = cat,
             #      genre = unhtml(tags),





|







 







>
|
|
<
|







 







>
>
|
<
>
>
>

<
|
<
>

>
>
|


|

|







1
2
3
4
5
6
7
8
9
10
11
12
13
..
15
16
17
18
19
20
21
22
23
24

25
26
27
28
29
30
31
32
..
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
# encoding: UTF-8
# api: streamtuner2
# title: Delicast
# description: directory of streaming media
# url: http://delicast.com/
# version: 0.7
# type: channel
# category: radio
# config: -
# png:
#    iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA
#    AmJLR0QA/4ePzL8AAAAHdElNRQffBB4UJAsX77G0AAAANUlEQVQY02OwQwMMdv/BAEUASCFEoAIIEZIEIGYjBCAUwpb/6O5ACEABGQJ2cFsQIlB3oAEA6iVo+vl+BbQA
#    AAAldEVYdGRhdGU6Y3JlYXRlADIwMTUtMDQtMzBUMjI6MzY6MDMrMDI6MDAFLUvfAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDE1LTA0LTMwVDIyOjM2OjAzKzAyOjAwdHDz
................................................................................
# priority: rare
# extraction-method: regex, action-handler
#
# Just a standard genre/country radio directory. Not very
# suitable for extraction actually, because it requires a
# second page request for uncovering the streaming URLs.
#
# Audio URL lookup is done in urn_resolve action handler now,
# so only happens on playback. Which of course won't allow for
# exporting/bookmarking etc.

# Now fetches up to 5 pages (20 entries each).


import re
from config import *
from channels import *
import ahttp
import action
................................................................................
        pass


    # Fetch entries
    def update_streams(self, cat, search=None):

        ucat = re.sub("\W+", "-", cat.lower())
        html = ""
        for i in range(1, 5):
            add = ahttp.get("http://delicast.com/radio/" + ucat + ("" if i == 1 else "/%s" % i))

            html += add
            if not re.search("href='http://delicast.com/radio/%s/%s'" % (ucat, i+1), add):
                break
        r = []

        for ls in re.findall("""

                <b>\d+</b>\.
                .*?
                <a[^>]+href="(http[^"]+/radio/\w+/\w+)"
                .*?
                /pics/((?!play_tri)\w+)
                .*?
                120%'>([^<>]+)</span>
            """, html, re.X|re.S):
            if len(ls):
                homepage, country, title = ls
                r.append(dict(
                    homepage = homepage,
                    playing = country,
                    title = unhtml(title),
                    url = "urn:delicast",
                    genre = cat,
             #      genre = unhtml(tags),