# api: streamtuner2# title: Jamendo# description: A license-free music collection and artist hub.# type: channel# version: 2.2# category: radio# depends: json# priority: default## Now utilizes the Jamendo /v3.0/ API.## Radio station lists are fixed for now. Querying the API twice per station# doesn't seem overly sensible.## Albums and Playlists are limited to 200 entries. Adding a cursor is# feasible however.## Tracks are queried by genre, where currently there's just a small built-in# tag list in ST2.### The v3.0 streaming URLs don't seem to work. Therefore some /get2 URLs will# be used.#
"""
# With the new shallow <td> lists it doesn't make much sense to use
# the pyquery DOM traversal. There aren't any sensible selectors to
# extract values; it's just counting the tags.
# And there's a bug in PyQuery 1.2.4 and CssSelector. So make two
# attempts, alternate between regex and DOM; user preference first.
entries = [] use_regex = not conf.get("pyquery") or not pq
retry = 2
while retry:
while retry and not entries:
retry -= 1
try:
if use_regex:
return self.with_regex(html)
entries = self.with_regex(html)
else:
return self.with_dom(html)
entries = self.with_dom(html)
except Exception as e:
use_regex ^= 1 __print__(dbg.ERR, e)
use_regex ^= 1 return [] return entries
# Extract using regex
def with_regex(self, html):
__print__(dbg.PROC, "channels.shoutcast.update_streams: regex scraping mode")
rx_stream = re.compile(
"""