Check-in [b0e9e031d9]
Overview
| Comment: | Another radio station directory: listenlive.eu |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
b0e9e031d927c09cffdf34bdd05b7bd9 |
| User & Date: | mario on 2015-05-07 01:16:00 |
| Other Links: | manifest | tags |
Context
|
2015-05-07
| ||
| 01:17 | Add windows media guide radio lists (ASX). Fixed action module to extract with case-insensitve matches for that playlist format. (It's not really XML after all.) check-in: 7c085d54f9 user: mario tags: trunk | |
| 01:16 | Another radio station directory: listenlive.eu check-in: b0e9e031d9 user: mario tags: trunk | |
| 01:15 | Compressed GLRP csv playlist. check-in: 48e681e054 user: mario tags: trunk | |
Changes
Added contrib/listenlive.py version [98eef5d460].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 84 85 86 |
# encoding: UTF-8
# api: streamtuner2
# title: ListenLive
# description: European radio stations streaming live on the internet
# url: http://listenlive.eu/
# version: 0.0
# type: channel
# category: radio
# config: -
# png:
# iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAARVBMVEWdHBWSg1Cbj1mnmF6jn5GuomajpaCrqYu3qmy0roi6
# r3rAsW25tae2t7HCvKfPv3rOw4zKxrfJyMDTzaXUz7LW1s7g4t727CdZAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJ
# cEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQffBQcAMynMUk7PAAAAkElEQVQY01VP2xbDIAizUq0WGS1e/v9TB9qdbXlLICE4
# Z9g8gN/cB1tAVmB4JI98tdbqlZJ/eBWS3u8jTCVx7RRNKEdKzgFffVBUfpdyItjCGJG6iCqZk0Nuo6tDiIp6cAqiDokx7hZi
# Fo3QBSp7xmChOhSxjNfJsM5OaKadncWWkL9V/6rrc7Ceg59/vWLRN2yqCjHMvARcAAAAAElFTkSuQmCC
# png-orig: https://openclipart.org/detail/148465/1-euro
# priority: extra
#
# And another radio directory, primarily collecting euro
# stations, mixed genres, and grouping by country.
#
# Also available:
# http://www.australianliveradio.com/
# http://www.nzradioguide.co.nz/
import re
from config import *
from channels import *
import ahttp
# listenlive.eu
class listenlive (ChannelPlugin):
# control flags
has_search = False
listformat = "srv"
audioformat = "mp3"
titles = dict(listeners=False, playing="Location")
categories = []
base = "http://listenlive.eu/{}.html"
# short list of categories
def update_categories(self):
html = ahttp.get("http://listenlive.eu/")
ls = re.findall(r"""b.gif"[\s/]*>\s+<a\s+href="(\w+).html">([^<>]+)</a>""", html)
self.catmap = {title: link for link, title in ls}
self.categories = [title for link, title in ls]
# Fetch entries
def update_streams(self, cat, search=None):
r = []
# split into table rows
html = ahttp.get(self.base.format(self.catmap[cat]), encoding="utf-8")
for tr in html.split("<tr>"):
# extract fields
ls = re.findall("""
<a\s+href="([^<">]+)"> # homepage
<b>([^<>]+)</b> # title
.*? <td>([^<>]+)</td> # location
.+ alt="(\w+)" # format
.+ <a\s+href="([^<">]+)"> # url
(\d+) # bitrate
""", tr, re.X|re.S)
# assemble into rows
if len(ls) and len(ls[0]) == 6:
homepage, title, location, format, url, bitrate = ls[0]
genre = re.findall("<td>([^<>]+)</td>\s</tr>", tr)
r.append(dict(
homepage = homepage,
playing = location,
title = unhtml(title),
url = url,
genre = genre[0] if genre else cat,
bitrate = int(bitrate),
format = self.mime_fmt(format),
))
return r
|