aboutsummaryrefslogtreecommitdiff
path: root/pyAggr3g470r.py
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2011-06-06 13:23:41 +0200
committercedricbonhomme <devnull@localhost>2011-06-06 13:23:41 +0200
commitba907539216e986f8ef376553576e0d10742b8ea (patch)
treedd3af68bfbfb60989b9c7c6d8e380f267dfe4afd /pyAggr3g470r.py
parentMinor improvements: 1) encoding of article description and article title, 2) ... (diff)
downloadnewspipe-ba907539216e986f8ef376553576e0d10742b8ea.tar.gz
newspipe-ba907539216e986f8ef376553576e0d10742b8ea.tar.bz2
newspipe-ba907539216e986f8ef376553576e0d10742b8ea.zip
Added 'daily average' (ie average number of articles posted per day) value on the feed page.
Diffstat (limited to 'pyAggr3g470r.py')
-rwxr-xr-xpyAggr3g470r.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index 3e26326b..f928b089 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -36,6 +36,7 @@ import threading
from collections import Counter
from BeautifulSoup import BeautifulSoup
+from datetime import date
import utils
import feedgetter
@@ -563,6 +564,13 @@ class Root:
html += """<a href="/mail_notification/0:%s">Stop</a> receiving articles from this feed.</p>""" % \
(feed.feed_id, )
+ first_article = utils.string_to_datetime(feed.articles.values()[0].article_date)
+ last_article = utils.string_to_datetime(feed.articles.values()[-1].article_date)
+ delta = first_article - last_article
+ delta_today = date.today() - last_article
+ html += "<p>The last article was posted " + str(abs(delta_today.days)) + " day(s) ago.</p>"
+ html += "<p>Daily average: " + str(abs(delta.days)/feed.nb_articles) + "</p>\n"
+
html += "<br /><h1>Recent articles</h1>"
for article in feed.articles.values()[:10]:
if article.article_readed == "0":
bgstack15