Check-in [c1b74b649f]
Overview
| Comment: | Basic channel plugin for delicast.com |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
c1b74b649f91809b38ad8b5834158400 |
| User & Date: | mario on 2015-04-30 20:32:17 |
| Other Links: | manifest | tags |
Context
|
2015-04-30
| ||
| 20:33 | Temporarily remove iCast plugin from packaging, but add dirble and filtermusic. check-in: 9b4d29f9f7 user: mario tags: trunk | |
| 20:32 | Basic channel plugin for delicast.com check-in: c1b74b649f user: mario tags: trunk | |
| 20:31 | Manually replace `nbsp;` in entity_decode check-in: 82e9e14f3b user: mario tags: trunk | |
Changes
Added contrib/delicast.py version [fbc4fdee55].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 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 80 81 82 83 |
# encoding: UTF-8
# api: streamtuner2
# title: Delicast
# description: directory of streaming media
# url: http://delicast.com/
# version: 0.1
# type: channel
# category: radio
# config: -
# png:
# priority: rare
#
# 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
# Delayed streaming URL discovery
class delicast (ChannelPlugin):
# control flags
has_search = False
listformat = "srv"
audioformat = "mp3"
titles = dict(listeners=False, bitrate=False, playing="Location")
base = "http://delicast.com/"
categories = ["60s", "70s", "80s", "90s", "Alternative", "Blues", "Chillout", "Christian", "Classical", "Community", "Country", "Culture", "Dance", "Disco", "Easy listening", "Electronic", "Folk", "Funk", "Gospel", "Hiphop", "House Indie", "Information", "Jazz", "Latin", "Lounge", "Love", "Metal", "Oldies", "Pop", "R n b", "Reggae", "Rock", "Romantic", "Soul", "Sports", "Student", "Talk", "Techno", "Trance", "Urban", "World music"]
# static
def update_categories(self):
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)
print ls
if len(ls):
homepage, country, title = ls[0]
r.append(dict(
homepage = homepage,
playing = country,
title = self.entity_decode(title).strip(),
url = "urn:delicast",
genre = cat,
# genre = self.entity_decode(self.strip_tags(tags)).strip(),
))
return r
# Update `url`
def row(self):
r = ChannelPlugin.row(self)
if r.get("url") == "urn:delicast":
html = ahttp.get(r["homepage"])
ls = re.findall("^var url = \"(.+)\";", html, re.M)
r["url"] = ls[0]
return r
|