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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [91f8502978]

Overview
Comment:Detect all command names in player config, so that both `xterm` and `streamripper` are probed for existence. Use dict comprehension for plugin_meta lookup. Remove wrap_entry in favour of generic uikit.wrap().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 91f85029781999fddc46aa61fa2a138b254edd62
User & Date: mario on 2015-05-03 14:10:33
Other Links: manifest | tags
Context
2015-05-03
14:13
Add user plugin manager / download tool. Not very well integrated nor pretty. Still requires a restart, needs more hooks into config dialog. (Clean up previous plugin vboxes after installation. Auto-activation required to reimplement init loader. And channels.__path__ setup isn't yet injectable, because no plugin `order:` is honored by main/init, and pluginmanager2 would run too late for overrides.) check-in: 8e8a9dd020 user: mario tags: trunk
14:10
Detect all command names in player config, so that both `xterm` and `streamripper` are probed for existence. Use dict comprehension for plugin_meta lookup. Remove wrap_entry in favour of generic uikit.wrap(). check-in: 91f8502978 user: mario tags: trunk
14:09
Allow to override encoding= for .text results (requests can't detect it automatically for binary/json responses). check-in: 00ff8bac09 user: mario tags: trunk
Changes

Modified channels/configwin.py from [55e5421a33] to [227cef2658].

97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    # for each ListStore column id.)
    def list_edit(self, liststore, path, column, new_text):
        liststore[path][column] = new_text
        liststore[path][3] = self.app_bin_check(new_text)

    # return OK or CANCEL depending on availability of app
    def app_bin_check(self, v):
        m = re.search("(?![$(`])\S+", v)
        if m and m.group(0):
            if find_executable(m.group(0)):

                return gtk.STOCK_MEDIA_PLAY
            else:
                return gtk.STOCK_CANCEL
        else:
            return gtk.STOCK_NEW
        


    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = dict([(name, plugin_meta(module=name)) for name in module_list()])
        #for name in module_list():
        #    if name in self.channels:
        #        ls[name] = self.channels[name].meta
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)







|
|
|
>










|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    # for each ListStore column id.)
    def list_edit(self, liststore, path, column, new_text):
        liststore[path][column] = new_text
        liststore[path][3] = self.app_bin_check(new_text)

    # return OK or CANCEL depending on availability of app
    def app_bin_check(self, v):
        bin = re.findall(r"(?<![$(`%-])\b(\w+(?:-\w+)*)", v)
        if bin:
            bin = [find_executable(bin) for bin in bin]
            if not None in bin:
                return gtk.STOCK_MEDIA_PLAY
            else:
                return gtk.STOCK_CANCEL
        else:
            return gtk.STOCK_NEW
        


    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = {name: plugin_meta(module=name) for name in module_list()}
        #for name in module_list():
        #    if name in self.channels:
        #        ls[name] = self.channels[name].meta
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
            else:
                add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color )

        # spacer 
        add_( "filler_pl_"+name, gtk.HSeparator() )


    # Wrap entries/checkboxes with extra label, background, images, etc.
    def wrap_entry(self, id, w, label, color, image, align=1):
        if id:
            self.widgets[id] = w
        if label:
            if type(w) is gtk.Entry:
                w.set_width_chars(11)
            w = uikit.hbox(w, uikit.label(label))
        if image:
            pix = gtk.image_new_from_pixbuf(uikit.pixbuf(image))
            if pix:
                w = uikit.hbox(w, pix, exr=False)
        if color:
            w = uikit.bg(w, color)
        if align:
            a = gtk.Alignment()
            a.set_padding(0, 0, align, 0)
            a.add(w)
            w = a
        return w

    # Put config widgets into channels/features configwin notebooks
    def add_channels(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.plugin_options.pack_start(self.wrap_entry(id, w, label, color, image, align))

    # Separate tab for non-channel plugins
    def add_features(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.feature_options.pack_start(self.wrap_entry(id, w, label, color, image, align))

    # save config
    def save(self, widget):
        self.save_config(conf.__dict__, "config_")
        self.save_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_save"]]
        conf.save(nice=1)
        self.hide()








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



|



|









161
162
163
164
165
166
167




















168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
            else:
                add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color )

        # spacer 
        add_( "filler_pl_"+name, gtk.HSeparator() )























    # Put config widgets into channels/features configwin notebooks
    def add_channels(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.plugin_options.pack_start(uikit.wrap(self.widgets, id, w, label, color, image, align))

    # Separate tab for non-channel plugins
    def add_features(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.feature_options.pack_start(uikit.wrap(self.widgets, id, w, label, color, image, align))

    # save config
    def save(self, widget):
        self.save_config(conf.__dict__, "config_")
        self.save_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_save"]]
        conf.save(nice=1)
        self.hide()