Check-in [12e7646cbf]
Comment: | Fix URL patching (after actually testing it). And provide fallback for image resizing (.thumbnail in PIL 2.3.0 is broken). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
12e7646cbfbf7b222c94a0d41ca7ff7a |
User & Date: | mario on 2015-05-10 22:34:44 |
Other Links: | manifest | tags |
2015-05-11
| ||
11:17 | Disable iTunes plugin, no alternative resource. check-in: 901ee2c6b2 user: mario tags: trunk | |
2015-05-10
| ||
22:34 | Fix URL patching (after actually testing it). And provide fallback for image resizing (.thumbnail in PIL 2.3.0 is broken). check-in: 12e7646cbf user: mario tags: trunk | |
22:11 | Move internal commentary out of plugin description block. Try/Catch processing failures in update_rows() loop. Use quieter=1 option for image downloads. Reimplement custom base_url+href favicon patching. check-in: 4e95040e40 user: mario tags: trunk | |
Modified channels/favicon.py from [453360923b] to [7cf3ceafbb].
1 2 3 4 5 6 7 8 9 10 11 | 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 | - + + + | # encoding: utf-8 # api: streamtuner2 # title: Favicons # description: Display station favicons/logos. Instantly download them when ▸playing. # config: # { name: favicon_google_first, type: bool, value: 1, description: "Prefer faster Google favicon to PNG conversion service." } # { name: favicon_delete_stub , type: bool, value: 1, description: "Don't accept any placeholder favicons." } # [ main-name: google_homepage ] # [ main-name: load_favicon ] # type: feature # category: ui |
245 246 247 248 249 250 251 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | - + + - + + + + | def store_image(imgdata, fn, resize=None): # Convert accepted formats -- even PNG for filtering now if re.match(br'^(.PNG|GIF\d+|.{0,15}JFIF|\x00\x00\x01\x00|.{0,255}<svg[^>]+svg)', imgdata): try: # Read from byte/str image = Image.open(BytesIO(imgdata)) |
325 326 327 328 329 330 331 332 333 | 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 | + - + - - + + | pair = re.findall(r""" \b(rel|href) \s*=\s* ["']? ([^<>"']+) ["']? """, link, re.X) pair = { name: val for name, val in pair } for name in ("shortcut icon", "favicon", "icon", "icon shortcut"): if name == pair.get("rel", "ignore").lower() and pair.get("href"): href = pair["href"].replace("&", "&") # unhtml() break # Patch URL together log.DATA(url, href) if re.match("^https?://", href): # absolute URL return href |