1
2
3
4
5
6
7
8
9
10
11
12
|
1
2
3
4
5
6
7
8
9
10
11
12
|
-
+
|
# encoding: UTF-8
# api: streamtuner2
# title: OGG icon
# description: highlights OGG Vorbis and Opus stations with icons
# version: 0.1
# version: 0.2
# depends: uikit
# type: feature
# category: ui
# priority: extra
#
# Adds a Gtk icon for OGG Vorbis and Opus streams, which get displayed
# leftmost (to the genre) as state icon.
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
-
-
-
+
-
-
+
+
-
-
+
|
DhIYWENBgBVMQTgMUMoFCBwYGFhANIwDoYyBwICBGUIZIwADgxICMDAwIbEZGAWhAOw0ICUAdzKj
ILIHBEn1MQBjViBd1YYkTgAAAABJRU5ErkJggg=="""
}
# hook filter, set gtk icons
def init2(self, parent):
GenericChannel.postprocess_filters.append(self.row_icon)
#uikit.gtk.rc_parse_string(gtkrc)
#uikit.gtk.rc_reset_styles(uikit.gtk.settings_get_for_screen(uikit.gtk.gdk.screen_get_default()))
self.add_icons()
# adds gtk.IconFactory and one IconSet/Pixbuf each
def add_icons(self):
fact = uikit.gtk.IconFactory()
for stock_id, b64_png in self.png.items():
img = uikit.gtk.IconSet(uikit.uikit.pixbuf(b64_png))
fact.add(stock_id, img)
fact.add_default()
# filter: add `state` icon name depending on audio format
# postprocess_filter: add `state` icon name depending on audio format
def row_icon(self, row, channel):
if row.get("format") == "audio/ogg":
row["state"] = "ogg"
fmt = str(row.get("format", channel.audioformat))[6:]
if fmt in ("ogg", "opus"):
if row.get("format") == "audio/opus":
row["state"] = "opus"
row["state"] = fmt
return True
|