310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
self.channel().play(row)
favicon.download_playing(row)
# streamripper
def on_record_clicked(self, widget):
row = self.row()
action.record(row.get("url"), "audio/mp3", "url/direct", row=row)
# browse stream
def on_homepage_stream_clicked(self, widget):
url = self.selected("homepage")
action.browser(url)
|
|
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
|
self.channel().play(row)
favicon.download_playing(row)
# streamripper
def on_record_clicked(self, widget):
row = self.row()
action.record(row.get("url"), "audio/mpeg", "url/direct", row=row)
# browse stream
def on_homepage_stream_clicked(self, widget):
url = self.selected("homepage")
action.browser(url)
|
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
|
main.channel().save()
self.cancel(w)
# add a new list entry, update window
def new(self, w):
s = main.channel().stations()
s.append({"title":"new", "url":"", "format":"audio/mp3", "genre":"", "listeners":1});
main.channel().switch() # update display
main.channel().gtk_list.get_selection().select_path(str(len(s)-1)); # set cursor to last row
self.open(w)
# hide window
def cancel(self, *w):
|
|
|
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
|
main.channel().save()
self.cancel(w)
# add a new list entry, update window
def new(self, w):
s = main.channel().stations()
s.append({"title":"new", "url":"", "format":"audio/mpeg", "genre":"", "listeners":1});
main.channel().switch() # update display
main.channel().gtk_list.get_selection().select_path(str(len(s)-1)); # set cursor to last row
self.open(w)
# hide window
def cancel(self, *w):
|
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
|
# set/load values between gtk window and conf. dict
def apply(self, config, prefix="config_", save=0):
for key,val in config.items():
# map non-alphanumeric chars from config{} to underscores in according gtk widget names
id = re.sub("[^\w]", "_", key)
w = main.get_widget(prefix + id)
__print__(dbg.CONF, "config", ("save" if save else "load"), prefix+id, w, val)
# recurse into dictionaries, transform: conf.play.audio/mp3 => conf.play_audio_mp3
if (type(val) == dict):
self.apply(val, prefix + id + "_", save)
# load or set gtk.Entry text field
elif (w and save and type(w)==gtk.Entry):
config[key] = w.get_text()
elif (w and type(w)==gtk.Entry):
w.set_text(str(val))
|
|
|
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
|
# set/load values between gtk window and conf. dict
def apply(self, config, prefix="config_", save=0):
for key,val in config.items():
# map non-alphanumeric chars from config{} to underscores in according gtk widget names
id = re.sub("[^\w]", "_", key)
w = main.get_widget(prefix + id)
__print__(dbg.CONF, "config", ("save" if save else "load"), prefix+id, w, val)
# recurse into dictionaries, transform: conf.play.audio/mpeg => conf.play_audio_mpeg
if (type(val) == dict):
self.apply(val, prefix + id + "_", save)
# load or set gtk.Entry text field
elif (w and save and type(w)==gtk.Entry):
config[key] = w.get_text()
elif (w and type(w)==gtk.Entry):
w.set_text(str(val))
|