# rss2maildir.py - RSS feeds to Maildir 1 email per item
# Copyright (C) 2007 Brett Parker <iDunno@sommitrealweird.co.uk>
# rss2maildir.py - RSS feeds to Maildir 1 email per item
# Copyright (C) 2007 Brett Parker <iDunno@sommitrealweird.co.uk>
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
- self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70))
- self.currentparagraph = ""
+ self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70)).encode("utf-8")
+ self.currentparagraph = u''
- self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70)) + "\n"
- self.currentparagraph = ""
+ self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70)).encode("utf-8") + "\n"
+ self.currentparagraph = u''
if tag.lower() == "h1":
self.inheadingone = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "=" * len(self.headingtext.strip())
if tag.lower() == "h1":
self.inheadingone = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "=" * len(self.headingtext.strip())
elif tag.lower() == "h2":
self.inheadingtwo = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "-" * len(self.headingtext.strip())
elif tag.lower() == "h2":
self.inheadingtwo = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "-" * len(self.headingtext.strip())
elif tag.lower() in ["h3", "h4", "h5", "h6"]:
self.inotherheading = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "~" * len(self.headingtext.strip())
elif tag.lower() in ["h3", "h4", "h5", "h6"]:
self.inotherheading = False
self.text = self.text + "\n\n" + self.headingtext + "\n" + "~" * len(self.headingtext.strip())
elif tag.lower() == "p":
self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70))
self.inparagraph = False
elif tag.lower() == "blockquote":
elif tag.lower() == "p":
self.text = self.text + "\n".join(textwrap.wrap(self.currentparagraph, 70))
self.inparagraph = False
elif tag.lower() == "blockquote":
elif tag.lower() == "pre":
self.inpre = False
def handle_data(self, data):
if self.inheadingone or self.inheadingtwo or self.inotherheading:
elif tag.lower() == "pre":
self.inpre = False
def handle_data(self, data):
if self.inheadingone or self.inheadingtwo or self.inotherheading:
fp = feedparser.parse(url)
db = dbm.open(os.path.join(statedir, "seen"), "c")
for item in fp["items"]:
fp = feedparser.parse(url)
db = dbm.open(os.path.join(statedir, "seen"), "c")
for item in fp["items"]:
msg.add_header("Subject", item["title"])
msg.set_default_type("text/plain")
msg.add_header("Subject", item["title"])
msg.set_default_type("text/plain")