Esempio n. 1
0
 def do_export(button):
     num_songs = len(liststore)
     i = 0
     export_dir = folder_chooser.get_filename()
     for item in liststore:
         song = Widgets.song_row_to_dict(item, start=0)
         song_link, song_path = Net.get_song_link(song, 
                 self.app.conf)
         if song_link is not True:
             continue
         shutil.copy(song_path, export_dir)
         i += 1
         export_prog.set_fraction(i / num_songs)
         Gdk.Window.process_all_updates()
     dialog.destroy()
Esempio n. 2
0
 def run(self):
     file_nums = len(self.liststore)
     for i, item in enumerate(self.liststore):
         if self.stop_flag:
             return
         song = Widgets.song_row_to_dict(item, start=0)
         cached, song_link, song_path = Net.get_song_link(song, self.conf)
         if not cached:
             continue
         shutil.copy(song_path, self.export_dir)
         if self.including_lrc:
             lrc_path, lrc_cached = Net.get_lrc_path(song)
             if lrc_cached:
                 shutil.copy(lrc_path, self.export_dir)
         self.emit('copied', song['name'], i)
     self.emit('finished', file_nums)
Esempio n. 3
0
        def do_export(button):
            num_songs = len(liststore)
            export_dir = folder_chooser.get_filename()
            export_lrc = with_lrc.get_active()
            for i, item in enumerate(liststore):
                song = Widgets.song_row_to_dict(item, start=0)
                song_link, song_path = Net.get_song_link(
                        song, self.app.conf)
                if song_link is not True:
                    continue
                shutil.copy(song_path, export_dir)

                if export_lrc:
                    (lrc_path, lrc_cached) = Net.get_lrc_path(song)
                    if lrc_cached:
                        shutil.copy(lrc_path, export_dir)
                export_prog.set_fraction(i / num_songs)
                Gdk.Window.process_all_updates()
            dialog.destroy()
Esempio n. 4
0
        def do_export(button):
            num_songs = len(liststore)
            export_dir = folder_chooser.get_filename()
            export_lrc = with_lrc.get_active()
            for i, item in enumerate(liststore):
                song = Widgets.song_row_to_dict(item, start=0)
                song_link, song_path = Net.get_song_link(
                        song, self.app.conf)
                if song_link is not True:
                    continue
                shutil.copy(song_path, export_dir)

                if export_lrc:
                    (lrc_path, lrc_cached) = Net.get_lrc_path(song)
                    if lrc_cached:
                        shutil.copy(lrc_path, export_dir)
                export_prog.set_fraction(i / num_songs)
                Gdk.Window.process_all_updates()
            dialog.destroy()
Esempio n. 5
0
    def do_export(self, button):
        num_songs = len(self.liststore)
        export_dir = self.folder_chooser.get_filename()
        export_lrc = self.with_lrc.get_active()
        for i, item in enumerate(self.liststore):
            song = Widgets.song_row_to_dict(item, start=0)
            cached, song_link, song_path = Net.get_song_link(
                    song, self.app.conf)
            if not cached:
                continue
            self.export_prog.set_fraction(i / num_songs)
            self.export_prog.set_text(song['name'])
            shutil.copy(song_path, export_dir)

            if export_lrc:
                lrc_path, lrc_cached = Net.get_lrc_path(song)
                if lrc_cached:
                    shutil.copy(lrc_path, export_dir)
            Gdk.Window.process_all_updates()
        self.destroy()
Esempio n. 6
0
 def do_export(button):
     num_songs = len(liststore)
     i = 0
     for item in liststore:
         name = item[0]
         artist = item[1]
         album = item[2]
         rid = item[3]
         song_link = Net.get_song_link(rid)
         song_name = os.path.split(song_link)[1]
         song_path = os.path.join(self.app.conf['song-dir'], 
                 song_name)
         if not os.path.exists(song_path):
             continue
         export_song_name = '{0}_{1}{2}'.format(name, artist, 
                 os.path.splitext(song_name)[1]).replace('/', '+')
         export_song_path = os.path.join(
                 folder_chooser.get_filename(), export_song_name)
         i += 1
         shutil.copy(song_path, export_song_path)
         export_prog.set_fraction(i / num_songs)
         Gdk.Window.process_all_updates()
     dialog.destroy()
Esempio n. 7
0
    def run(self):
        selection = self.treeview.get_selection()
        liststore, selected_paths = selection.get_selected_rows()
        if self.export_all:
            file_nums = len(liststore)
            song_rows = liststore
        else:
            file_nums = len(selected_paths)
            song_rows = (liststore[path] for path in selected_paths)

        for i, item in enumerate(song_rows):
            if self.stop_flag:
                return
            song = Widgets.song_row_to_dict(item, start=0)
            cached, song_link, song_path = Net.get_song_link(song, self.conf)
            if not cached:
                continue
            shutil.copy(song_path, self.export_dir)
            if self.including_lrc:
                lrc_path, lrc_cached = Net.get_lrc_path(song)
                if lrc_cached:
                    shutil.copy(lrc_path, self.export_dir)
            self.emit('copied', song['name'], i / file_nums)
        self.emit('finished', file_nums)
Esempio n. 8
0
    def run(self):
        selection = self.treeview.get_selection()
        liststore, selected_paths = selection.get_selected_rows()
        if self.export_all:
            file_nums = len(liststore)
            song_rows = liststore
        else:
            file_nums = len(selected_paths)
            song_rows = (liststore[path] for path in selected_paths)

        for i, item in enumerate(song_rows):
            if self.stop_flag:
                return
            song = Widgets.song_row_to_dict(item, start=0)
            cached, song_link, song_path = Net.get_song_link(song, self.conf)
            if not cached:
                continue
            shutil.copy(song_path, self.export_dir)
            if self.including_lrc:
                lrc_path, lrc_cached = Net.get_lrc_path(song)
                if lrc_cached:
                    shutil.copy(lrc_path, self.export_dir)
            self.emit('copied', song['name'], i /file_nums)
        self.emit('finished', file_nums)