@@ -1,26 +1,25 @@ -# # encoding: utf-8 -# api: python +# api: streamtuner2 # title: favicon download # description: retrieves favicons for station homepages, plus utility code for display preparation # config: -# -# -# -# type: module -# -# -# This module fetches favicon.ico files and prepares .png images for each domain -# in the stations list. Homepage URLs are used for this. -# -# Files end up in: -# /home/user/.config/streamtuner2/icons/www.example.org.png -# -# Currently relies on Google conversion service, because urllib+PIL conversion -# method is still flaky, and a bit slower. Future version might use imagemagick. -# +# { name: favicon_google_first, type: bool, value: 1, description: "always use google favicon to png conversion service" } +# { name: favicon_google_only, type: bool, value: 1, description: "don't try other favicon retrieval methods, if google service fails" } +# { name: favicon_delete_stub , type: bool, value: 1, description: "delete placeholder favicons" } +# type: function +# category: ui +# priority: standard +# +# This module fetches favicon.ico files and prepares .png images for each domain +# in the stations list. Homepage URLs are used for this. +# +# Files end up in: +# /home/user/.config/streamtuner2/icons/www.example.org.png +# +# Currently relies on Google conversion service, because urllib+PIL conversion +# method is still flaky, and a bit slower. Future version might use imagemagick. always_google = 1 # use favicon service for speed only_google = 1 # if that fails, try our other/slower methods? delete_google_stub = 1 # don't keep placeholder images @@ -29,12 +28,11 @@ import os, os.path from compat2and3 import xrange, urllib import re from config import conf -try: from processing import Process as Thread -except: from threading import Thread +from threading import Thread import ahttp # ensure that we don't try to download a single favicon twice per session,