@@ -0,0 +1,2749 @@
+#!/usr/bin/env python%0A%0A%22%22%22%0ARadio%0A=====%0A%0A:copyright: (c) 2014 by Guillaume Ayoub and contributors.%0A:license: BSD, see LICENSE for more details.%0A%0A%22%22%22%0A%0Aimport configparser%0Aimport os%0Afrom gi.repository import Gtk, GdkPixbuf, Gst%0A%0A%0ACONFIG_FOLDER = os.path.expanduser('~/.config/radio')%0ACONFIG = configparser.SafeConfigParser()%0ACONFIG.read(os.path.join(CONFIG_FOLDER, 'config'))%0A%0A%0Aclass Window(Gtk.ApplicationWindow):%0A    def __init__(self, application):%0A        super(Gtk.ApplicationWindow, self).__init__(application=application)%0A        self.set_title('Radio')%0A        self.set_icon_name('audio-volume-high')%0A%0A        self.header = Gtk.HeaderBar()%0A        self.header.set_title('Radio')%0A        self.header.set_show_close_button(True)%0A        self.set_titlebar(self.header)%0A%0A        self.stop_button = Gtk.Button()%0A        self.stop_button.add(%0A            Gtk.Image.new_from_icon_name('media-playback-stop-symbolic', 32))%0A        self.header.add(self.stop_button)%0A        self.stop_button.set_sensitive(False)%0A        self.stop_button.connect('clicked', self.stop)%0A%0A        self.model = Gtk.ListStore(object)%0A        self.model.set_column_types((str, str, GdkPixbuf.Pixbuf))%0A%0A        self.icon_view = Gtk.IconView()%0A        self.icon_view.set_model(self.model)%0A        self.icon_view.set_text_column(0)%0A        self.icon_view.set_pixbuf_column(2)%0A        self.icon_view.set_activate_on_single_click(True)%0A        self.icon_view.connect('item-activated', self.play)%0A        self.add(self.icon_view)%0A%0A        Gst.init()%0A        self.playbin = Gst.ElementFactory.make('playbin', 'player')%0A%0A        for section in CONFIG.sections():%0A            icons = %5B%0A                filename for filename in os.listdir(CONFIG_FOLDER)%0A                if filename.startswith(section)%5D%0A            if icons:%0A                icon = GdkPixbuf.Pixbuf.new_from_file_at_scale(%0A                    os.path.join(CONFIG_FOLDER, icons%5B0%5D), 128, 128, False)%0A            else:%0A                icon = Gtk.IconTheme.get_default().load_icon(%0A                    'audio-volume-high', 128, Gtk.IconLookupFlags.FORCE_SIZE)%0A            self.model.append((section, CONFIG%5Bsection%5D%5B'url'%5D, icon))%0A%0A    def play(self, view, path):%0A        self.playbin.set_state(Gst.State.NULL)%0A        self.playbin.set_property('uri', self.model%5Bpath%5D%5B1%5D)%0A        self.playbin.set_state(Gst.State.PLAYING)%0A        self.header.set_subtitle(self.model%5Bpath%5D%5B0%5D)%0A        self.stop_button.set_sensitive(True)%0A%0A    def stop(self, button):%0A        self.playbin.set_state(Gst.State.NULL)%0A        self.header.set_subtitle(None)%0A        self.stop_button.set_sensitive(False)%0A%0A%0Aclass Radio(Gtk.Application):%0A    def do_activate(self):%0A        self.window = Window(self)%0A        self.window.show_all()%0A%0A%0ARadio().run()%0A

Add code