Check-in [06fe0ef3db]
Overview
Comment: | Fix super slow requests download for Xiph YP.XML, due to automatic charset detected in requests.text access. Override encoding= now and manually .decode() known "utf-8" charset. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
06fe0ef3db9e94b15292026bebf0fbf7 |
User & Date: | mario on 2015-05-09 21:41:11 |
Other Links: | manifest | tags |
Context
2015-05-10
| ||
19:12 | Make AHTTP timeout= configurable. check-in: 4b035870ec user: mario tags: trunk | |
2015-05-09
| ||
21:41 | Fix super slow requests download for Xiph YP.XML, due to automatic charset detected in requests.text access. Override encoding= now and manually .decode() known "utf-8" charset. check-in: 06fe0ef3db user: mario tags: trunk | |
21:40 | Implement favicon live updating. Play event and download_all now pass the treestore, with row index, and pix_entry number (column index in liststore). Favicon module checks for downloaded images twice now, and updates PixBuf in ListStore. (Works for both single station view, and download_all.) check-in: aac4fcacbf user: mario tags: trunk | |
Changes
Modified ahttp.py from [060cc1e22c] to [5620882bf2].
︙ | ︙ | |||
84 85 86 87 88 89 90 | log.INFO("Content-Length", len(r.content) ) statusmsg and progress_feedback(statusmsg) if not content: return r elif binary: r = r.content else: | | > > > | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | log.INFO("Content-Length", len(r.content) ) statusmsg and progress_feedback(statusmsg) if not content: return r elif binary: r = r.content else: # Manually decode charset if encoding: r.encoding = encoding r = r.content.decode(encoding, errors='replace') # See requests isse #2359, automatic charset detection can be awfully slow else: r = r.text # clean statusbar statusmsg and progress_feedback() return r #-- Append missing trailing slash to URLs def fix_url(url): |
︙ | ︙ |
Modified channels/xiph.py from [141c9bdf5d] to [43c0a4353b].
︙ | ︙ | |||
144 145 146 147 148 149 150 | # categories. Extracting all streams{} at once would be worse. Yet # enabling this buffer method prevents partial reloading.. if conf.xiph_source != "buffy": buffy = [] # Get XML blob if not buffy: | | | 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | # categories. Extracting all streams{} at once would be worse. Yet # enabling this buffer method prevents partial reloading.. if conf.xiph_source != "buffy": buffy = [] # Get XML blob if not buffy: yp = ahttp.get(self.xml_url, encoding="utf-8", statusmsg="Brace yourselves, still downloading the yp.xml blob.") else: yp = "<none/>" self.status("Yes, XML parsing isn't much faster either.", timeout=20) for entry in xml.dom.minidom.parseString(yp).getElementsByTagName("entry"): buffy.append({ "title": x(entry, "server_name"), "url": x(entry, "listen_url"), |
︙ | ︙ | |||
519 520 521 522 523 524 525 | return str(e[0].childNodes[0].data) return "" # Convert bitrate string or "Quality \d+" to integer def bitrate(str): uu = re.findall("(\d+)", str) if uu: | | | 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | return str(e[0].childNodes[0].data) return "" # Convert bitrate string or "Quality \d+" to integer def bitrate(str): uu = re.findall("(\d+)", str) if uu: br = int(uu[0]) if br > 10: return int(br) else: return int(br * 25.6) else: return 0 # Extract mime type from text rx_fmt = re.compile("ogg|mp3|mp4|theora|nsv|webm|opus|mpeg") def guess_format(str): return rx_fmt.findall(str.lower() + "mpeg")[0] |