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
|
# ยท 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"]
# 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='(.*?)'
""", re.X|re.S
)
ls = re.findall(rx_station, html)
log.DATA(ls)
r = [
dict(genre=cat, title=unhtml(title), playing=unhtml(descr), url=url)
for title,descr,url in ls
]
return r
|
<
|
<
|
|
|
>
>
>
>
>
|
>
>
>
|
|
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
# 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("""
<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)),
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
|