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

โŒˆโŒ‹ โŽ‡ branch:  streamtuner2


Check-in [ce7292f416]

Overview
Comment:filtermusic: update for current station list HTML, add favicons + homepages
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ce7292f416b9d811f8137a8663fe6ff8569700c3
User & Date: mario on 2022-02-20 05:57:21
Other Links: manifest | tags
Context
2022-02-20
06:31
rcast: updated for current HTML check-in: fd54f9f9a7 user: mario tags: trunk
05:57
filtermusic: update for current station list HTML, add favicons + homepages check-in: ce7292f416 user: mario tags: trunk
2022-02-17
06:17
Migrate to JSON api check-in: a140e97c02 user: mario tags: trunk
Changes

Modified channels/filtermusic.py from [48695406f2] to [c46bb50050].

1
2
3
4
5

6
7
8
9
10
11
12
1
2
3
4

5
6
7
8
9
10
11
12




-
+







# encoding: UTF-8
# api: streamtuner2
# title: filtermusic
# description: Daily refreshed list of electronic+dance music streams.
# version: 0.2
# version: 0.3
# type: channel
# url: http://filtermusic.net/
# category: radio
# config: -
# png:
#   iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAB3RJTUUH3wQeBA4mIX2CmQAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAGISURBVCjPnVI9SyNRFD333slMMhrNjBJU0FSLIlovy6IWbmelhRJ/gI2lkMXfIOwv2K38qizstFCs3B+wLFhoIfiR1cggkXzMvHnPIiG6
#   GkE8zYXLPfe8c94F2oAkk7CHHLIIb4AAEIlkcuJmARr8OTxW+pKe9l6PSqN0jOe9hd3014J09tdP96SHSLh8GKirsM1+TvnZ5RN/buO5ItvcUH4BCwC7vex0Vf5stroGMKFu+3omKymdfUTMrs9uDyczAHzfz+VyIpwgu1u8NGccSjbFUyOz/vyOUVVoDZbq3+1gd6lQWMnn85PTEzPR4mdnKjLhrS6uBasArNrZ3t36N29u6/7ge/1038QRECul
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43

44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63





64
65
66
67
68



69
70





71
72
73
24
25
26
27
28
29
30

31
32
33
34
35
36
37
38
39
40
41

42
43
44
45
46
47
48
49
50
51
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







-











-
+










-






-
-
-
+
+
+
+
+





+
+
+
-
-
+
+
+
+
+



#  ยท No homepage listings, and genre details spotty (so omitted).


from config import *
from channels import *
import ahttp
import re
import xml.etree.ElementTree as ET


# filtermusic.net
class filtermusic (ChannelPlugin):

    # control attributes
    has_search = False
    listformat = "srv"
    audioformat = "audio/mpeg"
    titles = dict(listeners=False, bitrate=False, playing="Description")
    categories = ["Top Radio Stations", "House / Dance", "Lounge Grooves", "Rock / Metal", "Breaks / Drum'n'Bass", "Various / Independent", "Downtempo / Ambient", "60's / 70's / 80's / 90's", "Hits / Mainstream", "Electronica / Industrial", "Techno / Trance", "HipHop / RnB", "Classical", "Eclectic", "Funk / Soul / Disco", "Reggae / Dub / Dancehall", "International / Ethnic", "Jazz", "Latin / Salsa / Tango"]

    img_resize = 32

    # static
    def update_categories(self):
        pass


    # Refresh station list
    def update_streams(self, cat, search=None):
        return self.from_web(cat)


    # Extract directly from filtermusic.net html
    def from_web(self, cat):
        ucat = re.sub("\W+", "-", cat.lower().replace("'", ""))
        html = ahttp.get("http://filtermusic.net/{}".format(ucat))
        
        rx_station = re.compile("""
               <h4>((?!Support\s+filtermusic).*?)</h4>\s*
               <p>(.*?)</p>.*?
               data-listen='(.*?)'
               <article [^>]+ about="/([\w\-]+)" .*?
               <img [^>]+ src="(http.+?)" .*?
               data-listen="(.*?)" .*?
               <h3[^>]*>(.+?)</h3> .*?
               <p>(.*?)</p>
            """, re.X|re.S
        )
        ls = re.findall(rx_station, html)
        log.DATA(ls)
        r = [
            dict(
                genre=cat,
                title=unhtml(strip_tags(title)),
            dict(genre=cat, title=unhtml(title), playing=unhtml(descr), url=url)
            for title,descr,url in ls
                playing=unhtml(strip_tags(descr)),
                img=img,
                homepage="https://filtermusic.net/{}".format(id), id=id, url=url
            )
            for id, img, url, title, descr in ls
        ]
        return r