Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ branch:  streamtuner2


Check-in [9933677f41]

Overview
Comment:Shorten format comparison in postprocess_filter, remove original *gtkrc* stock item binding.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9933677f41e9e9f91f48e067ef1da211a325f8ef
User & Date: mario on 2017-02-14 16:33:53
Other Links: manifest | tags
Context
2017-02-14
17:52
Minor fix for extraction regexp (http: prefix to station urls). check-in: b3defb1227 user: mario tags: trunk
16:33
Shorten format comparison in postprocess_filter, remove original *gtkrc* stock item binding. check-in: 9933677f41 user: mario tags: trunk
2017-02-13
21:55
New plugin: Vorbis and Opus icons for OGG streams check-in: 71b6a7785e user: mario tags: trunk
Changes

Modified c/plugins/oggicon.py from [7236873b7f] to [50ddd1a129].

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
# 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.




|







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.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
            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
    def row_icon(self, row, channel):
        if row.get("format") == "audio/ogg":
            row["state"] = "ogg"
        if row.get("format") == "audio/opus":
            row["state"] = "opus"
        return True








<
<










|

|
|
<
|


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)


        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()

    # postprocess_filter: add `state` icon name depending on audio format
    def row_icon(self, row, channel):
        fmt = str(row.get("format", channel.audioformat))[6:]
        if fmt in ("ogg", "opus"):

            row["state"] = fmt
        return True