zs

Zeitungsschau rss to email converter
git clone git://r-36.net/zs
Log | Files | Refs | LICENSE

commit 0de453a0f79eb0c1ea0f98a23d365a3394131e39
parent 871c61d31c9fd59c5f94dd6fe3ea0f7c7f10f62c
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun,  9 Mar 2014 21:17:21 +0100

Add feature to reset feed state.

Diffstat:
feeddb.py | 8++++++++
feedemail.py | 2--
zs.py | 5+++++
3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/feeddb.py b/feeddb.py @@ -177,4 +177,12 @@ class feeddb(object): for article in curfeed["articles"]: if article in feed["articles"]: article["unread"] == False + self.writefeed(uri, feed); + + def resetarticles(self, uri): + feed = self.readfeed(uri) + if feed == None: + return + feed["articles"] = [] + self.writefeed(uri, feed) diff --git a/feedemail.py b/feedemail.py @@ -79,8 +79,6 @@ def send(feed, to, smtphost="localhost", smtpport=None, ssl="False", \ "utf-8") msg["User-Agent"] = "Zeitungsschau" - print(msg.as_string()) - if ssl == "True": s = smtplib.SMTP_SSL() else: diff --git a/zs.py b/zs.py @@ -85,6 +85,11 @@ def main(args): usage(args[0]) db.delfeed(args[1]) + elif args[1] == "reset": + if len(args) < 3: + usage(args[0]) + db.resetarticles(args[1]) + elif args[1] == "pause": if len(args) < 3: usage(args[0])