Check-in [7ef8a2b827]
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 |
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 | |
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 | 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: |
33 34 35 36 37 38 39 | 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. # |
85 86 87 88 89 90 91 | 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) |