From dd8aa488870405a74f2a9f6e8fe0e2ce98a0e037 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 5 Apr 2017 15:05:40 -0400 Subject: [PATCH] app/rss: add +rss-dead-feeds function --- modules/app/rss/autoload.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/app/rss/autoload.el b/modules/app/rss/autoload.el index 6106ed882..ac2d3ebf8 100644 --- a/modules/app/rss/autoload.el +++ b/modules/app/rss/autoload.el @@ -63,3 +63,18 @@ (with-current-buffer (elfeed-search-buffer) (forward-line -1) (call-interactively '+rss/open))) + +;;;###autoload +(defun +rss-dead-feeds (&optional years) + "Return a list of feeds that haven't posted anything in YEARS." + (let* ((years (or years 1.0)) + (living-feeds (make-hash-table :test 'equal)) + (seconds (* years 365.0 24 60 60)) + (threshold (- (float-time) seconds))) + (with-elfeed-db-visit (entry feed) + (let ((date (elfeed-entry-date entry))) + (when (> date threshold) + (setf (gethash (elfeed-feed-url feed) living-feeds) t)))) + (cl-loop for url in (elfeed-feed-list) + unless (gethash url living-feeds) + collect url)))