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 | #-- categories
tags = []
for uu in rx_current.findall(html):
(href, title) = uu
tags.append(title)
self.categories = [
"top 100",
"radios",
"tags", tags
]
# download links from dmoz listing
def update_streams(self, cat, force=0):
entries = []
# top list
if cat == "top" or cat == "top 100":
html = http.get(self.base + "top")
rx_top = re.compile("""
<img[^>]+src="(http://imgjam.com/albums/[\w\d]+/\d+/covers/1.\d+.jpg)" |
<
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
| 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106 | #-- categories
tags = []
for uu in rx_current.findall(html):
(href, title) = uu
tags.append(title)
self.categories = [
"radios",
# "tags", tags
]
# download links from dmoz listing
def update_streams(self, cat, force=0):
entries = []
# return a static list for now
if cat == "radios":
entries = [
{"title": "Pop", "url": "http://streaming.radionomy.com/JamPop", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Rock", "url": "http://streaming.radionomy.com/JamRock", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Lounge", "url": "http://streaming.radionomy.com/JamLounge", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Electro", "url": "http://streaming.radionomy.com/JamElectro", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "HipHop", "url": "http://streaming.radionomy.com/JamHipHop", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "World", "url": "http://streaming.radionomy.com/JamWorld", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Jazz", "url": "http://streaming.radionomy.com/JamJazz", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Metal", "url": "http://streaming.radionomy.com/JamMetal", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Soundtrack", "url": "http://streaming.radionomy.com/JamSoundtrack", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Relaxation", "url": "http://streaming.radionomy.com/JamRelaxation", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
{"title": "Classical", "url": "http://streaming.radionomy.com/JamClassical", "playing": "", "format": "audio/mpeg", "homepage": "http://www.jamendo.com/en/radios"},
]
return entries
# top list
if cat == "top" or cat == "top 100":
html = http.get(self.base + "top")
rx_top = re.compile("""
<img[^>]+src="(http://imgjam.com/albums/[\w\d]+/\d+/covers/1.\d+.jpg)" |
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121 | "homepage": track,
"url": self.track_url(track_id, conf.jamendo_stream_format),
"favicon": self.cover(cover),
"format": self.stream_mime(),
})
# static
elif cat == "radios":
rx = '>(\w+[-/\s]*\w+)</a>.+?/(get2/stream/track/m3u/radio_track_inradioplaylist/[?]order=numradio_asc&radio_id=\d+)"'
for uu in re.findall(rx, http.get(self.base + "radios")):
(name, url) = uu
entries.append({
"title": name,
"url": self.homepage,
"homepage": self.base + "radios",
})
# genre list
else:
html = http.get(self.base + "tag/" + cat)
rx_tag = re.compile("""
<a\s+title="([^"]+)\s*-\s*([^"]+)"
\s+href="(http://www.jamendo.com/\w+/album/(\d+))"\s*> |
<
<
<
<
<
<
<
<
<
<
<
<
<
| 116
117
118
119
120
121
122
123
124
125
126
127
128
129 | "homepage": track,
"url": self.track_url(track_id, conf.jamendo_stream_format),
"favicon": self.cover(cover),
"format": self.stream_mime(),
})
# genre list
else:
html = http.get(self.base + "tag/" + cat)
rx_tag = re.compile("""
<a\s+title="([^"]+)\s*-\s*([^"]+)"
\s+href="(http://www.jamendo.com/\w+/album/(\d+))"\s*> |