30
31
32
33
34
35
36
37
38
39
40
41
42
43
44 | 30
31
32
33
34
35
36
37
38
39
40
41
42
43 |
-
|
import gtk
from uikit import uikit, ver as gtk_ver
from config import *
import ahttp
import action
import favicon
import os.path
import xml.sax.saxutils
import re
import copy
import inspect
|
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397 | 370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391 |
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
| # state icon: INFO or DELETE
if (not row.get("state")):
if row.get("favourite"):
streams[i]["state"] = gtk.STOCK_ABOUT
if conf.retain_deleted and row.get("deleted"):
streams[i]["state"] = gtk.STOCK_DELETE
# favicons?
if conf.show_favicons:
# entry provides its own image
if "img" in row:
favicon_url = row["img"]
streams[i]["favicon"] = favicon.localcopy(favicon_url)
# Favicons? construct local cache filename, basically reimplements favicon.row_to_fn()
if conf.show_favicons and "favicon" in self.parent.features:
url = row.get("img") or row.get("homepage")
if url:
# Normalize by stripping proto:// and non-alphanumeric chars
url = re.sub("[^\w._-]", "_", re.sub("^\w+://|/$", "", url.lower()))
streams[i]["favicon"] = "{}/icons/{}.png".format(conf.dir, url)
# get actual homepage favicon.png
elif "homepage" in row:
homepage_url = row.get("homepage")
# check for availability of PNG file, inject local icons/ filename
if homepage_url and favicon.available(homepage_url):
streams[i]["favicon"] = favicon.file(homepage_url)
return streams
# data preparations directly after reload
#
# - drop shoutcast homepage links
# - or find homepage name in title |