#!/usr/bin/env python """ RSS->IMAP gateway - read your favourite RSS feeds with your favourite email client """ __version__ = "0.1.2-svn" __license__ = "Python" __copyright__ = "Copyright 2005,2006 Jens Georg" __author__ = "Jens Georg " from feedmap.Config import Config from feedmap.Feedcache import RssCache from twisted.cred import portal, checkers, credentials from twisted.internet import protocol, reactor, task from twisted.mail import imap4 from twisted.python import log from zope.interface import Interface, implements import feedmap.Cache import feedmap.Feedcache from feedmap.imap.factory import Factory from feedmap.auth.realm import Realm import md5 import sys, random, time, string, re import textwrap import urlparse # try to include the c variants first. If not found, use the python variants try: from cStringIO import StringIO except: from StringIO import StringIO try: from cPickle import dumps, loads except: from pickle import dumps, loads def main(): # modify feedcache's USER_AGENT to reflect ourselves feedmap.Feedcache.USER_AGENT = "FeedMap/%s +http://jensge.org/?feedmap" % __version__ # read config file config = Config("feedmap.cfg") r = Realm(config) p = portal.Portal(r) c = checkers.InMemoryUsernamePasswordDatabaseDontUse() c.addUser("guest", "guest") p.registerChecker(c) p.registerChecker(checkers.AllowAnonymousAccess()) f = Factory(p) log.startLogging(sys.stdout) reactor.listenTCP(port = config.port, factory = f, interface = config.interface) log.msg ("Updating cache...") c = feedmap.Cache.CacheManager ("cache", config.feeds); c.close() log.msg ("Updated %d feeds. Ready to answer queries" % len(config.feeds)) reactor.run() if __name__ == "__main__": main()