Exemplo n.º 1
0
    def test_parse_opml(self):
        feeds = Feed.parseOPML(
            pkg_resources.resource_filename(__name__, 'fixture/feeds.opml'))
        self.assertEquals(3, len(feeds))
        self.assertEquals('ongoing', feeds[0].name)
        self.assertEquals('http://www.tbray.org/ongoing/ongoing.atom',
                          feeds[0].url)

        self.assertEquals('Trac_Example', feeds[2].name)
        self.assertEquals(('user', 'password'), feeds[2].auth)
        self.assert_(
            os.path.exists(os.path.join(self.tmpdir, 'Trac_Example.cache')))
Exemplo n.º 2
0
Arquivo: main.py Projeto: wosc/rsspull
def rsspull(confdir):
    confdir = os.path.expanduser(confdir)
    config = ConfigParser()
    config.read(os.path.join(confdir, 'config'))
    Feed.workdir = os.path.join(confdir, 'cache')
    Feed.target = os.path.expanduser(config.get('global', 'target'))
    Feed.target_type = os.path.expanduser(config.get('global', 'target_type'))

    ws.rsspull.util.setupLogging(
        os.path.expanduser(config.get('global', 'logfile')))
    log = logging.getLogger(__name__)
    log.info('Reading feed configuration from %s' % confdir)
    feeds = Feed.parseOPML(os.path.join(confdir, 'feeds.opml'))

    worker_count = config.getint('global', 'workers')
    if worker_count > 1:
        rsspull_parallel(feeds, worker_count)
    else:
        rsspull_serial(feeds)