Check-in [7ef8a2b827]
Overview
Comment: | Add generic bitrate filter plugin, move functionality out of xiph channel. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
7ef8a2b827fc12f9008af0ff46f27e99 |
User & Date: | mario on 2015-05-12 20:05:52 |
Other Links: | manifest | tags |
Context
2015-05-12
| ||
22:17 | Add plugin defaults (for newly added options, but previously active modules) in any case when starting with -D flag. Save settings.json in json.dumps(sort_keys=True) mode. check-in: 3497339549 user: mario tags: trunk | |
20:05 | Add generic bitrate filter plugin, move functionality out of xiph channel. check-in: 7ef8a2b827 user: mario tags: trunk | |
20:03 | Remove plugin #color: check-in: b4558a4599 user: mario tags: trunk | |
Changes
Added channels/filter_bitrate.py version [123128ab48].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 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 | # encoding: UTF-8 # api: streamtuner2 # title: Filter Bitrate # description: Cleans up low-quality entries from all station lists. # version: 0.1 # type: filter # category: audio # priority: optional # config: # { name: min_bitrate_mp3, value: 32, type: select, select: "32|48|64|80|96|112|128|144|160", description: Filter MP3 streams with lesser audio quality. } # [ name: min_bitrate_ogg, value: 32, type: select, select: "32|48|64|80|96|112|128|144|160", description: OggVorbis/AAC sound ok with slightly lower bitrates still. ] # hooks: - # # Plugin that filters radio stations on bitrate (audio quality). # Anything below 64 kbit/s often sounds awful for MP3 streams. # While AAC or Ogg Vorbis might still be acceptable sometimes. # # This functionality was previously just implemented for the Xiph # plugin. It's now available as generic filter for all channels. # Beware that some channels provide more entries with low bitrates, # thus might appear completely empty. from config import * import channels # Filter streams by bitrate class filter_bitrate(): meta = plugin_meta() module = "filter_bitrate" # Hijack GenericChannel.prepare def __init__(self, parent): channels.GenericChannel.postprocess_filters.append(self.filter_rows) # filter bitrate def filter_rows(self, row): b = int(row.get("bitrate", 0)) if b <= 10: return True elif b < int(conf.min_bitrate_mp3): return False else: return True |
Modified channels/xiph.py from [43c0a4353b] to [8fa7c91382].
1 2 3 4 5 6 7 8 9 | # encoding: UTF-8 # api: streamtuner2 # title: Xiph.org # description: ICEcast radios. Scans per JSON API, slow XML, or raw directory. # type: channel # url: http://dir.xiph.org/ # version: 0.5 # category: radio # config: | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # encoding: UTF-8 # api: streamtuner2 # title: Xiph.org # description: ICEcast radios. Scans per JSON API, slow XML, or raw directory. # type: channel # url: http://dir.xiph.org/ # version: 0.5 # category: radio # config: # { name: xiph_source, value: web, type: select, select: "cache=JSON cache srv|xml=Clunky XML blob|web=Forbidden fruits", description: "Source for station list extraction." } # priority: standard # png: # iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAg5JREFUOI2lk1tIE2AUx3+7CG1tlmlG1rSEHrKgEUF7yO40taQiRj10I4qKkOaT4hIUItuTkC8hpJAQtJCICrFpzEKw # h61eQorGNBOTzbEt16ZrnR5Wq3mZD/3heziX//983znngyyov+eSbHEA5WKBhs4BKVy9gsqajqwiCwo0dA5IQX5u2s4moliMPPV1nCeDzxgNBFDHE2wsKMPzsGVefobjcnO7RMfeMuL341ZBrNEGRmPqqjdvsbbf # w7irO4Oj+rdywNNNucmERsLUVndR8uYRU13PCew6hpgP8W02xMpIsik++qk5oweW6y3yob8WnXacZDKJWh1Cp4OtRUHsh19TUlUGViv09RGqKAenU5QnLKm+rK88LjgcUnxmr/h8iNO5XYJBRAQZ/qiVeptGWjty # 5cClDWLwugQRIRiU5UdPCoD6S89jhV6pks9WG6fuwtBtF5v72vC1v+B86SsM+jD56hjnyiM0lRrAbofeXjQJLdE/78jbXSU5166I6f5VeeDdKdq6GtlSd0QkVU+8XsQhlt9W6izbZ5aMKWgtp2WT/yUHd0xSYU7i |
︙ | ︙ | |||
33 34 35 36 37 38 39 | # slow, then slices out genres. No search. With the secret # "buffy" mode keeps all streams buffered. # # → "Forbidden Fruits" extracts from dir.xiph.org HTML pages, # with homepages and listener/max infos available. Also # enables live server searching. # | | < | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # slow, then slices out genres. No search. With the secret # "buffy" mode keeps all streams buffered. # # → "Forbidden Fruits" extracts from dir.xiph.org HTML pages, # with homepages and listener/max infos available. Also # enables live server searching. # # The previous bitrate filter is now a separate plugin, but # available for all channels. from config import * from uikit import uikit import ahttp from channels import * import xml.dom.minidom |
︙ | ︙ | |||
85 86 87 88 89 90 91 | r = self.from_json_cache(cat, search) elif conf.xiph_source in ("xml", "buffy"): log.PROC("Xiph mode: xml.dom.minidom to traverse yp.xml") r = self.from_yp_xml(cat, search) else: log.PROC("Xiph mode: extract from dir.xiph.org HTML listings") r = self.from_raw_html(cat, search) | < < < < | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | r = self.from_json_cache(cat, search) elif conf.xiph_source in ("xml", "buffy"): log.PROC("Xiph mode: xml.dom.minidom to traverse yp.xml") r = self.from_yp_xml(cat, search) else: log.PROC("Xiph mode: extract from dir.xiph.org HTML listings") r = self.from_raw_html(cat, search) return r # Retrieve partial stream list from api.include-once.org cache / JSON API wrapper |
︙ | ︙ |