Only tweet things that have happened in the past 7 days, to avoid flooding
authorMagnus Hagander <magnus@hagander.net>
Fri, 16 Oct 2009 22:41:30 +0000 (00:41 +0200)
committerMagnus Hagander <magnus@hagander.net>
Fri, 16 Oct 2009 22:41:30 +0000 (00:41 +0200)
the twitter feed when adding new blogs with many old entries.

posttotwitter.py

index b0048c058b27c82105de804ad52c894d37d791fb..9c13ab9591434c98e5657906eae75762beb4961b 100755 (executable)
@@ -45,7 +45,7 @@ class PostToTwitter:
                c = self.db.cursor()
                c.execute("""SELECT posts.id, posts.title, posts.link, posts.shortlink, feeds.name, feeds.twitteruser
                             FROM planet.posts INNER JOIN planet.feeds ON planet.posts.feed=planet.feeds.id
-                            WHERE approved AND NOT (twittered OR hidden) ORDER BY dat""")
+                            WHERE approved AND age(dat) < '7 days' AND NOT (twittered OR hidden) ORDER BY dat""")
                for post in c.fetchall():
                        if post[3] and len(post[3])>1:
                                short = post[3]