aboutsummaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCédric Bonhomme <kimble.mandel@gmail.com>2012-12-02 23:34:22 +0100
committerCédric Bonhomme <kimble.mandel@gmail.com>2012-12-02 23:34:22 +0100
commit185a6b4e48bbf0b1111bc5addace1f6ea5ec69f0 (patch)
tree3c4be4dd594a8385b40db156ef068ce151ec4b86 /source
parentUpdated comments in mongodb.py. (diff)
downloadnewspipe-185a6b4e48bbf0b1111bc5addace1f6ea5ec69f0.tar.gz
newspipe-185a6b4e48bbf0b1111bc5addace1f6ea5ec69f0.tar.bz2
newspipe-185a6b4e48bbf0b1111bc5addace1f6ea5ec69f0.zip
New page (/inactives) which displays the list of inactive feeds since a certain number of days (given in parameter in the URL, 365 days by default).
Diffstat (limited to 'source')
-rwxr-xr-xsource/pyAggr3g470r.py19
-rw-r--r--source/templates/inactives.html13
2 files changed, 32 insertions, 0 deletions
diff --git a/source/pyAggr3g470r.py b/source/pyAggr3g470r.py
index 72320dc4..afd30f72 100755
--- a/source/pyAggr3g470r.py
+++ b/source/pyAggr3g470r.py
@@ -758,6 +758,25 @@ class pyAggr3g470r(object):
favorites.exposed = True
@require()
+ def inactives(self, nb_days=365):
+ """
+ List of favorites articles
+ """
+ feeds = self.mongo.get_all_feeds()
+ today = datetime.datetime.now()
+ inactives = []
+ for feed in feeds:
+ more_recent_article = self.mongo.get_articles(feed["feed_id"], limit=1)
+ last_post = next(more_recent_article)["article_date"]
+ elapsed = today - last_post
+ if elapsed > datetime.timedelta(days=int(nb_days)):
+ inactives.append((feed, elapsed))
+ tmpl = lookup.get_template("inactives.html")
+ return tmpl.render(inactives=inactives, nb_days=int(nb_days))
+
+ inactives.exposed = True
+
+ @require()
def add_feed(self, url):
"""
Add a new feed with the URL of a page.
diff --git a/source/templates/inactives.html b/source/templates/inactives.html
new file mode 100644
index 00000000..10a79e8e
--- /dev/null
+++ b/source/templates/inactives.html
@@ -0,0 +1,13 @@
+## inactives.html
+<%inherit file="base.html"/>
+<div class="left inner">
+ %if inactives != []:
+ <h1>Feeds with no recent articles since ${nb_days} days:</h1>
+ <ul>
+ %for item in inactives:
+ <li><a href="/feed/${item[0]["feed_id"]}">${item[0]["feed_title"]}</a> (${item[1].days} days)</li>
+ %endfor
+ </ul>
+ %else:
+ <p>No inactive feeds.<p>
+ %endif \ No newline at end of file
bgstack15