aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcedricbonhomme <devnull@localhost>2011-06-06 21:30:45 +0200
committercedricbonhomme <devnull@localhost>2011-06-06 21:30:45 +0200
commit0989ddf21a3f31f33ef40bc7f6fc88be61174835 (patch)
tree5484f0d4a5e681da3551ebc4eff3452671dbc185
parentAdded 'daily average' (ie average number of articles posted per day) value on... (diff)
downloadnewspipe-0989ddf21a3f31f33ef40bc7f6fc88be61174835.tar.gz
newspipe-0989ddf21a3f31f33ef40bc7f6fc88be61174835.tar.bz2
newspipe-0989ddf21a3f31f33ef40bc7f6fc88be61174835.zip
Added more informations about a feed in the 'feed summary' page.
-rwxr-xr-xpyAggr3g470r.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/pyAggr3g470r.py b/pyAggr3g470r.py
index f928b089..fcbc058a 100755
--- a/pyAggr3g470r.py
+++ b/pyAggr3g470r.py
@@ -36,7 +36,7 @@ import threading
from collections import Counter
from BeautifulSoup import BeautifulSoup
-from datetime import date
+import datetime
import utils
import feedgetter
@@ -564,12 +564,14 @@ 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
+ last_article = utils.string_to_datetime(feed.articles.values()[0].article_date)
+ first_article = utils.string_to_datetime(feed.articles.values()[-1].article_date)
+ delta = last_article - first_article
+ delta_today = datetime.datetime.fromordinal(datetime.date.today().toordinal()) - 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 += """<p>Daily average: %s,""" % (str(abs(delta.days)/feed.nb_articles),)
+ html += """ between the %s and the %s.</p>\n""" % \
+ (feed.articles.values()[-1].article_date[:10], feed.articles.values()[0].article_date[:10])
html += "<br /><h1>Recent articles</h1>"
for article in feed.articles.values()[:10]:
bgstack15