DELETED channels/basicch.py Index: channels/basicch.py ================================================================== --- channels/basicch.py +++ channels/basicch.py @@ -1,305 +0,0 @@ - -# api: streamtuner2 -# title: basic.ch channel -# -# -# -# Porting ST1 plugin senseless, old parsing method wasn't working any longer. Static -# realaudio archive is not available anymore. -# -# Needs manual initialisation of categories first. -# - - -import re -import ahttp as http -from config import conf -from channels import * -from xml.sax.saxutils import unescape - - - - - - - - - - - - - - -# basic.ch broadcast archive -class basicch (ChannelPlugin): - - # description - title = "basic.ch" - module = "basicch" - homepage = "http://www.basic.ch/" - version = 0.3 - base = "http://basic.ch/" - - # keeps category titles->urls - catmap = {} - categories = [] #"METAMIX", "reload category tree!", ["menu > channel > reload cat..."]] - #titles = dict(listeners=False, bitrate=False) - - - # read previous channel/stream data, if there is any - def cache(self): - ChannelPlugin.cache(self) - # catmap - cache = conf.load("cache/catmap_" + self.module) - if (cache): - self.catmap = cache - pass - - - # refresh category list - def update_categories(self): - - html = http.get(self.base + "shows.cfm") - - rx_current = re.compile(r""" - ([^<>]+) - \s*([^<>]+)
]+)">(METAMIX[^<]+) - \s+([^<>]+)
(http://[^<">]+)\s* - ([^<>]+)\s* - ([^<>]+) - """, re.S|re.X) - - entries = [] - - #-- update categories first - if not len(self.catmap): - self.update_categories() - - #-- frontpage mixes - if cat == "METAMIX": - for uu in rx_metamix.findall(http.get(self.base)): - (url, title, genre) = uu - entries.append({ - "genre": genre, - "title": title, - "url": url, - "format": "audio/mp3", - "homepage": self.homepage, - }) - - #-- pseudo entry - elif cat=="shows": - entries = [{"title":"shows","homepage":self.homepage+"shows.cfm"}] - - #-- fetch playlist.xml - else: - - # category name "Xsound & Ymusic" becomes "Xsoundandymusic" - id = cat.replace("&", "and").replace(" ", "") - id = id.lower().capitalize() - - catinfo = self.catmap.get(cat, {"id":"", "genre":""}) - - # extract - html = http.get(self.base + "playlist/" + id + ".xml") - for uu in rx_playlist.findall(html): # you know, we could parse this as proper xml - (url, artist, title) = uu # but hey, lazyness works too - entries.append({ - "url": url, - "title": artist, - "playing": title, - "genre": catinfo["genre"], - "format": "audio/mp3", - "homepage": self.base + "shows.cfm?showid=" + catinfo["id"], - }) - - # done - return entries - - - - - - - - - - - -# basic.ch broadcast archive -class basicch_old_static: #(ChannelPlugin): - - # description - title = "basic.ch" - module = "basicch" - homepage = "http://www.basic.ch/" - version = 0.2 - base = "http://basic.ch/" - - # keeps category titles->urls - catmap = {} - - - # read previous channel/stream data, if there is any - def cache(self): - ChannelPlugin.cache(self) - # catmap - cache = conf.load("cache/catmap_" + self.module) - if (cache): - self.catmap = cache - pass - - - # refresh category list - def update_categories(self): - - html = http.get(self.base + "downtest.cfm") - - rx_current = re.compile(""" - href="javascript:openWindow.'([\w.?=\d]+)'[^>]+> - (\w+[^<>]+)(\w+[^<>]+)]+)" - """, re.S|re.X) - - rx_archive = re.compile(""" - href="javascript:openWindow.'([\w.?=\d]+)'[^>]+>.+? - color="000000">(\w+[^<>]+)(\w+[^<>]+)(\d\d\.\d\d\.\d\d).+? - href="(http://[^">]+|/ram/\w+.ram)"[^>]*>([^<>]+) - .+? (>(\w+[^<]*)