subscription - published threshold

This commit is contained in:
Corban-Lee Jones 2024-07-10 11:44:28 +01:00
parent e1eb0dc8e8
commit 340a2f92a6
2 changed files with 6 additions and 0 deletions

View File

@ -125,6 +125,10 @@ class TaskCog(commands.Cog):
for item in feed.items:
log.debug("processing item '%s'", item.guid)
if item.pub_date < sub.published_threshold:
log.debug("item '%s' older than subscription threshold '%s', skipping", item.pub_date, sub.published_threshold)
continue
blocked = any(self.filter_item(_filter, item) for _filter in filters)
mutated_item = item.create_mutated_copy(sub.mutators)

View File

@ -281,6 +281,7 @@ class Subscription(DjangoDataModel):
mutators: dict[str, list[dict]]
article_fetch_image: bool
embed_colour: str
published_threshold: datetime
active: bool
channels_count: int
@ -292,6 +293,7 @@ class Subscription(DjangoDataModel):
"title": item.pop("article_title_mutators"),
"description": item.pop("article_desc_mutators")
}
item["published_threshold"] = datetime.strptime(item["published_threshold"], "%Y-%m-%d")
return item