예제 #1
0
    def __init__(self, parent):
        ListWindow.__init__(self, parent)
        self.keymap.bind('l', self.listPodCasts, ())
        self.keymap.bind(['\n', curses.KEY_ENTER],
                         self.toggleDownload, ())

        self.settings = orm.settings()
        self.downloaders = []
        self.currentDownloads = []
        self.downloaderThreads = []
  
        for (f, url), i in zip(self.settings.podcasts.iteritems(),
                               range(0, len(self.settings.podcasts))):
            # create the podcast dir
            dirName = os.path.join(self.settings.prefix, f)

            if not os.path.exists(dirName):
                try:
                    os.makedirs(dirName)
                except OSError, error:
                    raise SettingsError, "%s\nCannot create %s" % (error, dirName)

            downloader = orm.podcastHandler(self.settings.prefix,
                                            f, url, None, False)
            self.downloaders.append(downloader)
            t = threading.Thread(target=run,
                                 args=[downloader, self, i])
            t.setDaemon(False)
            self.downloaderThreads.append(t)
예제 #2
0
    def __init__(self, parent):
        ListWindow.__init__(self, parent)
        self.keymap.bind("l", self.listPodCasts, ())
        self.keymap.bind(["\n", curses.KEY_ENTER], self.toggleDownload, ())

        self.settings = orm.settings()
        self.downloaders = []

        for f, url in self.settings.podcasts.iteritems():
            self.downloaders.append(orm.podcastHandler(self.settings.prefix, f, url, self.transferProgressHook, False))