From 9766ef6605a8fdd5f8d4981906e120944b9fdfc3 Mon Sep 17 00:00:00 2001 From: Vincent Zeng Date: Sat, 25 Nov 2017 21:39:58 -0500 Subject: [PATCH] adding a 30 day limit to listing entries for global feels resolves #11 --- ttbp/ttbp.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ttbp/ttbp.py b/ttbp/ttbp.py index 4e75fc6..353cfc9 100644 --- a/ttbp/ttbp.py +++ b/ttbp/ttbp.py @@ -41,6 +41,7 @@ import time import json from email.mime.text import MIMEText; import re +import datetime import inflect @@ -800,7 +801,14 @@ def view_feed(): for entry in filenames: ## hardcoded bs if core.valid(entry): - if re.search("2017", entry): + year = int(entry[0:4]) + month = int(entry[4:6]) + day = int(entry[6:8]) + datecheck = datetime.date(year, month, day) + displayCutoff = datetime.date.today() - datetime.timedelta(days=30) + + if datecheck > displayCutoff: + #if re.search("2017", entry): feedList.append(os.path.join(entryDir, entry)) metas = core.meta(feedList)