Index: channels/internet_radio_org_uk.py ================================================================== --- channels/internet_radio_org_uk.py +++ channels/internet_radio_org_uk.py @@ -1,12 +1,12 @@ # # api: streamtuner2 -# title: Internet-Radio.org.uk +# title: Internet-Radio.com # description: Broad list of webradios from all genres. # type: channel # category: radio -# version: 0.1 +# version: 0.2 # priority: standard # # # Might become new main plugin # Index: config.py ================================================================== --- config.py +++ config.py @@ -20,10 +20,13 @@ import json import gzip import platform +# export symbols +__all__ = ["conf", "__print__", "dbg"] + #-- create a single instance of config object conf = object() Index: gtk2.xml ================================================================== --- gtk2.xml +++ gtk2.xml @@ -9,10 +9,970 @@ + + + 565 + False + streamtuner settings + center + True + /usr/share/pixmaps/streamtuner2.png + + + + True + False + 0 + none + + + 500 + True + False + + + 520 + True + True + True + True + + + True + True + automatic + automatic + + + True + False + 15 + none + + + True + False + + + True + False + 0 + <b>Audio player</b> and <b>recording</b> applications. + True + + + True + True + 0 + + + + + True + True + automatic + automatic + + + 0 + 200 + True + True + 5 + config_play + False + True + 0 + 8 + both + + + 10 + 125 + Format + True + + + + + + 2 + 0 + + + + + + + 10 + 300 + Application + + + + + + 2 + 1 + + + + + + + + + True + True + 1 + + + + + True + False + 0.019999999552965164 + 0.49000000953674316 + Use <a href="http://fossil.include-once.org/streamtuner2/wiki?name=player">placeholders</a> such as <b>%pls</b> for Shoutcast playlists, +or pass <b>%m3u</b> for players that expect mp3 playlist files, +and <b>%srv</b> to use direct streaming URLs. + True + True + + + True + True + 2 + + + + + + + + + + + True + False + Player + + + False + + + + + True + True + automatic + automatic + + + True + False + 15 + none + + + True + False + + + True + False + 0.019999999552965164 + 9 + Display + + + + + + + True + True + 0 + + + + + Display favicons for individual music stations. + True + True + False + 0 + True + + + True + True + 1 + + + + + Load favicon for played stations. + True + True + False + 0 + True + + + True + True + 2 + + + + + Show bookmark star for favourites in stream lists. + True + True + False + 0 + True + + + True + True + 3 + + + + + True + False + needs restart + 0 + Use specific Gtk+ theme for Streamtuner2. + + + True + True + 5 + 4 + + + + + True + False + + + + + + + + + False + False + 5 + + + + + Save window state, sizes and selections automatically. + True + True + False + 0 + True + + + True + True + 5 + 6 + + + + + + + + True + False + + + True + True + 8 + + + + + True + False + 0.019999999552965164 + 9 + Station loading + + + + + + + True + True + 9 + + + + + Prefer HTML traversing (PyQuery) over regex text matching. + True + True + False + 0 + top + True + + + True + True + 10 + + + + + True + False + 0 + <small>Most plugins intellegently fall back, but sometimes overriding +the website extraction method can fix some station list update errors.</small> + True + + + True + True + 11 + + + + + True + False + + + True + True + 5 + + 5 + 500 + out + True + False + False + True + True + + + False + False + 0 + + + + + True + False + 0 + 6 + Limit stream number per channel / category. +<small>Some plugins use custom overrides.</small> + True + end + + + True + True + 1 + + + + + False + False + 5 + 12 + + + + + + + + Retain deleted stations in list. + True + True + False + 0 + True + + + True + True + 14 + + + + + Update favorites from freshened stream URLs. + True + True + False + 0 + True + + + True + True + 15 + + + + + Google missing station homepages. + True + True + False + 0 + True + + + True + True + 16 + + + + + + + + + + + + + + True + False + + + True + True + 20 + + + + + True + False + 0.019999999552965164 + 9 + System + + + + + + + True + True + 21 + + + + + + + + + + + True + False + + + True + False + 0 + Temporary files directory + + + False + True + 0 + + + + + 200 + 20 + True + True + + True + gtk-save-as + False + False + True + True + + + False + False + 1 + + + + + True + True + 5 + 24 + + + + + + + + Keep and reuse temporary .m3u files for played stations. + True + True + False + True + + + True + True + 5 + 26 + + + + + + + + True + False + + + True + False + 0 + Config directory. +<small>This is determined by XDG_CONFIG_HOME.</small> + True + + + False + True + 0 + + + + + 200 + 20 + True + True + False + + 20 + True + gtk-home + False + False + True + True + + + False + True + 1 + + + + + True + False + 3 + 28 + + + + + + + + Enable _debug messages (on the console). + True + True + False + True + True + + + True + True + 5 + 30 + + + + + + + + + + + + 1 + + + + + True + False + Options + + + 1 + False + + + + + True + True + never + + + True + False + 15 + queue + none + + + True + False + 10 + + + True + False + 0.05000000074505806 + <b>Channels</b> show up as tabs. While <b>feature</b> <i>plugins</i> add menu entries +or internal functions. Changes take effect after restarting streamtuner2. + True + + + True + True + 0 + + + + + True + False + + + True + False + 0.40999999642372131 + Tab ordering + + + False + True + 6 + 0 + + + + + True + True + + True + False + False + True + True + + + True + True + 1 + + + + + True + True + 1 + + + + + True + False + + + False + True + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 3 + + + + + False + Channel +Plugins + + + 3 + False + + + + + True + True + 0 + + + + + True + False + + + True + False + + + True + True + 0 + + + + + cancel + 100 + 35 + True + True + True + + + + False + True + 1 + + + + + save + 100 + 35 + True + True + True + + + + True + True + 2 + + + + + False + True + 1 + + + + + + + True + False + <big><b>Configuration Settings</b></big> + True + + + + False 5 station search @@ -143,10 +1103,190 @@ 4 4 5 1 True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1061,10 +2201,82 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True True @@ -1079,10 +2291,22 @@ 2 1 2 + + + + + + + + + + + + @@ -1189,964 +2413,10 @@ - - 565 - False - streamtuner settings - center - True - /usr/share/pixmaps/streamtuner2.png - - - - True - False - 0 - none - - - 500 - True - False - - - 520 - True - True - True - True - - - True - True - automatic - automatic - - - True - False - 15 - none - - - True - False - - - True - False - 0 - <b>Audio player</b> and <b>recording</b> applications. - True - - - True - True - 0 - - - - - True - True - automatic - automatic - - - 0 - 200 - True - True - 5 - config_play - False - True - 0 - 8 - both - - - 10 - 125 - Format - True - - - - - - 2 - 0 - - - - - - - 10 - 300 - Application - - - - - - 2 - 1 - - - - - - - - - True - True - 1 - - - - - True - False - 0.019999999552965164 - 0.49000000953674316 - Use <a href="http://fossil.include-once.org/streamtuner2/wiki?name=player">placeholders</a> such as <b>%pls</b> for Shoutcast playlists, -or pass <b>%m3u</b> for players that expect mp3 playlist files, -and <b>%srv</b> to use direct streaming URLs. - True - True - - - True - True - 2 - - - - - - - - - - - True - False - Player - - - False - - - - - True - True - automatic - automatic - - - True - False - 15 - none - - - True - False - - - True - False - 0.019999999552965164 - 9 - Display - - - - - - - True - True - 0 - - - - - Display favicons for individual music stations. - True - True - False - 0 - True - - - True - True - 1 - - - - - Load favicon for played stations. - True - True - False - 0 - True - - - True - True - 2 - - - - - Show bookmark star for favourites in stream lists. - True - True - False - 0 - True - - - True - True - 5 - 3 - - - - - True - False - needs restart - 0 - Use specific Gtk+ theme for Streamtuner2. - - - True - True - 4 - - - - - True - False - - - False - False - 5 - - - - - Save window state, sizes and selections automatically. - True - True - False - 0 - True - - - True - True - 5 - 6 - - - - - - - - True - False - - - True - True - 8 - - - - - True - False - 0.019999999552965164 - 9 - Station loading - - - - - - - True - True - 9 - - - - - Prefer HTML traversing (PyQuery) over regex text matching. - True - True - False - 0 - top - True - - - True - True - 10 - - - - - True - False - 0 - <small>Most plugins intellegently fall back, but sometimes overriding -the website extraction method can fix some station list update errors.</small> - True - - - True - True - 11 - - - - - True - False - - - True - True - 5 - - 5 - 500 - out - True - False - False - True - True - - - False - False - 0 - - - - - True - False - 0 - 6 - Limit stream number per channel / category. -<small>Some plugins use custom overrides.</small> - True - end - - - True - True - 1 - - - - - False - False - 5 - 12 - - - - - - - - Retain deleted stations in list. - True - True - False - 0 - True - - - True - True - 14 - - - - - Update favorites from freshened stream URLs. - True - True - False - 0 - True - - - True - True - 15 - - - - - Google missing station homepages. - True - True - False - 0 - True - - - True - True - 16 - - - - - - - - - - - - - - True - False - - - True - True - 20 - - - - - True - False - 0.019999999552965164 - 9 - System - - - - - - - True - True - 21 - - - - - - - - - - - True - False - - - True - False - 0 - Temporary files directory - - - False - True - 0 - - - - - 200 - 20 - True - True - - True - gtk-save-as - False - False - True - True - - - False - False - 1 - - - - - True - True - 5 - 24 - - - - - - - - Keep and reuse temporary .m3u files for played stations. - True - True - False - True - - - True - True - 5 - 26 - - - - - - - - True - False - - - True - False - 0 - Config directory. -<small>This is determined by XDG_CONFIG_HOME.</small> - True - - - False - True - 0 - - - - - 200 - 20 - True - True - False - - 20 - True - gtk-home - False - False - True - True - - - False - True - 1 - - - - - True - False - 3 - 28 - - - - - - - - Enable _debug messages (on the console). - True - True - False - True - True - - - True - True - 5 - 30 - - - - - - - - - - - - 1 - - - - - True - False - Options - - - 1 - False - - - - - True - True - never - - - True - False - 15 - queue - none - - - True - False - 10 - - - True - False - 0.05000000074505806 - <b>Channels</b> show up as tabs. While <b>feature</b> <i>plugins</i> add menu entries -or internal functions. Changes take effect after restarting streamtuner2. - True - - - True - True - 0 - - - - - True - False - - - True - False - 0.40999999642372131 - Tab ordering - - - False - True - 6 - 0 - - - - - True - True - - True - False - False - True - True - - - True - True - 1 - - - - - True - True - 1 - - - - - True - False - - - False - True - 2 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3 - - - - - False - Channel -Plugins - - - 3 - False - - - - - True - True - 0 - - - - - True - False - - - True - False - - - True - True - 0 - - - - - cancel - 100 - 35 - True - True - True - - - - False - True - 1 - - - - - save - 100 - 35 - True - True - True - - - - True - True - 2 - - - - - False - True - 1 - - - - - - - True - False - <big><b>Configuration Settings</b></big> - True - - - - - False 5 inspect/edit stream data center-on-parent Index: gtk3.xml ================================================================== --- gtk3.xml +++ gtk3.xml @@ -69,27 +69,28 @@ True True - 250 + 0 + 200 True True 5 config_play False True 0 8 both - True 10 + 125 Format True @@ -102,10 +103,11 @@ 10 + 300 Application @@ -231,11 +233,10 @@ True True True - 5 3 @@ -246,17 +247,24 @@ Use specific Gtk+ theme for Streamtuner2. True True + 5 4 - + True False + + + + + + False False 5 @@ -1531,10 +1539,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + all channels True True @@ -2130,10 +2273,64 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True True @@ -2146,10 +2343,19 @@ 2 1 2 + + + + + + + + + @@ -2630,12 +2836,12 @@ True False bookmark True - + gtk-save-as @@ -2642,12 +2848,12 @@ True False True True - + gtk-edit @@ -2654,13 +2860,13 @@ True False True True - + - + True @@ -2729,12 +2935,12 @@ True False True True - + gtk-find Index: mygtk.py ================================================================== --- mygtk.py +++ mygtk.py @@ -396,10 +396,30 @@ w.modify_bg(gtk.STATE_NORMAL, c) # return modified or wrapped widget return w + # Create GtkLabel + @staticmethod + def label(text): + label = gtk.Label(text) + label.set_property("visible", True) + label.set_line_wrap(True) + label.set_size_request(400, -1) + return label + + # Wrap two widgets in horizontal box + @staticmethod + def hbox(w1, w2): + b = gtk.HBox(homogeneous=False, spacing=10) + b.set_property("visible", True) + b.pack_start(w1, expand=False, fill=False) + b.pack_start(w2, expand=True, fill=True) + return b + + + # @staticmethod def add_menu(menuwidget, label, action): m = gtk.MenuItem(label) m.connect("activate", action) m.show() @@ -423,10 +443,11 @@ def __init__(self, entries): # prepare widget gtk.ComboBox.__init__(self) + self.set_property("visible", True) cell = gtk.CellRendererText() self.pack_start(cell, True) self.add_attribute(cell, "text", 1) # collect entries @@ -437,16 +458,18 @@ # activate dropdown of given value def set_default(self, value): for index,row in enumerate(self.ls): if value in row: - self.set_active(index) - pass + return self.set_active(index) + # add as custom entry + self.ls.append([value, value]) + self.set_active(index + 1) # fetch currently selected text entry def get_active_text(self): index = self.get_active() if index >= 0: return self.ls[index][0] Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -797,11 +797,11 @@ w = main.get_widget(prefix + key) if w: # text if type(w) is gtk.Entry: config[key] = w.get_text() - # + # pre-defined text elif type(w) is ComboBoxText: config[key] = w.get_active_text() # boolean elif type(w) is gtk.CheckButton: config[key] = w.get_active() @@ -819,38 +819,27 @@ main.config_play[path][column] = new_text def edited_player_row_2(self, cell, path, new_text, user_data=None): self.edited_player_row(cell, path, new_text, column=1) - # fill combobox + # list of Gtk themes in dropdown def combobox_theme(self): - # self.theme.combo_box_new_text() # find themes themedirs = (conf.share+"/themes", conf.dir+"/themes", "/usr/share/themes") themes = ["no theme"] [[themes.append(e) for e in os.listdir(dir)] for dir in themedirs if os.path.exists(dir)] __print__(dbg.STAT, themes) - # prepare liststore - store = gtk.ListStore(gobject.TYPE_STRING) - self.theme.set_model(store) - cell = gtk.CellRendererText() - self.theme.pack_start(cell, True) - self.theme.add_attribute(cell, "text", 0) - # add to combobox - for num,themename in enumerate(themes): - store.append([themename]) - if conf.theme == themename: - self.theme.set_active(num) - # erase this function, so it only ever gets called once - self.combobox_theme = lambda: None + # add dropdown + main.widgets["theme"] = ComboBoxText(themes) + self.theme_cb_placeholder.pack_start(self.theme) + self.theme_cb_placeholder.pack_end(mygtk.label("")) # retrieve currently selected value def apply_theme(self): - if self.theme.get_active() >= 0: - conf.theme = self.theme.get_model()[ self.theme.get_active()][0] - main.load_theme() + conf.theme = self.theme.get_active_text() + main.load_theme() # add configuration setting definitions from plugins def add_plugins(self): @@ -866,23 +855,23 @@ if self.channels.get(name) or self.features.get(name): c = self.channels.get(name) or self.features.get(name) for opt in c.config: # default values are already in conf[] dict (now done in conf.add_plugin_defaults) + color = opt.get("color", None) # display checkbox if opt["type"] == "boolean": cb = gtk.CheckButton(opt["description"]) - #cb.set_line_wrap(True) - self.add_( "config_"+opt["name"], cb ) + self.add_( "config_"+opt["name"], cb, color=color ) # drop down list elif opt["type"] == "select": cb = ComboBoxText(opt["select"].split("|")) # custom mygtk widget - self.add_( "config_"+opt["name"], cb, opt["description"] ) + self.add_( "config_"+opt["name"], cb, opt["description"], color ) # text entry else: - self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"] ) + self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color ) # spacer self.add_( "filler_pl_"+name, gtk.HSeparator() ) @@ -891,31 +880,14 @@ w.set_property("visible", True) main.widgets[id] = w if label: if type(w) is gtk.Entry: w.set_width_chars(11) - w = self.hbox(w, self.label(label)) + w = mygtk.hbox(w, mygtk.label(label)) if color: w = mygtk.bg(w, color) self.plugin_options.pack_start(w) - - # Create GtkLabel - def label(self, label): - label = gtk.Label(label) - label.set_property("visible", True) - label.set_line_wrap(True) - label.set_size_request(400, -1) - return label - - # Wrap two widgets in vertical box - def hbox(self, w1, w2): - vbox = gtk.HBox(homogeneous=False, spacing=10) - vbox.set_property("visible", True) - vbox.pack_start(w1, expand=False, fill=False) - vbox.pack_start(w2, expand=True, fill=True) - return vbox - # save config def save(self, widget): self.save_config(conf.__dict__, "config_") self.save_config(conf.plugins, "config_plugins_")