Check-in [63abbd2c17]
Overview
Comment: | New plugin: vtuner2 |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
63abbd2c1799504c0ecfc1798c8837fd |
User & Date: | mario on 2016-12-10 17:53:51 |
Other Links: | manifest | tags |
Context
2016-12-10
| ||
17:54 | Add statusbar message when converting check-in: 10d20f4306 user: mario tags: trunk | |
17:53 | New plugin: vtuner2 check-in: 63abbd2c17 user: mario tags: trunk | |
13:55 | Use `module = __name__` consistently for all plugins check-in: 88aac7840a user: mario tags: trunk | |
Changes
Added contrib/tuner2.py version [16795f1b01].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # encoding: UTF-8 # api: streamtuner2 # title: Tuner2.com # description: Your ears will know # url: http://tuner2.com/ # doc-provider: Media Tuners LLC # version: 0.1 # type: channel # category: radio # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADVElEQVR42mWTfUzUdRzH738f8IDBQWVPLu84rrsLCRRZmGXnMCtCgnt+APSOFOWoWzJFRBPhIK4LTsY1m6mtU4FVo7BsrXO52ajmJl62xXTpam5t/pfwu736HPQX/fHe9/v9fPb9PL7fqnyzj6XIe6aRPLMXjclHgSDX # 7JK7vI3N4m8k3+hGY87YfahWFTlYiiydk+zMXWun9KW97D84ykBsjGPDYziCJ1hb1SZ+G+oiO6qszIclWCmObAlyoO8MV6/NEo6M49gXZ9vOGBZvlOItHTxR5idHa80EcPI/6Lxk6+vwtUXZFehiNBrh0sdDjI2EqXUeYn3tUdaU76bQ4JYAOilVoNbZJXOmAhf5JT563vuIuzNfo0wf # Zv5KG3M3BklfP84v8Xpq9sQxbO7g8eIGCaB1ota6WV7kliA2tto7uZX6CWXMxmzbY4x4nuV0Vy3pVD9z31hIRcvwdk1Qsq2bPEmsUktGtfS7UmfFHxphfvZL/t77CDsrK8jNzEPfsDDQ+9fHSZ8pZvxIAM+hBCZLSCqWFlZoHRSsC9C4L4JySz77V1Gxbju5soFleis5az10dAwyN1HD # r91mBk8lqW4/y6NGqyR1odq4/R1mbqT456+fUXp19L5uIkvvEthRFzs4emyY+fEd3HtLzflPJwjGkhi3tMsKbQsrV30xdZm5+3dQbsZRIoV817eZZlsznQeO89ulKMpACXfa85lKnKP//DUs9iPScr1w5L8Af9y+TfreNMqPHh5MVjD//csoyQDKh8/xoHUZNw+WcuHCRaKTM9Q0HWaF # tkk4YpUKFkmnupxMovx5hfR0kHTCgPLBaub7NdztfopEeD89p3+gNfotla+8TY6seqE1Gbpal2GsMNG0wUMiNsDvn4e4+smbfDYYYOjdHlrCk9SEzrKpOU5llRPjRg9PV/oof2EXz7+6m03VftaYhYnLDVY0Ukpv9xAnv0qxtWmUDe4TlL4Rocz6PmW2YdZ7T1LVcgpL6Byu8EV8vVNU # VLeyWv+a8EBW8aRhB8HOYepbeqnfE6ZBTmtLHzY56wJiC/RQ5+/BGYzSFIpR/mKAHOHHQgsFpkaRqntRphkpCzQi5TyxF4p8C0wiYZH0QyLnh00uCsweFv4YF+X8L6KBLpzwswJYAAAAAElFTkSuQmCC # priority: optional # # A station list website featuring a map. (Uncovered via streamripper # homepage, which however mentions those streams not being recordable). # Most entries are AAC+. Else MP3. No Vorbis streams. # # Furthermore no homepages, and playing= field is only sometimes set. # Gotostationpage URLs don't work either. The website seems a bit # unmaintained. Yet still provides iPhone/Android apps. # # This plugin just fetches a single result list page per category. But # supports the live server search, as the result format is identical # and easy to extract. import re from config import * from channels import * import ahttp # vtuner2.com directory class tuner2 (ChannelPlugin): # control flags has_search = True audioformat = "audio/mpeg" titles = dict(listeners=False) base = "http://www.tuner2.com/" # Categories come straight from a <select> box def update_categories(self): html = ahttp.get("http://www.tuner2.com/") self.categories = re.findall('<option value="/index.html\?s=([\w\s]+)">[\w\s]+</option>', html) # Page fetching and row extraction def update_streams(self, cat, search=None): html = ahttp.get(self.base + "index.html?s=" + (cat or search)) # each entry in two <tr> blocks, but can be extracted without further ado ls = re.findall(""" <p\s+class="stations"><a\s+href="([^"]+)" .+? <font\s+class="stationname">([^<]+)</font> \s*\[(.+?)\] .+? (?:Now\s+playing:\s+<.+?>([^<]+)< .+?)? <p\sclass="stations">(AAC\+|MP3|OGG)<br.*?>(\d+) """, html, re.X|re.S) r = [] for e in ls: print e r.append(dict( url = unhtml(e[0]), title = unhtml(e[1]), genre = e[2], playing = unhtml(e[3]), format = mime_fmt(e[4]), listeners = to_int(e[5]) )) return r |