예제 #1
0
        def task(rows):
            for row in rows:
                index = self.path[0]
                path = row[index]
                if path and (is_m3u(path) and row not in checked_m3u_rows):
                    checked_m3u_rows.append(row)
                    for r in rows:
                        if (os.path.dirname(r[index]) == os.path.dirname(path)
                                and os.path.isfile(r[index])
                                and not is_m3u(r[index])):
                            m3u_rows_for_delete.append(r)
                            break
                    return task(rows)

                if path and (get_file_extension(path) == ".cue"
                             and row not in checked_cue_rows):

                    checked_cue_rows.append(row)
                    filtered_rows = [
                        r for r in rows
                        if (os.path.dirname(r[index]) != os.path.dirname(path)
                            or os.path.isdir(r[index])
                            or get_file_extension(r[index]) == ".cue")
                    ]
                    return task(filtered_rows)
            return rows
예제 #2
0
        def task(to_tree, to_model):
            treerows = [from_model[path] for path in paths]
            for  i, treerow in enumerate(treerows):
                for k, ch_row in enumerate(treerow.iterchildren()):
                    treerows.insert(i+k+1, ch_row)

            #treerows = self.playlist_filter(treerows)
            if not current:
                name = treerows[0][0]
                self.controls.notetabs._append_tab(name)
                to_tree = self.controls.notetabs.get_current_tree()     # because to_tree has changed
                to_model = to_tree.get_model().get_model()
            for i, treerow in enumerate(treerows):
                if is_m3u(treerow[self.path[0]]):
                    rows = self.file_paths_to_rows([treerow[self.path[0]]])
                    if rows:
                        rows.reverse()
                        map(lambda row: treerows.insert(i + 1, row), rows)
                        continue
                to_model.append(None, [col for col in treerow])
            t = threading.Thread(target=to_tree.safe_fill_treerows)
            t.start()
            t.join()
            if not current:
                '''gobject because rebuild_as_plain use it too'''
                self.controls.play_first_file_in_playlist()
            self.controls.notetabs.on_save_tabs()
예제 #3
0
        def task(to_tree, to_model):
            treerows = [from_model[path] for path in paths]
            for i, treerow in enumerate(treerows):
                for k, ch_row in enumerate(treerow.iterchildren()):
                    treerows.insert(i+k+1, ch_row)

            #treerows = self.playlist_filter(treerows)
            if not current:
                name = treerows[0][0]
                if isinstance(name, str):
                    name = unicode(name, "utf-8")
                self.controls.notetabs._append_tab(name)
                to_tree = self.controls.notetabs.get_current_tree()     # because to_tree has changed
                to_model = to_tree.get_model().get_model()
            for i, treerow in enumerate(treerows):
                if is_m3u(treerow[self.path[0]]):
                    rows = to_tree.file_paths_to_rows([treerow[self.path[0]]])
                    if rows:
                        rows.reverse()
                        map(lambda row: treerows.insert(i + 1, row), rows)
                        continue
                to_model.append(None, [col for col in treerow])
            t = threading.Thread(target=to_tree.safe_fill_treerows)
            t.start()
            t.join()
            if not current:
                '''gobject because rebuild_as_plain use it too'''
                self.controls.play_first_file_in_playlist()
            self.controls.notetabs.on_save_tabs()
예제 #4
0
        def task(rows):
            for row in rows:
                index = self.path[0]
                path = row[index]
                if path and (is_m3u(path)
                             and row not in checked_m3u_rows):
                    checked_m3u_rows.append(row)
                    for r in rows:
                        if (os.path.dirname(r[index]) == os.path.dirname(path) and os.path.isfile(r[index])
                            and not is_m3u(r[index])):
                                m3u_rows_for_delete.append(r)
                                break
                    return task(rows)

                if path and (get_file_extension(path) == ".cue"
                             and row not in checked_cue_rows):

                    checked_cue_rows.append(row)
                    filtered_rows = [r for r in rows if (os.path.dirname(r[index]) != os.path.dirname(path)
                                                           or os.path.isdir(r[index])
                                                           or get_file_extension(r[index]) == ".cue")]
                    return task(filtered_rows)
            return rows